linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Reji Thomas <rejithomas@juniper.net>
To: dlebrun@google.com
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, rejithomas@juniper.net,
	rejithomas.d@gmail.com
Subject: [PATCH SRv6 End.X] Signed-off-by: Reji Thomas <rejithomas@juniper.net>
Date: Mon, 12 Oct 2020 14:07:49 +0530	[thread overview]
Message-ID: <20201012083749.37076-1-rejithomas@juniper.net> (raw)

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


             reply	other threads:[~2020-10-12  9:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-12  8:37 Reji Thomas [this message]
2020-10-12 16:11 ` [PATCH SRv6 End.X] Signed-off-by: Reji Thomas <rejithomas@juniper.net> Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201012083749.37076-1-rejithomas@juniper.net \
    --to=rejithomas@juniper.net \
    --cc=davem@davemloft.net \
    --cc=dlebrun@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rejithomas.d@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).