vlan: fix network_header/mac_header adjustments
authorPatrick McHardy <kaber@trash.net>
Tue, 8 Jul 2008 10:21:27 +0000 (03:21 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 8 Jul 2008 10:21:27 +0000 (03:21 -0700)
Lennert Buytenhek points out that the VLAN code incorrectly adjusts
skb->network_header to point in the middle of the VLAN header and
additionally tries to adjust skb->mac_header without checking for
validity.

The network_header should not be touched at all since we're only
adding headers in front of it, mac_header adjustments are not
necessary at all.

Based on patch by Lennert Buytenhek <buytenh@wantstofly.org>.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/if_vlan.h
net/8021q/vlan_dev.c

index 5190452ac7dc8b7c5488f22958249502e7bcff09..8f5bf9b676aaac66ae0152d4d1d2d8ad517bb1a4 100644 (file)
@@ -279,8 +279,6 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short
        veth->h_vlan_TCI = htons(tag);
 
        skb->protocol = htons(ETH_P_8021Q);
-       skb->mac_header -= VLAN_HLEN;
-       skb->network_header -= VLAN_HLEN;
 
        return skb;
 }
index a0617bf7cec6666830ea2d2dc115d58dbbe129cd..4a8525927c276f8fbf10c86068d67d6f42d81ad4 100644 (file)
@@ -308,7 +308,6 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
                        vhdr->h_vlan_encapsulated_proto = htons(len);
 
                skb->protocol = htons(ETH_P_8021Q);
-               skb_reset_network_header(skb);
        }
 
        /* Before delegating work to the lower layer, enter our MAC-address */