Skip to content

Commit

Permalink
bridge: Fix handling stacked vlan tags
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Vlad Yasevich <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Toshiaki Makita authored and davem330 committed Mar 28, 2014
1 parent 12464bb commit 99b192d
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions net/bridge/br_vlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit 99b192d

Please sign in to comment.