Skip to content

Commit

Permalink
ipv6: sr: enforce IPv6 packets for seg6local lwt
Browse files Browse the repository at this point in the history
This patch ensures that the seg6local lightweight tunnel is used solely
with IPv6 routes and processes only IPv6 packets.

Signed-off-by: David Lebrun <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
David Lebrun authored and davem330 committed Aug 26, 2017
1 parent 38ee7f2 commit 6285217
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions net/ipv6/seg6_local.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 6285217

Please sign in to comment.