bridge: stp: ensure mac header is set [Linux 2.6.37]

This Linux kernel change "bridge: stp: ensure mac header is set" is included in the Linux 2.6.37 release. This change is authored by Florian Westphal <fw [at] strlen.de> on Mon Jan 3 04:16:28 2011 +0000. The commit for this change in Linux stable tree is e6f2612 (patch) which is from upstream commit bf9ae53. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream bf9ae53.

bridge: stp: ensure mac header is set

commit bf9ae5386bca8836c16e69ab8fdbe46767d7452a
(llc: use dev_hard_header) removed the
skb_reset_mac_header call from llc_mac_hdr_init.

This seems fine itself, but br_send_bpdu() invokes ebtables LOCAL_OUT.

We oops in ebt_basic_match() because it assumes eth_hdr(skb) returns
a meaningful result.

Cc: [email protected]
References: https://bugzilla.kernel.org/show_bug.cgi?id=24532
Signed-off-by: Florian Westphal <[email protected]>
Signed-off-by: David S. Miller <[email protected]>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 net/bridge/br_stp_bpdu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c
index 35cf270..e3d7aef 100644
--- a/net/bridge/br_stp_bpdu.c
+++ b/net/bridge/br_stp_bpdu.c
@@ -50,6 +50,8 @@ static void br_send_bpdu(struct net_bridge_port *p,

    llc_mac_hdr_init(skb, p->dev->dev_addr, p->br->group_addr);

+   skb_reset_mac_header(skb);
+
    NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev,
        dev_queue_xmit);
 }

Leave a Reply

Your email address will not be published. Required fields are marked *