2006-01-13 03:23:42

by Chris Wright

[permalink] [raw]
Subject: [PATCH 01/17] BRIDGE: Fix faulty check in br_stp_recalculate_bridge_id()

-stable review patch. If anyone has any objections, please let us know.
------------------

There is a regression in 2.6.15.
One of the conversions from memcmp to compare_ether_addr is incorrect.
We need to do relative comparison to determine min MAC address to
use in bridge id. This will cause the wrong bridge id to be chosen
which violates 802.1d Spanning Tree Protocol, and may create forwarding
loops.

Signed-off-by: Stephen Hemminger <[email protected]>
Signed-off-by: Chris Wright <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---

net/bridge/br_stp_if.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.15.y/net/bridge/br_stp_if.c
===================================================================
--- linux-2.6.15.y.orig/net/bridge/br_stp_if.c
+++ linux-2.6.15.y/net/bridge/br_stp_if.c
@@ -158,7 +158,7 @@ void br_stp_recalculate_bridge_id(struct

list_for_each_entry(p, &br->port_list, list) {
if (addr == br_mac_zero ||
- compare_ether_addr(p->dev->dev_addr, addr) < 0)
+ memcmp(p->dev->dev_addr, addr, ETH_ALEN) < 0)
addr = p->dev->dev_addr;

}

--


2006-01-13 18:46:55

by Ingo Oeser

[permalink] [raw]
Subject: Re: [PATCH 01/17] BRIDGE: Fix faulty check in br_stp_recalculate_bridge_id()

Hi there,

On Friday 13 January 2006 03:37, Chris Wright wrote:
> One of the conversions from memcmp to compare_ether_addr is incorrect.
> We need to do relative comparison to determine min MAC address to
> use in bridge id. This will cause the wrong bridge id to be chosen
> which violates 802.1d Spanning Tree Protocol, and may create forwarding
> loops.

Why not include a shorter version of this nice explanation
above the list_for_each_entry() loop?

Like:

/* We try to find the min MAC address to use in this bridge id. */

This will prevent the next janitor from converting this again
which avoids future regressions here.

What do you think?


Regards

Ingo Oeser


Attachments:
(No filename) (674.00 B)
(No filename) (189.00 B)
Download all attachments

2006-01-13 19:36:27

by Chris Wright

[permalink] [raw]
Subject: Re: [PATCH 01/17] BRIDGE: Fix faulty check in br_stp_recalculate_bridge_id()

* Ingo Oeser ([email protected]) wrote:
> Why not include a shorter version of this nice explanation
> above the list_for_each_entry() loop?
>
> Like:
>
> /* We try to find the min MAC address to use in this bridge id. */

Send a patch to Stephen ;-) I'll leave it as is for -stable, since it's
not a candidate for janitorial cleanups.

thanks,
-chris

2006-01-14 13:33:36

by Ingo Oeser

[permalink] [raw]
Subject: Re: [PATCH 01/17] BRIDGE: Fix faulty check in br_stp_recalculate_bridge_id()

On Friday 13 January 2006 20:39, Chris Wright wrote:
> * Ingo Oeser ([email protected]) wrote:
> > Why not include a shorter version of this nice explanation
> > above the list_for_each_entry() loop?
> >
> > Like:
> >
> > /* We try to find the min MAC address to use in this bridge id. */
>
> Send a patch to Stephen ;-) I'll leave it as is for -stable, since it's
> not a candidate for janitorial cleanups.

Fine with me. Your argument is perfectly reasonable for me.


Regards

Ingo Oeser


Attachments:
(No filename) (498.00 B)
(No filename) (189.00 B)
Download all attachments