Skip to contentSkip to conversation

vrf: packets with lladdr src needs dst at input with orig_iif when needs strict

PATCH In review Stephen Suryaputra 3 participants 5 messages Dec 4, 2020 – Dec 5, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vrf: packets with lladdr src needs dst at input with orig_iif when needs strict

Depending on the order of the routes to fe80::/64 are installed on the VRF table, the NS for the source link-local address of the originator might be sent to the wrong interface.

This patch ensures that packets with link-local addr source is doing a lookup with the orig_iif when the destination addr indicates that it is strict.

Add the reproducer as a use case in self test script fcnal-test.sh.

---
 drivers/net/vrf.c                         | 10 ++-
 tools/testing/selftests/net/fcnal-test.sh | 95 +++++++++++++++++++++++
 2 files changed, 103 insertions(+), 2 deletions(-)
drivers/net/vrf.c +8 -2
index f2793ffde191..b9b7e00b72a8 100644
@@ -1315,11 +1315,17 @@ static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev,
 	int orig_iif = skb->skb_iif;
 	bool need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr);
 	bool is_ndisc = ipv6_ndisc_frame(skb);
+	bool is_ll_src;
 
 	/* loopback, multicast & non-ND link-local traffic; do not push through
-	 * packet taps again. Reset pkt_type for upper layers to process skb
+	 * packet taps again. Reset pkt_type for upper layers to process skb.
+	 * for packets with lladdr src, however, skip so that the dst can be
+	 * determine at input using original ifindex in the case that daddr
+	 * needs strict
 	 */
-	if (skb->pkt_type == PACKET_LOOPBACK || (need_strict && !is_ndisc)) {
+	is_ll_src = ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL;
+	if (skb->pkt_type == PACKET_LOOPBACK ||
+	    (need_strict && !is_ndisc && !is_ll_src)) {
 		skb->dev = vrf_dev;
 		skb->skb_iif = vrf_dev->ifindex;
 		IP6CB(skb)->flags |= IP6SKB_L3SLAVE;
tools/testing/selftests/net/fcnal-test.sh +95 -0

117 lines not on this page · raw message

Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Stephen Suryaputra

Depending on the order of the routes to fe80::/64 are installed on the VRF table, the NS for the source link-local address of the originator might be sent to the wrong interface.

This patch ensures that packets with link-local addr source is doing a lookup with the orig_iif when the destination addr indicates that it is strict.

Quoted 8 lines

Add the reproducer as a use case in self test script fcnal-test.sh.

---
 drivers/net/vrf.c                         | 10 ++-
 tools/testing/selftests/net/fcnal-test.sh | 95 +++++++++++++++++++++++
 2 files changed, 103 insertions(+), 2 deletions(-)
maintainer
#2 lore raw
Quoted 11 lines · On Fri, 4 Dec 2020 09:32:04 -0700 David Ahern wrote:
Quoted 10 lines · Stephen Suryaputra

Depending on the order of the routes to fe80::/64 are installed on the VRF table, the NS for the source link-local address of the originator might be sent to the wrong interface.

This patch ensures that packets with link-local addr source is doing a lookup with the orig_iif when the destination addr indicates that it is strict.

Add the reproducer as a use case in self test script fcnal-test.sh.

Quoted 7 lines
Quoted 5 lines
---
 drivers/net/vrf.c                         | 10 ++-
 tools/testing/selftests/net/fcnal-test.sh | 95 +++++++++++++++++++++++
 2 files changed, 103 insertions(+), 2 deletions(-)

Should I put something like:

Fixes b4869aa2f881 ("net: vrf: ipv6 support for local traffic to local addresses")

on this?

#3 lore raw
Quoted 18 lines · Jakub Kicinski
Quoted 17 lines · On Fri, 4 Dec 2020 09:32:04 -0700 David Ahern wrote:
Quoted 15 lines · Stephen Suryaputra

Depending on the order of the routes to fe80::/64 are installed on the VRF table, the NS for the source link-local address of the originator might be sent to the wrong interface.

This patch ensures that packets with link-local addr source is doing a lookup with the orig_iif when the destination addr indicates that it is strict.

Add the reproducer as a use case in self test script fcnal-test.sh.

---
 drivers/net/vrf.c                         | 10 ++-
 tools/testing/selftests/net/fcnal-test.sh | 95 +++++++++++++++++++++++
 2 files changed, 103 insertions(+), 2 deletions(-)
Quoted 7 lines
Quoted 1 line

Should I put something like:

Fixes b4869aa2f881 ("net: vrf: ipv6 support for local traffic to local addresses")

on this?

I was conflicted when I was about to put Fixes tag on this patch because it could either be b4869aa2f881 that you mentioned above, or 6f12fa7755301 ("vrf: mark skb for multicast or link-local as enslaved to VRF"). So, I decided not to put it, but may be I should so that this is qualified to be queued to stable?

Thanks,
Stephen.

maintainer
#4 lore raw
Quoted 25 lines · On Fri, 4 Dec 2020 19:22:27 -0500 Stephen Suryaputra wrote:
Quoted 24 lines · Jakub Kicinski
Quoted 11 lines · On Fri, 4 Dec 2020 09:32:04 -0700 David Ahern wrote:
Quoted 10 lines · Stephen Suryaputra

Depending on the order of the routes to fe80::/64 are installed on the VRF table, the NS for the source link-local address of the originator might be sent to the wrong interface.

This patch ensures that packets with link-local addr source is doing a lookup with the orig_iif when the destination addr indicates that it is strict.

Add the reproducer as a use case in self test script fcnal-test.sh.

Quoted 7 lines
Quoted 5 lines
---
 drivers/net/vrf.c                         | 10 ++-
 tools/testing/selftests/net/fcnal-test.sh | 95 +++++++++++++++++++++++
 2 files changed, 103 insertions(+), 2 deletions(-)  

Should I put something like:

Fixes b4869aa2f881 ("net: vrf: ipv6 support for local traffic to local addresses")
Quoted 7 lines
Quoted 1 line

on this?

I was conflicted when I was about to put Fixes tag on this patch because it could either be b4869aa2f881 that you mentioned above, or 6f12fa7755301 ("vrf: mark skb for multicast or link-local as enslaved to VRF"). So, I decided not to put it, but may be I should so that this is qualified to be queued to stable?

Yeah, probably doesn't matter that much in practice. Either one would work, since the patch won't apply without 6f12fa7755301.

I added the one I mentioned and applied to net.

Thanks!