All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipv6: fix icmp6_send() route lookup
@ 2019-02-07 15:05 Alin Nastac
  2019-02-11 20:38 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Alin Nastac @ 2019-02-07 15:05 UTC (permalink / raw)
  To: netdev

Original packet destination address must be used as saddr for the
route lookup performed by icmp6_send() even when this address is
not local. This fixes the IPv6 router ability to send back
destination unreachable ICMPv6 errors for forwarded packets when
the route toward the saddr of the original packet is source
filtered (e.g. a default route with a "from PD" attribute, where
PD is the delegated prefix).

Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
---
 net/ipv6/icmp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index bbcdfd2..8f17065 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -455,8 +455,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
 	 */
 	addr_type = ipv6_addr_type(&hdr->daddr);
 
-	if (ipv6_chk_addr(net, &hdr->daddr, skb->dev, 0) ||
-	    ipv6_chk_acast_addr_src(net, skb->dev, &hdr->daddr))
+	if (!force_saddr)
 		saddr = &hdr->daddr;
 
 	/*
-- 
2.7.4


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

* Re: [PATCH] ipv6: fix icmp6_send() route lookup
  2019-02-07 15:05 [PATCH] ipv6: fix icmp6_send() route lookup Alin Nastac
@ 2019-02-11 20:38 ` David Miller
  2019-02-12  3:31   ` Ivan Delalande
  2019-02-12 14:13   ` Alin Năstac
  0 siblings, 2 replies; 4+ messages in thread
From: David Miller @ 2019-02-11 20:38 UTC (permalink / raw)
  To: alin.nastac; +Cc: netdev

From: Alin Nastac <alin.nastac@gmail.com>
Date: Thu,  7 Feb 2019 16:05:31 +0100

> Original packet destination address must be used as saddr for the
> route lookup performed by icmp6_send() even when this address is
> not local. This fixes the IPv6 router ability to send back
> destination unreachable ICMPv6 errors for forwarded packets when
> the route toward the saddr of the original packet is source
> filtered (e.g. a default route with a "from PD" attribute, where
> PD is the delegated prefix).
> 
> Signed-off-by: Alin Nastac <alin.nastac@gmail.com>

Yes, but however this will change behavior for a lot of situations
not just the one you are interested in.

The base ipv6_chk_addr() test has been there for more than a decade
and I'm not comfortable with changing this logic until I see you
write up a full audit of all of the use cases of icmp6_send() and
how they are impacted by your changes.

Thanks.

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

* Re: [PATCH] ipv6: fix icmp6_send() route lookup
  2019-02-11 20:38 ` David Miller
@ 2019-02-12  3:31   ` Ivan Delalande
  2019-02-12 14:13   ` Alin Năstac
  1 sibling, 0 replies; 4+ messages in thread
From: Ivan Delalande @ 2019-02-12  3:31 UTC (permalink / raw)
  To: David Miller; +Cc: alin.nastac, netdev

Hi David,

On Mon, Feb 11, 2019 at 12:38:18PM -0800, David Miller wrote:
> From: Alin Nastac <alin.nastac@gmail.com>
> Date: Thu,  7 Feb 2019 16:05:31 +0100
> 
> > Original packet destination address must be used as saddr for the
> > route lookup performed by icmp6_send() even when this address is
> > not local. This fixes the IPv6 router ability to send back
> > destination unreachable ICMPv6 errors for forwarded packets when
> > the route toward the saddr of the original packet is source
> > filtered (e.g. a default route with a "from PD" attribute, where
> > PD is the delegated prefix).
> > 
> > Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
> 
> Yes, but however this will change behavior for a lot of situations
> not just the one you are interested in.
> 
> The base ipv6_chk_addr() test has been there for more than a decade
> and I'm not comfortable with changing this logic until I see you
> write up a full audit of all of the use cases of icmp6_send() and
> how they are impacted by your changes.

For what it's worth, we also have 3 internal patches changing the
selection of saddr in icmp6_send (to pick an address from the receiving
interface in priority, or the most specific to the source address of the
original packet, etc.) that we would like to submit in some form, but
that would most likely break existing setups if enabled by default.

Could we introduce a sysctl with a set of flags to enable the different
behaviors from our patches and Alin's? Or any other configuration
interface than sysctls if more appropriate.

Thank you,

-- 
Ivan Delalande
Arista Networks

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

* Re: [PATCH] ipv6: fix icmp6_send() route lookup
  2019-02-11 20:38 ` David Miller
  2019-02-12  3:31   ` Ivan Delalande
@ 2019-02-12 14:13   ` Alin Năstac
  1 sibling, 0 replies; 4+ messages in thread
From: Alin Năstac @ 2019-02-12 14:13 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On Mon, Feb 11, 2019 at 9:38 PM David Miller <davem@davemloft.net> wrote:
>
> From: Alin Nastac <alin.nastac@gmail.com>
> Date: Thu,  7 Feb 2019 16:05:31 +0100
>
> > Original packet destination address must be used as saddr for the
> > route lookup performed by icmp6_send() even when this address is
> > not local. This fixes the IPv6 router ability to send back
> > destination unreachable ICMPv6 errors for forwarded packets when
> > the route toward the saddr of the original packet is source
> > filtered (e.g. a default route with a "from PD" attribute, where
> > PD is the delegated prefix).
> >
> > Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
>
> Yes, but however this will change behavior for a lot of situations
> not just the one you are interested in.
>
> The base ipv6_chk_addr() test has been there for more than a decade
> and I'm not comfortable with changing this logic until I see you
> write up a full audit of all of the use cases of icmp6_send() and
> how they are impacted by your changes.

Please consider these:
 - saddr variable is used only to perform route lookup towards the skb
originator and is explicitly reset to NULL when skb is multicast (see
the if statement below the change).
 - In order for icmp6_send() to perform its duty, this route lookup
must succeed.
 - As long as your IPv6 routes don't use source filtering or
source-based routing, this change will have absolutely no effect on
the kernel behavior because route lookup will succeed regardless of
the fl6.saddr value.

I don't contest the usefulness of ipv6_chk_addr(), it clearly has its
purpose. However when it comes to generating ICMPv6 errors, both
routers and hosts are entitled to generate them (see RFC 4443), hence
this test shouldn't be called here.

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

end of thread, other threads:[~2019-02-12 14:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-07 15:05 [PATCH] ipv6: fix icmp6_send() route lookup Alin Nastac
2019-02-11 20:38 ` David Miller
2019-02-12  3:31   ` Ivan Delalande
2019-02-12 14:13   ` Alin Năstac

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.