stp: drop the inline comments in stp_loop_hold_peer

The port number comes out of a received BPDU, so the range check is
there to keep a forged frame from naming a port this module does not
manage - including the CPU port, which would cost us the management
path. Nothing outside min_port..max_port would ever release the block
either, because stp_timers() only counts down the ports it walks.
This commit is contained in:
d00f
2026-08-18 23:30:50 +02:00
parent 50b68f908e
commit 3cd9131795
+1 -9
View File
@@ -287,21 +287,13 @@ static void stp_topology_change(uint8_t port) __reentrant
*/ */
static void stp_loop_hold_peer(uint8_t port) __reentrant static void stp_loop_hold_peer(uint8_t port) __reentrant
{ {
/* The port number arrives in a BPDU, so it is somebody else's data,
* and our own bridge MAC is public in every BPDU we send - a forged
* frame can name any port it likes. Bound it to the ports this module
* actually manages, like every other loop here does. Out of that
* range nothing would ever release the block either: stp_timers()
* walks min_port..max_port and skips ports that are not STP-enabled,
* so their port_timers[] never counts down. Naming the CPU port would
* otherwise cost us our own management path. */
if (port < machine.min_port || port > machine.max_port) if (port < machine.min_port || port > machine.max_port)
return; return;
if (!(stp_pflags[port] & STP_PF_ENABLED)) if (!(stp_pflags[port] & STP_PF_ENABLED))
return; return;
if (stp_pflags[port] & STP_PF_TRIPPED) if (stp_pflags[port] & STP_PF_TRIPPED)
return; return;
if (!port_timers[port]) { /* not held down yet */ if (!port_timers[port]) {
print_string("STP: loop detected, blocking port "); print_string("STP: loop detected, blocking port ");
print_port_nl(port); print_port_nl(port);
stp_state_set(port, 0b01); stp_state_set(port, 0b01);