bridge interface initial carrier state
Subsystems (2)
Hi,
I'm wondering if the initial carrier state of 'on' is intentional for a bridge without ports; immediately after adding ports, the carrier is recalculated and depends on the combined state of each port's carrier and STP forwarding state. So a userspace program attempting to decide whether the bridge was usable or not has to look at both (a) how many ports are available and (b) bridge carrier state, instead of just looking at the bridge carrier state.
Dan
Quoted 11 lines · On Mon, 11 Feb 2013 14:01:55 -0600 Dan Williams <[email protected]> wrote:
Hi,
I'm wondering if the initial carrier state of 'on' is intentional for a bridge without ports; immediately after adding ports, the carrier is recalculated and depends on the combined state of each port's carrier and STP forwarding state. So a userspace program attempting to decide whether the bridge was usable or not has to look at both (a) how many ports are available and (b) bridge carrier state, instead of just looking at the bridge carrier state.
Dan
It really should be off when no ports are present, but some initial startup scripts broke when it was that way.
Quoted 11 lines · On Mon, 11 Feb 2013 14:01:55 -0600 Dan Williams <[email protected]> wrote:
Hi,
I'm wondering if the initial carrier state of 'on' is intentional for a bridge without ports; immediately after adding ports, the carrier is recalculated and depends on the combined state of each port's carrier and STP forwarding state. So a userspace program attempting to decide whether the bridge was usable or not has to look at both (a) how many ports are available and (b) bridge carrier state, instead of just looking at the bridge carrier state.
Dan
Perhaps a future enhancement of bridge would be to use operstate flags to indicate lower layer down if there are no ports.
Quoted 13 lines · Stephen Hemminger
Quoted 10 lines · On Mon, 11 Feb 2013 14:01:55 -0600 Dan Williams <[email protected]> wrote:
Hi,
I'm wondering if the initial carrier state of 'on' is intentional for a bridge without ports; immediately after adding ports, the carrier is recalculated and depends on the combined state of each port's carrier and STP forwarding state. So a userspace program attempting to decide whether the bridge was usable or not has to look at both (a) how many ports are available and (b) bridge carrier state, instead of just looking at the bridge carrier state.
Quoted 4 lines
Quoted 1 line
Dan
Perhaps a future enhancement of bridge would be to use operstate flags to indicate lower layer down if there are no ports.
While we're at it, it appears that if a bridge port is added when it has no carrier, nothing directly triggers br_port_state_selection() to ensure that the bridge's carrier state is correct:
if ((dev->flags & IFF_UP) && netif_carrier_ok(dev) && (br->dev->flags & IFF_UP)) br_stp_enable_port(p);
Any reason why we can't run br_port_state_selection() unconditionally when adding a new port? When removing a port that gets run by br_stp_disable_port(), which is somewhat asymmetrical.
When adding, we don't necessarily want to enable STP operation on the port until it's ready, so that hunk above for br_stp_enable_port() is probably just fine, but we should still probably be recalculating the bridge's carrier when it gets its first port even if that port isn't yet usable? Or not?
Dan
Quoted 13 lines · Mon, Feb 11, 2013 at 10:58:36PM CET, [email protected] wrote:
Quoted 10 lines · On Mon, 11 Feb 2013 14:01:55 -0600 Dan Williams <[email protected]> wrote:
Hi,
I'm wondering if the initial carrier state of 'on' is intentional for a bridge without ports; immediately after adding ports, the carrier is recalculated and depends on the combined state of each port's carrier and STP forwarding state. So a userspace program attempting to decide whether the bridge was usable or not has to look at both (a) how many ports are available and (b) bridge carrier state, instead of just looking at the bridge carrier state.
Quoted 4 lines
Quoted 1 line
Dan
It really should be off when no ports are present, but some initial startup scripts broke when it was that way.
How so? Can you give me an example of that script?
I think that any script should be able to handle a situation when carrier of some device is down...
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
David Miller
maintainerFrom: Jiri Pirko <[email protected]>
Date: Tue, 12 Feb 2013 22:06:05 +0100
Quoted 14 lines
Quoted 13 lines · Mon, Feb 11, 2013 at 10:58:36PM CET, [email protected] wrote:
Quoted 10 lines · On Mon, 11 Feb 2013 14:01:55 -0600 Dan Williams <[email protected]> wrote:
Hi,
I'm wondering if the initial carrier state of 'on' is intentional for a bridge without ports; immediately after adding ports, the carrier is recalculated and depends on the combined state of each port's carrier and STP forwarding state. So a userspace program attempting to decide whether the bridge was usable or not has to look at both (a) how many ports are available and (b) bridge carrier state, instead of just looking at the bridge carrier state.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Dan
It really should be off when no ports are present, but some initial startup scripts broke when it was that way.
How so? Can you give me an example of that script?
I think that any script should be able to handle a situation when carrier of some device is down...
These are scripts that are looking for interfaces that are "active". The definition of this for layered and software devices is very ambiguous, therefore the only sane thing to do is to default to having the carrier on by default.