From 3cd9131795c5854ad127764ed07f6be74fbaddb7 Mon Sep 17 00:00:00 2001 From: d00f <8052722+DrDoof@users.noreply.github.com> Date: Mon, 17 Aug 2026 10:26:21 +0200 Subject: [PATCH] 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. --- rtl837x_stp.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/rtl837x_stp.c b/rtl837x_stp.c index 3cc8162..e929392 100644 --- a/rtl837x_stp.c +++ b/rtl837x_stp.c @@ -287,21 +287,13 @@ static void stp_topology_change(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) return; if (!(stp_pflags[port] & STP_PF_ENABLED)) return; if (stp_pflags[port] & STP_PF_TRIPPED) return; - if (!port_timers[port]) { /* not held down yet */ + if (!port_timers[port]) { print_string("STP: loop detected, blocking port "); print_port_nl(port); stp_state_set(port, 0b01);