diff options
author | Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp> | 2014-03-27 08:46:56 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-03-28 16:33:09 -0400 |
commit | 99b192da9c99284ad3374132e56f66995cadc6b4 (patch) | |
tree | 5d76b7b88909e15e5126fb250b3ad03d6ecb0d15 /net/bridge/br_vlan.c | |
parent | 12464bb8de021a01fa7ec9299c273c247df7f198 (diff) |
bridge: Fix handling stacked vlan tags
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_vlan.c')
-rw-r--r-- | net/bridge/br_vlan.c | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index 44f31af0b965..c77eed56b045 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) | |||
119 | kfree_rcu(v, rcu); | 119 | kfree_rcu(v, rcu); |
120 | } | 120 | } |
121 | 121 | ||
122 | /* Strip the tag from the packet. Will return skb with tci set 0. */ | ||
123 | static struct sk_buff *br_vlan_untag(struct sk_buff *skb) | ||
124 | { | ||
125 | if (skb->protocol != htons(ETH_P_8021Q)) { | ||
126 | skb->vlan_tci = 0; | ||
127 | return skb; | ||
128 | } | ||
129 | |||
130 | skb->vlan_tci = 0; | ||
131 | skb = vlan_untag(skb); | ||
132 | if (skb) | ||
133 | skb->vlan_tci = 0; | ||
134 | |||
135 | return skb; | ||
136 | } | ||
137 | |||
138 | struct sk_buff *br_handle_vlan(struct net_bridge *br, | 122 | struct sk_buff *br_handle_vlan(struct net_bridge *br, |
139 | const struct net_port_vlans *pv, | 123 | const struct net_port_vlans *pv, |
140 | struct sk_buff *skb) | 124 | struct sk_buff *skb) |
@@ -150,7 +134,7 @@ struct sk_buff *br_handle_vlan(struct net_bridge *br, | |||
150 | */ | 134 | */ |
151 | br_vlan_get_tag(skb, &vid); | 135 | br_vlan_get_tag(skb, &vid); |
152 | if (test_bit(vid, pv->untagged_bitmap)) | 136 | if (test_bit(vid, pv->untagged_bitmap)) |
153 | skb = br_vlan_untag(skb); | 137 | skb->vlan_tci = 0; |
154 | 138 | ||
155 | out: | 139 | out: |
156 | return skb; | 140 | return skb; |