From 6b4d2b9cfa29e3c3f3d816e47bf177ef3e21a82d Mon Sep 17 00:00:00 2001 From: d00f Date: Tue, 4 Aug 2026 12:48:31 +0200 Subject: [PATCH] stp: apply an edge-port change immediately "stp port N edge off" cleared only the admin and auto flags, not the operational one - and that is the flag the engine actually consults: it exempts the port from topology changes and lets it skip the listen period. A port therefore stayed an edge port until the next "stp off" / "stp on", silently ignoring the new setting. Clear it with the others, and mark an admin edge operational right away, as stp_setup() does. --- rtl837x_stp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rtl837x_stp.c b/rtl837x_stp.c index be3f79b..3386688 100644 --- a/rtl837x_stp.c +++ b/rtl837x_stp.c @@ -675,9 +675,13 @@ void stp_parse(void) __banked __reentrant if (stpEnabled) stp_state_set(port, 0b11); /* plain forwarding */ } else if (cmd_compare(3, "edge")) { - stp_pflags[port] &= ~(STP_PF_ADMEDGE | STP_PF_AUTOEDGE); + /* Also drop the *operational* edge flag: it is what exempts the + * port from topology changes and lets it skip the listen period, + * so leaving it set would keep the old behaviour until the next + * "stp off"/"stp on". An admin edge is operational immediately. */ + stp_pflags[port] &= ~(STP_PF_ADMEDGE | STP_PF_AUTOEDGE | STP_PF_OPEREDGE); if (cmd_compare(4, "on")) - stp_pflags[port] |= STP_PF_ADMEDGE; + stp_pflags[port] |= STP_PF_ADMEDGE | STP_PF_OPEREDGE; else if (cmd_compare(4, "auto")) stp_pflags[port] |= STP_PF_AUTOEDGE; else if (!cmd_compare(4, "off"))