summaryrefslogtreecommitdiff
path: root/datapath
diff options
context:
space:
mode:
authorWilliam Tu <u9012063@gmail.com>2018-05-17 13:36:47 -0700
committerBen Pfaff <blp@ovn.org>2018-05-21 20:33:30 -0700
commit5e720da59d08ad02e2bfb040e03e8274a8fc0bad (patch)
treed77f5bb23ddf58803624a7933440e1e6ec571ed5 /datapath
parent828677b26d672bf0c3c1505ac703397e23000579 (diff)
downloadopenvswitch-5e720da59d08ad02e2bfb040e03e8274a8fc0bad.tar.gz
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. 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>
Diffstat (limited to 'datapath')
-rw-r--r--datapath/linux/compat/ip_gre.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c
index 9240ab2ea..484a890d4 100644
--- a/datapath/linux/compat/ip_gre.c
+++ b/datapath/linux/compat/ip_gre.c
@@ -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));