commit 2381526d1d9ed17c60bd0cf875f23ca079909753 Author: Patrick McHardy Date: Sat Jul 5 20:32:11 2008 +0200 vlan: fix network_header/mac_header adjustments 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 the mac_header without checking for validty. The network_header should not be touched at all, the mac_header should simply be set to the beginning of the VLAN header. Based on patch by Lennert Buytenhek . Signed-off-by: Patrick McHardy diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 037929f..d0157d4 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -188,8 +188,7 @@ 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; + skb_reset_mac_header(skb); return skb; } diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 5dc0fe6..147ba25 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -308,7 +308,7 @@ 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); + skb_reset_mac_header(skb); } /* Before delegating work to the lower layer, enter our MAC-address */