mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 00:21:17 +00:00
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: 5108bbaddc
("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>
This commit is contained in:
parent
58acfd714e
commit
c48e74736f
1 changed files with 12 additions and 3 deletions
|
@ -579,6 +579,7 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
skb_reset_network_header(skb);
|
skb_reset_network_header(skb);
|
||||||
|
key->eth.type = skb->protocol;
|
||||||
} else {
|
} else {
|
||||||
eth = eth_hdr(skb);
|
eth = eth_hdr(skb);
|
||||||
ether_addr_copy(key->eth.src, eth->h_source);
|
ether_addr_copy(key->eth.src, eth->h_source);
|
||||||
|
@ -592,15 +593,23 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key)
|
||||||
if (unlikely(parse_vlan(skb, key)))
|
if (unlikely(parse_vlan(skb, key)))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
skb->protocol = parse_ethertype(skb);
|
key->eth.type = parse_ethertype(skb);
|
||||||
if (unlikely(skb->protocol == htons(0)))
|
if (unlikely(key->eth.type == htons(0)))
|
||||||
return -ENOMEM;
|
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_reset_network_header(skb);
|
||||||
__skb_push(skb, skb->data - skb_mac_header(skb));
|
__skb_push(skb, skb->data - skb_mac_header(skb));
|
||||||
}
|
}
|
||||||
skb_reset_mac_len(skb);
|
skb_reset_mac_len(skb);
|
||||||
key->eth.type = skb->protocol;
|
|
||||||
|
|
||||||
/* Network layer. */
|
/* Network layer. */
|
||||||
if (key->eth.type == htons(ETH_P_IP)) {
|
if (key->eth.type == htons(ETH_P_IP)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue