diff options
author | Lorenzo Bianconi <lorenzo.bianconi@redhat.com> | 2019-01-18 12:05:39 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-02-06 17:30:06 +0100 |
commit | 0a198e0bb8bef51ced179702ad1af6f9e3715b64 (patch) | |
tree | dd7711aa0b5ba877a2dc2b9d2e6d026c6e6bb4b8 /net/ipv4/ip_gre.c | |
parent | 897ea28bd2f96b88942d828f92bf223895d8ed0b (diff) | |
download | linux-stable-0a198e0bb8bef51ced179702ad1af6f9e3715b64.tar.gz linux-stable-0a198e0bb8bef51ced179702ad1af6f9e3715b64.tar.bz2 linux-stable-0a198e0bb8bef51ced179702ad1af6f9e3715b64.zip |
net: ip_gre: use erspan key field for tunnel lookup
[ Upstream commit cb73ee40b1b381eaf3749e6dbeed567bb38e5258 ]
Use ERSPAN key header field as tunnel key in gre_parse_header routine
since ERSPAN protocol sets the key field of the external GRE header to
0 resulting in a tunnel lookup fail in ip6gre_err.
In addition remove key field parsing and pskb_may_pull check in
erspan_rcv and ip6erspan_rcv
Fixes: 5a963eb61b7c ("ip6_gre: Add ERSPAN native tunnel support")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/ipv4/ip_gre.c')
-rw-r--r-- | net/ipv4/ip_gre.c | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index c097be590976..f199945f6e4a 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -269,20 +269,11 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi, int len; itn = net_generic(net, erspan_net_id); - len = gre_hdr_len + sizeof(*ershdr); - - /* Check based hdr len */ - if (unlikely(!pskb_may_pull(skb, len))) - return PACKET_REJECT; iph = ip_hdr(skb); ershdr = (struct erspan_base_hdr *)(skb->data + gre_hdr_len); ver = ershdr->ver; - /* The original GRE header does not have key field, - * Use ERSPAN 10-bit session ID as key. - */ - tpi->key = cpu_to_be32(get_session_id(ershdr)); tunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, tpi->flags | TUNNEL_KEY, iph->saddr, iph->daddr, tpi->key); |