openvswitch: fix vlan subtraction from packet length
authorJiri Benc <jbenc@redhat.com>
Mon, 10 Oct 2016 15:02:43 +0000 (17:02 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 13 Oct 2016 14:03:23 +0000 (10:03 -0400)
When the packet has its vlan tag in skb->vlan_tci, the length of the VLAN
header is not counted in skb->len. It doesn't make sense to subtract it.

Fixes: 018c1dda5ff1 ("openvswitch: 802.1AD Flow handling, actions, vlan parsing, netlink attributes")
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Eric Garver <e@erig.me>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/openvswitch/vport.c

index 8f198437c724839e61a84cc71fd1f4090912a9fc..7387418ac514ae0ab679aa1b0d677ddbc9363f7b 100644 (file)
@@ -485,7 +485,8 @@ static unsigned int packet_length(const struct sk_buff *skb)
 {
        unsigned int length = skb->len - ETH_HLEN;
 
-       if (skb_vlan_tagged(skb))
+       if (!skb_vlan_tag_present(skb) &&
+           eth_type_vlan(skb->protocol))
                length -= VLAN_HLEN;
 
        /* Don't subtract for multiple VLAN tags. Most (all?) drivers allow