stp: pass a topology change on only from a forwarding port

stp_in() propagated the TC flag of any BPDU that did not arrive on an
alternate port, and acknowledged and propagated a TCN from any port, so a
port still in its listen period or held discarding in a dispute could flush
the addresses of every other port and move the topology change counter.
802.1D-2004 17.31 keeps the Topology Change machine in LEARNING until the
port forwards and drops rcvdTc and rcvdTcn there. Both paths now ask for
the forwarding state first; an alternate port is discarding, so the old
check is covered by the new one.

Scenario 53 plays a TC flag and a TCN into a port that is still discarding,
and then into the same port once it forwards. Scenario 51 used a TCN on a
port one tick short of its edge transition as the trigger for the clock it
tests; it now waits for the transition.
This commit is contained in:
d00f committed 2026-10-27 22:11:24 +01:00
1 parent b92a773cad
commit b86fd37eaa
3 files changed
+60 -5

No files matched your search

+3 -1
View File
@@ -1018,6 +1018,8 @@ void stp_in(void) __banked
return;
if (STP_I->bpdu_type == BPDU_TYPE_TCN) {
if (stp_state_get(port) != 0b11)
return;
stp_tx_flags_extra = BPDU_FLAG_TCACK;
stp_cnf_send(port);
uip_len = 0;
@@ -1063,7 +1065,7 @@ void stp_in(void) __banked
if ((STP_I->flags & BPDU_FLAG_TCACK) && port == stp_root_port)
stp_tcwhile[port] = 0;
if ((STP_I->flags & BPDU_FLAG_TC) && !((stp_alt >> port) & 1) && stp_tc_prop(port))
if ((STP_I->flags & BPDU_FLAG_TC) && stp_state_get(port) == 0b11 && stp_tc_prop(port))
stp_tc_count++;
if ((stp_pflags[port] & STP_PF_ROOTGUARD)