summaryrefslogtreecommitdiffstats
path: root/net/ipv6/seg6_local.c
diff options
context:
space:
mode:
authorDavid Lebrun <david.lebrun@uclouvain.be>2017-08-25 09:56:46 +0200
committerDavid S. Miller <davem@davemloft.net>2017-08-26 02:10:23 +0200
commit6285217f0c29e68b744533a9ddf50e110d36d65e (patch)
tree2b6f6c64ca2eef63fbb423247a1a8c4194727237 /net/ipv6/seg6_local.c
parentipv6: sr: add support for encapsulation of L2 frames (diff)
downloadlinux-6285217f0c29e68b744533a9ddf50e110d36d65e.tar.xz
linux-6285217f0c29e68b744533a9ddf50e110d36d65e.zip
ipv6: sr: enforce IPv6 packets for seg6local lwt
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/seg6_local.c')
-rw-r--r--net/ipv6/seg6_local.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
index 609b94e970de..c6263256fcf6 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);