diff mbox

[2/2] net: make ipv6 PKTINFO honour freebind

Message ID 1320713842-21152-2-git-send-email-zenczykowski@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Maciej Żenczykowski Nov. 8, 2011, 12:57 a.m. UTC
From: Maciej Żenczykowski <maze@google.com>

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>
---
 net/ipv6/datagram.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

David Miller Nov. 8, 2011, 8:17 p.m. UTC | #1
From: Maciej Żenczykowski <zenczykowski@gmail.com>
Date: Mon,  7 Nov 2011 16:57:22 -0800

> From: Maciej Żenczykowski <maze@google.com>
> 
> 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>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index e248069..83037af 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -654,7 +654,7 @@  int datagram_send_ctl(struct net *net, struct sock *sk,
 
 			if (addr_type != IPV6_ADDR_ANY) {
 				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,
 						   strict ? dev : NULL, 0))
 					err = -EINVAL;