diff options
author | William Tu <u9012063@gmail.com> | 2018-05-16 17:24:32 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-05-17 15:48:49 -0400 |
commit | 02f99df1875c11330cd0be69a40fa8ccd14749b2 (patch) | |
tree | 762c9819fbfeba1bedcdd4eb815bdd3cff4230be /net/ipv4/ip_gre.c | |
parent | d13d170cba8a68b7f25b4a01193b7014b7bc7a72 (diff) | |
download | linux-stable-02f99df1875c11330cd0be69a40fa8ccd14749b2.tar.gz linux-stable-02f99df1875c11330cd0be69a40fa8ccd14749b2.tar.bz2 linux-stable-02f99df1875c11330cd0be69a40fa8ccd14749b2.zip |
erspan: fix invalid erspan version.
ERSPAN only support version 1 and 2. When packets send to an
erspan device which does not have proper version number set,
drop the packet. In real case, we observe multicast packets
sent to the erspan pernet device, erspan0, which does not have
erspan version configured.
Reported-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_gre.c')
-rw-r--r-- | net/ipv4/ip_gre.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 9c169bb2444d..f200b304f76c 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -722,10 +722,12 @@ static netdev_tx_t erspan_xmit(struct sk_buff *skb, erspan_build_header(skb, ntohl(tunnel->parms.o_key), tunnel->index, truncate, true); - else + else if (tunnel->erspan_ver == 2) erspan_build_header_v2(skb, ntohl(tunnel->parms.o_key), tunnel->dir, tunnel->hwid, truncate, true); + else + goto free_skb; tunnel->parms.o_flags &= ~TUNNEL_KEY; __gre_xmit(skb, dev, &tunnel->parms.iph, htons(ETH_P_ERSPAN)); |