]> git.proxmox.com Git - mirror_ovs.git/commitdiff
erspan: fix invalid erspan version.
authorWilliam Tu <u9012063@gmail.com>
Thu, 17 May 2018 20:36:47 +0000 (13:36 -0700)
committerBen Pfaff <blp@ovn.org>
Tue, 22 May 2018 03:33:30 +0000 (20:33 -0700)
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.

Without this patch, we observe warning message from ovs-vswitchd as below,
due to receive an malformed erspan packet:

odp_util|WARN|odp_tun_key_from_attr__ invalid erspan version

Reported-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
datapath/linux/compat/ip_gre.c

index 9240ab2eab6bdff0c8abf4adea54a3beb3973ec0..484a890d4e748ebf9a70a60071257677a6c40b1e 100644 (file)
@@ -1006,10 +1006,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));