summaryrefslogtreecommitdiffstats
path: root/net/ipv6/af_inet6.c
diff options
context:
space:
mode:
authorMaciej Żenczykowski <maze@google.com>2011-11-07 15:57:21 +0100
committerDavid S. Miller <davem@davemloft.net>2011-11-08 21:13:03 +0100
commitf74024d9f05caa570dcf7582b498bbf011943491 (patch)
tree1fa2bbbcbc337f6d1db23b09acd2ee8b48e37389 /net/ipv6/af_inet6.c
parentsweep the floors and convert some .get_drvinfo routines to strlcpy (diff)
downloadlinux-f74024d9f05caa570dcf7582b498bbf011943491.tar.xz
linux-f74024d9f05caa570dcf7582b498bbf011943491.zip
net: make ipv6 bind honour freebind
This makes native ipv6 bind follow the precedent set by: - native ipv4 bind behaviour - dual stack ipv4-mapped ipv6 bind behaviour. This does allow an unpriviledged process to spoof its source IPv6 address, just like it currently can spoof its source IPv4 address (for example when using UDP). Signed-off-by: Maciej Żenczykowski <maze@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/af_inet6.c')
-rw-r--r--net/ipv6/af_inet6.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index d27c797f9f05..1040424c788f 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -347,7 +347,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
*/
v4addr = LOOPBACK4_IPV6;
if (!(addr_type & IPV6_ADDR_MULTICAST)) {
- if (!inet->transparent &&
+ if (!(inet->freebind || inet->transparent) &&
!ipv6_chk_addr(net, &addr->sin6_addr,
dev, 0)) {
err = -EADDRNOTAVAIL;