diff mbox

[net-next,2/4] vlan: Fix mac_len adjustment.

Message ID 1417473038-2165-1-git-send-email-pshelar@nicira.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Pravin B Shelar Dec. 1, 2014, 10:30 p.m. UTC
skb_reset_mac_len() sets length according to ethernet and network
offsets, but mpls expects mac-length to be offset to mpls header (ref.
skb_mpls_header()). Therefore rather than reset we need to subtract
VLAN_HLEN from mac_len.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
---
 net/core/skbuff.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Jiri Benc Dec. 3, 2014, 2:32 p.m. UTC | #1
On Mon,  1 Dec 2014 14:30:38 -0800, Pravin B Shelar wrote:
> skb_reset_mac_len() sets length according to ethernet and network
> offsets, but mpls expects mac-length to be offset to mpls header (ref.
> skb_mpls_header()). Therefore rather than reset we need to subtract
> VLAN_HLEN from mac_len.
> 
> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
> ---
>  net/core/skbuff.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 92116df..c45888f 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -4178,7 +4178,7 @@ static int __skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci)
>  	if (skb_network_offset(skb) < ETH_HLEN)
>  		skb_set_network_header(skb, ETH_HLEN);
>  
> -	skb_reset_mac_len(skb);
> +	skb->mac_len -= VLAN_HLEN;
>  pull:
>  	__skb_pull(skb, offset);
>  

See my previous explanation why this patch is wrong with the current
code: http://article.gmane.org/gmane.linux.network/339457

 Jiri
diff mbox

Patch

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 92116df..c45888f 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4178,7 +4178,7 @@  static int __skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci)
 	if (skb_network_offset(skb) < ETH_HLEN)
 		skb_set_network_header(skb, ETH_HLEN);
 
-	skb_reset_mac_len(skb);
+	skb->mac_len -= VLAN_HLEN;
 pull:
 	__skb_pull(skb, offset);