Skip to content

Commit 2563fa5

Browse files
zenczykowskidavem330
authored andcommitted
net: make ipv6 PKTINFO honour freebind
This just makes it possible to spoof source IPv6 address on a socket without having to create and bind a new socket for every source IP we wish to spoof. Signed-off-by: Maciej Żenczykowski <maze@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f74024d commit 2563fa5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ipv6/datagram.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ int datagram_send_ctl(struct net *net, struct sock *sk,
654654

655655
if (addr_type != IPV6_ADDR_ANY) {
656656
int strict = __ipv6_addr_src_scope(addr_type) <= IPV6_ADDR_SCOPE_LINKLOCAL;
657-
if (!inet_sk(sk)->transparent &&
657+
if (!(inet_sk(sk)->freebind || inet_sk(sk)->transparent) &&
658658
!ipv6_chk_addr(net, &src_info->ipi6_addr,
659659
strict ? dev : NULL, 0))
660660
err = -EINVAL;

0 commit comments

Comments
 (0)