netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next PATCH] net: bridge: fix for bridging 802.1Q without REORDER_HDR
@ 2015-09-11 19:22 Phil Sutter
  2015-09-11 19:24 ` Stephen Hemminger
  0 siblings, 1 reply; 9+ messages in thread
From: Phil Sutter @ 2015-09-11 19:22 UTC (permalink / raw)
  To: stephen; +Cc: bridge, netdev

When forwarding packets from an 802.1Q interface with REORDER_HDR set to
zero, the VLAN header previously inserted by vlan_do_receive() needs to
be stripped from the packet and the mac_header adjustment undone,
otherwise a tagged frame with first four bytes missing will be
transmitted.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 net/bridge/br_input.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index f921a5d..e4e3fc7 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -288,6 +288,16 @@ rx_handler_result_t br_handle_frame(struct sk_buff **pskb)
 	}
 
 forward:
+	if (is_vlan_dev(skb->dev) &&
+	    !(vlan_dev_priv(skb->dev)->flags & VLAN_FLAG_REORDER_HDR)) {
+		unsigned int offset = skb->data - skb_mac_header(skb);
+
+		skb_push(skb, offset);
+		memmove(skb->data + VLAN_HLEN, skb->data, 2 * ETH_ALEN);
+		skb->mac_header += VLAN_HLEN;
+		skb_pull(skb, offset);
+		skb_reset_mac_len(skb);
+	}
 	switch (p->state) {
 	case BR_STATE_FORWARDING:
 		rhook = rcu_dereference(br_should_route_hook);
-- 
2.1.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-09-16 10:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-11 19:22 [net-next PATCH] net: bridge: fix for bridging 802.1Q without REORDER_HDR Phil Sutter
2015-09-11 19:24 ` Stephen Hemminger
2015-09-11 20:20   ` Phil Sutter
2015-09-14 18:21     ` Vlad Yasevich
2015-09-14 20:06       ` Phil Sutter
2015-09-15 15:11         ` Vlad Yasevich
2015-09-15 18:17           ` Phil Sutter
2015-09-16  2:36             ` Vlad Yasevich
2015-09-16 10:41               ` Phil Sutter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).