Commit 2563fa59 authored by Maciej Żenczykowski's avatar Maciej Żenczykowski Committed by David S. Miller

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: default avatarMaciej Żenczykowski <maze@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f74024d9
...@@ -654,7 +654,7 @@ int datagram_send_ctl(struct net *net, struct sock *sk, ...@@ -654,7 +654,7 @@ int datagram_send_ctl(struct net *net, struct sock *sk,
if (addr_type != IPV6_ADDR_ANY) { if (addr_type != IPV6_ADDR_ANY) {
int strict = __ipv6_addr_src_scope(addr_type) <= IPV6_ADDR_SCOPE_LINKLOCAL; int strict = __ipv6_addr_src_scope(addr_type) <= IPV6_ADDR_SCOPE_LINKLOCAL;
if (!inet_sk(sk)->transparent && if (!(inet_sk(sk)->freebind || inet_sk(sk)->transparent) &&
!ipv6_chk_addr(net, &src_info->ipi6_addr, !ipv6_chk_addr(net, &src_info->ipi6_addr,
strict ? dev : NULL, 0)) strict ? dev : NULL, 0))
err = -EINVAL; err = -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment