diff options
author | Eric Garver <e@erig.me> | 2018-02-14 15:18:04 -0800 |
---|---|---|
committer | Pravin B Shelar <pshelar@ovn.org> | 2018-02-16 00:43:28 -0800 |
commit | fcb77796c4d133c3ac37dc00b8fe8398c1c75f20 (patch) | |
tree | 05d29ef2899a13e28c801c88feeb20b23703c0b0 | |
parent | 893b9906cad89662c901f2cc4f1b051410b05eec (diff) | |
download | openvswitch-fcb77796c4d133c3ac37dc00b8fe8398c1c75f20.tar.gz |
datapath: Fix pop_vlan action for double tagged frames
Upstream commit:
commit c48e74736fccf25fb32bb015426359e1c2016e3b
Author: Eric Garver <e@erig.me>
Date: Wed Dec 20 15:09:22 2017 -0500
openvswitch: Fix pop_vlan action for double tagged frames
skb_vlan_pop() expects skb->protocol to be a valid TPID for double
tagged frames. So set skb->protocol to the TPID and let skb_vlan_pop()
shift the true ethertype into position for us.
Fixes: 5108bbaddc37 ("openvswitch: add processing of L3 packets")
Signed-off-by: Eric Garver <e@erig.me>
Reviewed-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Eric Garver <e@erig.me>
Fixes: a27c454ee0 ("datapath: add processing of L3 packets")
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
-rw-r--r-- | datapath/flow.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/datapath/flow.c b/datapath/flow.c index e345ec91b..fadc07472 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -584,6 +584,7 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key) return -EINVAL; skb_reset_network_header(skb); + key->eth.type = skb->protocol; } else { eth = eth_hdr(skb); ether_addr_copy(key->eth.src, eth->h_source); @@ -597,16 +598,24 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key) if (unlikely(parse_vlan(skb, key))) return -ENOMEM; - skb->protocol = parse_ethertype(skb); - if (unlikely(skb->protocol == htons(0))) + key->eth.type = parse_ethertype(skb); + if (unlikely(key->eth.type == htons(0))) return -ENOMEM; + /* Multiple tagged packets need to retain TPID to satisfy + * skb_vlan_pop(), which will later shift the ethertype into + * skb->protocol. + */ + if (key->eth.cvlan.tci & htons(VLAN_TAG_PRESENT)) + skb->protocol = key->eth.cvlan.tpid; + else + skb->protocol = key->eth.type; + skb_reset_network_header(skb); __skb_push(skb, skb->data - skb_mac_header(skb)); } skb_reset_mac_len(skb); - key->eth.type = skb->protocol; /* Network layer. */ if (key->eth.type == htons(ETH_P_IP)) { |