Commit acc81e14 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

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 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: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 256f3bfc
...@@ -279,8 +279,6 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short ...@@ -279,8 +279,6 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short
veth->h_vlan_TCI = htons(tag); veth->h_vlan_TCI = htons(tag);
skb->protocol = htons(ETH_P_8021Q); skb->protocol = htons(ETH_P_8021Q);
skb->mac_header -= VLAN_HLEN;
skb->network_header -= VLAN_HLEN;
return skb; return skb;
} }
......
...@@ -308,7 +308,6 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, ...@@ -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); vhdr->h_vlan_encapsulated_proto = htons(len);
skb->protocol = htons(ETH_P_8021Q); skb->protocol = htons(ETH_P_8021Q);
skb_reset_network_header(skb);
} }
/* Before delegating work to the lower layer, enter our MAC-address */ /* Before delegating work to the lower layer, enter our MAC-address */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment