Skip to content

Commit f74024d

Browse files
zenczykowskidavem330
authored andcommitted
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>
1 parent 68aad78 commit f74024d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ipv6/af_inet6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
347347
*/
348348
v4addr = LOOPBACK4_IPV6;
349349
if (!(addr_type & IPV6_ADDR_MULTICAST)) {
350-
if (!inet->transparent &&
350+
if (!(inet->freebind || inet->transparent) &&
351351
!ipv6_chk_addr(net, &addr->sin6_addr,
352352
dev, 0)) {
353353
err = -EADDRNOTAVAIL;

0 commit comments

Comments
 (0)