aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorToshiaki Makita <makita.toshiaki@lab.ntt.co.jp>2014-03-27 08:46:55 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-28 16:33:09 -0400
commit12464bb8de021a01fa7ec9299c273c247df7f198 (patch)
treec4fb3f4b93f4571483327501011be6668ceb3a76 /net
parenta39ee449f96a2cd44ce056d8a0a112211a9b1a1f (diff)
bridge: Fix inabillity to retrieve vlan tags when tx offload is disabled
Bridge vlan code (br_vlan_get_tag()) assumes that all frames have vlan_tci if they are tagged, but if vlan tx offload is manually disabled on bridge device and frames are sent from vlan device on the bridge device, the tags are embedded in skb->data and they break this assumption. Extract embedded vlan tags and move them to vlan_tci at ingress. 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')
-rw-r--r--net/bridge/br_device.c6
-rw-r--r--net/bridge/br_vlan.c12
2 files changed, 15 insertions, 3 deletions
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 63f0455c0bc3..8fe8b71b487a 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -49,14 +49,14 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
49 brstats->tx_bytes += skb->len; 49 brstats->tx_bytes += skb->len;
50 u64_stats_update_end(&brstats->syncp); 50 u64_stats_update_end(&brstats->syncp);
51 51
52 if (!br_allowed_ingress(br, br_get_vlan_info(br), skb, &vid))
53 goto out;
54
55 BR_INPUT_SKB_CB(skb)->brdev = dev; 52 BR_INPUT_SKB_CB(skb)->brdev = dev;
56 53
57 skb_reset_mac_header(skb); 54 skb_reset_mac_header(skb);
58 skb_pull(skb, ETH_HLEN); 55 skb_pull(skb, ETH_HLEN);
59 56
57 if (!br_allowed_ingress(br, br_get_vlan_info(br), skb, &vid))
58 goto out;
59
60 if (is_broadcast_ether_addr(dest)) 60 if (is_broadcast_ether_addr(dest))
61 br_flood_deliver(br, skb, false); 61 br_flood_deliver(br, skb, false);
62 else if (is_multicast_ether_addr(dest)) { 62 else if (is_multicast_ether_addr(dest)) {
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 8249ca764c79..44f31af0b965 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -174,6 +174,18 @@ bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v,
174 if (!v) 174 if (!v)
175 return false; 175 return false;
176 176
177 /* If vlan tx offload is disabled on bridge device and frame was
178 * sent from vlan device on the bridge device, it does not have
179 * HW accelerated vlan tag.
180 */
181 if (unlikely(!vlan_tx_tag_present(skb) &&
182 (skb->protocol == htons(ETH_P_8021Q) ||
183 skb->protocol == htons(ETH_P_8021AD)))) {
184 skb = vlan_untag(skb);
185 if (unlikely(!skb))
186 return false;
187 }
188
177 err = br_vlan_get_tag(skb, vid); 189 err = br_vlan_get_tag(skb, vid);
178 if (!*vid) { 190 if (!*vid) {
179 u16 pvid = br_get_pvid(v); 191 u16 pvid = br_get_pvid(v);