linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ipv6: check net in ip6_call_ra_chain
@ 2019-02-28 19:01 Francesco Ruggeri
  2019-02-28 21:02 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Francesco Ruggeri @ 2019-02-28 19:01 UTC (permalink / raw)
  To: yoshfuji, kuznet, davem, maxim, linux-kernel, netdev, fruggeri

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@arista.com>
Signed-off-by: Maxim Martynov <maxim@arista.com>
Signed-off-by: Francesco Ruggeri <fruggeri@arista.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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: ipv6: check net in ip6_call_ra_chain
  2019-02-28 19:01 [PATCH] net: ipv6: check net in ip6_call_ra_chain Francesco Ruggeri
@ 2019-02-28 21:02 ` David Miller
  2019-02-28 23:31   ` David Ahern
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2019-02-28 21:02 UTC (permalink / raw)
  To: fruggeri; +Cc: yoshfuji, kuznet, maxim, linux-kernel, netdev

From: fruggeri@arista.com (Francesco Ruggeri)
Date: Thu, 28 Feb 2019 11:01:46 -0800

> 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@arista.com>
> Signed-off-by: Maxim Martynov <maxim@arista.com>
> Signed-off-by: Francesco Ruggeri <fruggeri@arista.com>

Right now someone using such a tool does get all RAs in the system.

Your change not only breaks them, but also gives them no method by
which to keep obtaining the same behavior.

I don't know what to do or suggest in this situation, but right now
I'm putting this patch on hold.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: ipv6: check net in ip6_call_ra_chain
  2019-02-28 21:02 ` David Miller
@ 2019-02-28 23:31   ` David Ahern
  2019-03-01  0:09     ` Francesco Ruggeri
  0 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2019-02-28 23:31 UTC (permalink / raw)
  To: David Miller, fruggeri; +Cc: yoshfuji, kuznet, maxim, linux-kernel, netdev

On 2/28/19 2:02 PM, David Miller wrote:
> From: fruggeri@arista.com (Francesco Ruggeri)
> Date: Thu, 28 Feb 2019 11:01:46 -0800
> 
>> 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@arista.com>
>> Signed-off-by: Maxim Martynov <maxim@arista.com>
>> Signed-off-by: Francesco Ruggeri <fruggeri@arista.com>
> 
> Right now someone using such a tool does get all RAs in the system.
> 
> Your change not only breaks them, but also gives them no method by
> which to keep obtaining the same behavior.
> 
> I don't know what to do or suggest in this situation, but right now
> I'm putting this patch on hold.
> 

need an equivalent to NETLINK_LISTEN_ALL_NSID

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: ipv6: check net in ip6_call_ra_chain
  2019-02-28 23:31   ` David Ahern
@ 2019-03-01  0:09     ` Francesco Ruggeri
  2019-03-01  2:08       ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Francesco Ruggeri @ 2019-03-01  0:09 UTC (permalink / raw)
  To: David Ahern
  Cc: David Miller, yoshfuji, kuznet, Maxim Martynov, linux-kernel, netdev

On Thu, Feb 28, 2019 at 3:31 PM David Ahern <dsahern@gmail.com> wrote:
>
> On 2/28/19 2:02 PM, David Miller wrote:
> > From: fruggeri@arista.com (Francesco Ruggeri)
> > Date: Thu, 28 Feb 2019 11:01:46 -0800
> >
> >> 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@arista.com>
> >> Signed-off-by: Maxim Martynov <maxim@arista.com>
> >> Signed-off-by: Francesco Ruggeri <fruggeri@arista.com>
> >
> > Right now someone using such a tool does get all RAs in the system.
> >
> > Your change not only breaks them, but also gives them no method by
> > which to keep obtaining the same behavior.
> >
> > I don't know what to do or suggest in this situation, but right now
> > I'm putting this patch on hold.
> >
>
> need an equivalent to NETLINK_LISTEN_ALL_NSID

If that would be acceptable, we can look into it.

Thanks,
Francesco

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: ipv6: check net in ip6_call_ra_chain
  2019-03-01  0:09     ` Francesco Ruggeri
@ 2019-03-01  2:08       ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-03-01  2:08 UTC (permalink / raw)
  To: fruggeri; +Cc: dsahern, yoshfuji, kuznet, maxim, linux-kernel, netdev

From: Francesco Ruggeri <fruggeri@arista.com>
Date: Thu, 28 Feb 2019 16:09:17 -0800

> On Thu, Feb 28, 2019 at 3:31 PM David Ahern <dsahern@gmail.com> wrote:
>>
>> On 2/28/19 2:02 PM, David Miller wrote:
>> > From: fruggeri@arista.com (Francesco Ruggeri)
>> > Date: Thu, 28 Feb 2019 11:01:46 -0800
>> >
>> >> 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@arista.com>
>> >> Signed-off-by: Maxim Martynov <maxim@arista.com>
>> >> Signed-off-by: Francesco Ruggeri <fruggeri@arista.com>
>> >
>> > Right now someone using such a tool does get all RAs in the system.
>> >
>> > Your change not only breaks them, but also gives them no method by
>> > which to keep obtaining the same behavior.
>> >
>> > I don't know what to do or suggest in this situation, but right now
>> > I'm putting this patch on hold.
>> >
>>
>> need an equivalent to NETLINK_LISTEN_ALL_NSID
> 
> If that would be acceptable, we can look into it.

It is.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-01  2:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-28 19:01 [PATCH] net: ipv6: check net in ip6_call_ra_chain Francesco Ruggeri
2019-02-28 21:02 ` David Miller
2019-02-28 23:31   ` David Ahern
2019-03-01  0:09     ` Francesco Ruggeri
2019-03-01  2:08       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).