diff mbox series

[SRv6,End.X] Signed-off-by: Reji Thomas <rejithomas@juniper.net>

Message ID 20201012083749.37076-1-rejithomas@juniper.net (mailing list archive)
State Not Applicable
Headers show
Series [SRv6,End.X] Signed-off-by: Reji Thomas <rejithomas@juniper.net> | expand

Commit Message

Reji Thomas Oct. 12, 2020, 8:37 a.m. UTC
seg6: Fix End.X nexthop to use oif.
 Currently End.X action doesn't consider the outgoing interface
 while looking up the nexthop.This breaks packet path functionality
 while using link local address as the End.X nexthop.The patch
 fixes this for link local addresses.

Signed-off-by: Reji Thomas <rejithomas@juniper.net>
---
 net/ipv6/seg6_local.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Jakub Kicinski Oct. 12, 2020, 4:11 p.m. UTC | #1
On Mon, 12 Oct 2020 14:07:49 +0530 Reji Thomas wrote:
> seg6: Fix End.X nexthop to use oif.
>  Currently End.X action doesn't consider the outgoing interface
>  while looking up the nexthop.This breaks packet path functionality
>  while using link local address as the End.X nexthop.The patch
>  fixes this for link local addresses.
> 
> Signed-off-by: Reji Thomas <rejithomas@juniper.net>

Looks like the subject is broken, please resend.

Also - is this a regression or did it never work? Would be good to see
a Fixes tag.
diff mbox series

Patch

diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
index eba23279912d..26a1c1e3e560 100644
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -246,6 +246,16 @@  static int input_action_end_x(struct sk_buff *skb, struct seg6_local_lwt *slwt)
 
 	advance_nextseg(srh, &ipv6_hdr(skb)->daddr);
 
+	if (ipv6_addr_type(&slwt->nh6) & IPV6_ADDR_LINKLOCAL) {
+		struct net *net = dev_net(skb->dev);
+		struct net_device *odev;
+
+		odev = dev_get_by_index_rcu(net, slwt->oif);
+		if (!odev)
+			goto drop;
+		skb->dev = odev;
+	}
+
 	seg6_lookup_nexthop(skb, &slwt->nh6, 0);
 
 	return dst_input(skb);
@@ -566,7 +576,8 @@  static struct seg6_action_desc seg6_action_table[] = {
 	},
 	{
 		.action		= SEG6_LOCAL_ACTION_END_X,
-		.attrs		= (1 << SEG6_LOCAL_NH6),
+		.attrs		= ((1 << SEG6_LOCAL_NH6) |
+				   (1 << SEG6_LOCAL_OIF)),
 		.input		= input_action_end_x,
 	},
 	{