From: David Lebrun <david.lebrun@uclouvain.be>
To: <netdev@vger.kernel.org>
Cc: David Lebrun <david.lebrun@uclouvain.be>
Subject: [PATCH net-next 3/5] ipv6: sr: enforce IPv6 packets for seg6local lwt
Date: Wed, 23 Aug 2017 17:32:01 +0200 [thread overview]
Message-ID: <20170823153203.11951-4-david.lebrun@uclouvain.be> (raw)
In-Reply-To: <20170823153203.11951-1-david.lebrun@uclouvain.be>
This patch ensures that the seg6local lightweight tunnel is used solely
with IPv6 routes and processes only IPv6 packets.
Signed-off-by: David Lebrun <david.lebrun@uclouvain.be>
---
net/ipv6/seg6_local.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
index 609b94e..c626325 100644
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -357,6 +357,11 @@ static int seg6_local_input(struct sk_buff *skb)
struct seg6_action_desc *desc;
struct seg6_local_lwt *slwt;
+ if (skb->protocol != htons(ETH_P_IPV6)) {
+ kfree_skb(skb);
+ return -EINVAL;
+ }
+
slwt = seg6_local_lwtunnel(orig_dst->lwtstate);
desc = slwt->desc;
@@ -623,6 +628,9 @@ static int seg6_local_build_state(struct nlattr *nla, unsigned int family,
struct seg6_local_lwt *slwt;
int err;
+ if (family != AF_INET6)
+ return -EINVAL;
+
err = nla_parse_nested(tb, SEG6_LOCAL_MAX, nla, seg6_local_policy,
extack);
--
2.10.2
next prev parent reply other threads:[~2017-08-23 15:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-23 15:31 [PATCH net-next 0/5] net: updates for IPv6 Segment Routing David Lebrun
2017-08-23 15:31 ` [PATCH net-next 1/5] ipv6: sr: add support for ip4ip6 encapsulation David Lebrun
2017-08-23 15:32 ` [PATCH net-next 2/5] ipv6: sr: add support for encapsulation of L2 frames David Lebrun
2017-08-24 21:15 ` David Miller
2017-08-23 15:32 ` David Lebrun [this message]
2017-08-23 15:32 ` [PATCH net-next 4/5] ipv6: sr: add helper functions for seg6local David Lebrun
2017-08-23 15:33 ` [PATCH net-next 5/5] ipv6: sr: implement additional seg6local actions David Lebrun
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=20170823153203.11951-4-david.lebrun@uclouvain.be \
--to=david.lebrun@uclouvain.be \
--cc=netdev@vger.kernel.org \
/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).