linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH SRv6 End.X] Signed-off-by: Reji Thomas <rejithomas@juniper.net>
@ 2020-10-12  8:37 Reji Thomas
  2020-10-12 16:11 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Reji Thomas @ 2020-10-12  8:37 UTC (permalink / raw)
  To: dlebrun; +Cc: davem, netdev, linux-kernel, rejithomas, rejithomas.d

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(-)

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,
 	},
 	{
-- 
2.17.1


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

end of thread, other threads:[~2020-10-12 16:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-12  8:37 [PATCH SRv6 End.X] Signed-off-by: Reji Thomas <rejithomas@juniper.net> Reji Thomas
2020-10-12 16:11 ` Jakub Kicinski

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).