All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlad Yasevich <vyasevic@redhat.com>
To: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>,
	"David S . Miller" <davem@davemloft.net>,
	Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org, bridge@lists.linux-foundation.org
Subject: Re: [Bridge] [PATCH net 2/2] bridge: Fix handling stacked vlan tags
Date: Thu, 27 Mar 2014 17:35:24 -0400	[thread overview]
Message-ID: <5334999C.1040608@redhat.com> (raw)
In-Reply-To: <1395924416-12325-2-git-send-email-makita.toshiaki@lab.ntt.co.jp>

On 03/27/2014 08:46 AM, Toshiaki Makita wrote:
> If a bridge with vlan_filtering enabled receives frames with stacked
> vlan tags, i.e., they have two vlan tags, br_vlan_untag() strips not
> only the outer tag but also the inner tag.
> 
> br_vlan_untag() is called only from br_handle_vlan(), and in this case,
> it is enough to set skb->vlan_tci to 0 here, because vlan_tci has already
> been set before calling br_handle_vlan().
> 
> Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>

Acked-by: Vlad Yasevich <vyasevic@redhat.com>

-vlad

> ---
>  net/bridge/br_vlan.c | 18 +-----------------
>  1 file changed, 1 insertion(+), 17 deletions(-)
> 
> diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
> index 44f31af..c77eed5 100644
> --- a/net/bridge/br_vlan.c
> +++ b/net/bridge/br_vlan.c
> @@ -119,22 +119,6 @@ static void __vlan_flush(struct net_port_vlans *v)
>  	kfree_rcu(v, rcu);
>  }
>  
> -/* Strip the tag from the packet.  Will return skb with tci set 0.  */
> -static struct sk_buff *br_vlan_untag(struct sk_buff *skb)
> -{
> -	if (skb->protocol != htons(ETH_P_8021Q)) {
> -		skb->vlan_tci = 0;
> -		return skb;
> -	}
> -
> -	skb->vlan_tci = 0;
> -	skb = vlan_untag(skb);
> -	if (skb)
> -		skb->vlan_tci = 0;
> -
> -	return skb;
> -}
> -
>  struct sk_buff *br_handle_vlan(struct net_bridge *br,
>  			       const struct net_port_vlans *pv,
>  			       struct sk_buff *skb)
> @@ -150,7 +134,7 @@ struct sk_buff *br_handle_vlan(struct net_bridge *br,
>  	 */
>  	br_vlan_get_tag(skb, &vid);
>  	if (test_bit(vid, pv->untagged_bitmap))
> -		skb = br_vlan_untag(skb);
> +		skb->vlan_tci = 0;
>  
>  out:
>  	return skb;
> 


WARNING: multiple messages have this Message-ID (diff)
From: Vlad Yasevich <vyasevic@redhat.com>
To: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>,
	"David S . Miller" <davem@davemloft.net>,
	Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org, bridge@lists.linux-foundation.org
Subject: Re: [PATCH net 2/2] bridge: Fix handling stacked vlan tags
Date: Thu, 27 Mar 2014 17:35:24 -0400	[thread overview]
Message-ID: <5334999C.1040608@redhat.com> (raw)
In-Reply-To: <1395924416-12325-2-git-send-email-makita.toshiaki@lab.ntt.co.jp>

On 03/27/2014 08:46 AM, Toshiaki Makita wrote:
> If a bridge with vlan_filtering enabled receives frames with stacked
> vlan tags, i.e., they have two vlan tags, br_vlan_untag() strips not
> only the outer tag but also the inner tag.
> 
> br_vlan_untag() is called only from br_handle_vlan(), and in this case,
> it is enough to set skb->vlan_tci to 0 here, because vlan_tci has already
> been set before calling br_handle_vlan().
> 
> Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>

Acked-by: Vlad Yasevich <vyasevic@redhat.com>

-vlad

> ---
>  net/bridge/br_vlan.c | 18 +-----------------
>  1 file changed, 1 insertion(+), 17 deletions(-)
> 
> diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
> index 44f31af..c77eed5 100644
> --- a/net/bridge/br_vlan.c
> +++ b/net/bridge/br_vlan.c
> @@ -119,22 +119,6 @@ static void __vlan_flush(struct net_port_vlans *v)
>  	kfree_rcu(v, rcu);
>  }
>  
> -/* Strip the tag from the packet.  Will return skb with tci set 0.  */
> -static struct sk_buff *br_vlan_untag(struct sk_buff *skb)
> -{
> -	if (skb->protocol != htons(ETH_P_8021Q)) {
> -		skb->vlan_tci = 0;
> -		return skb;
> -	}
> -
> -	skb->vlan_tci = 0;
> -	skb = vlan_untag(skb);
> -	if (skb)
> -		skb->vlan_tci = 0;
> -
> -	return skb;
> -}
> -
>  struct sk_buff *br_handle_vlan(struct net_bridge *br,
>  			       const struct net_port_vlans *pv,
>  			       struct sk_buff *skb)
> @@ -150,7 +134,7 @@ struct sk_buff *br_handle_vlan(struct net_bridge *br,
>  	 */
>  	br_vlan_get_tag(skb, &vid);
>  	if (test_bit(vid, pv->untagged_bitmap))
> -		skb = br_vlan_untag(skb);
> +		skb->vlan_tci = 0;
>  
>  out:
>  	return skb;
> 

  reply	other threads:[~2014-03-27 21:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27 12:46 [Bridge] [PATCH net 1/2] bridge: Fix inabillity to retrieve vlan tags when tx offload is disabled Toshiaki Makita
2014-03-27 12:46 ` Toshiaki Makita
2014-03-27 12:46 ` [Bridge] [PATCH net 2/2] bridge: Fix handling stacked vlan tags Toshiaki Makita
2014-03-27 12:46   ` Toshiaki Makita
2014-03-27 21:35   ` Vlad Yasevich [this message]
2014-03-27 21:35     ` Vlad Yasevich
2014-03-28 20:33   ` [Bridge] " David Miller
2014-03-28 20:33     ` David Miller
2014-03-27 21:33 ` [Bridge] [PATCH net 1/2] bridge: Fix inabillity to retrieve vlan tags when tx offload is disabled Vlad Yasevich
2014-03-27 21:33   ` Vlad Yasevich
2014-03-28 20:33 ` [Bridge] " David Miller
2014-03-28 20:33   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5334999C.1040608@redhat.com \
    --to=vyasevic@redhat.com \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=makita.toshiaki@lab.ntt.co.jp \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.