[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190228190146.802CD95C016B@us180.sjc.aristanetworks.com>
Date: Thu, 28 Feb 2019 11:01:46 -0800
From: fruggeri@...sta.com (Francesco Ruggeri)
To: yoshfuji@...ux-ipv6.org, kuznet@....inr.ac.ru, davem@...emloft.net,
maxim@...sta.com, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, fruggeri@...sta.com
Subject: [PATCH] net: ipv6: check net in ip6_call_ra_chain
ip6_call_ra_chain is called when IPv6 packet with Router Alert option
is forwarded.
It needs to check if the net of the socket is the same as the net of the
input device, otherwise the packet gets delivered to every IPv6 socket
listening for Router Alerts, no matter which network namespace it is in.
Suggested-by: Maxim Martynov <maxim@...sta.com>
Signed-off-by: Maxim Martynov <maxim@...sta.com>
Signed-off-by: Francesco Ruggeri <fruggeri@...sta.com>
---
net/ipv6/ip6_output.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 5f9fa0302b5a..3ed25e17dff3 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -299,7 +299,8 @@ static int ip6_call_ra_chain(struct sk_buff *skb, int sel)
struct sock *sk = ra->sk;
if (sk && ra->sel == sel &&
(!sk->sk_bound_dev_if ||
- sk->sk_bound_dev_if == skb->dev->ifindex)) {
+ sk->sk_bound_dev_if == skb->dev->ifindex) &&
+ net_eq(sock_net(sk), dev_net(skb->dev))) {
if (last) {
struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
if (skb2)
--
2.19.1
Powered by blists - more mailing lists