From 2552f586d8641f9830fac109de89f8b50f31790a Mon Sep 17 00:00:00 2001 From: sk_thes Date: Mon, 18 May 2026 22:47:31 +0000 Subject: [PATCH] fix: rtl837x_stp bug, cmpMac always 0 when checking for new root When checking for a new root, a root_bridge with the same priority as STP_I will never be adopted as cmpMAC always returns 0. This PR fixes this bug by changing the comparison of MACs to what was intended --- rtl837x_stp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtl837x_stp.c b/rtl837x_stp.c index c87918e..2eb4f92 100644 --- a/rtl837x_stp.c +++ b/rtl837x_stp.c @@ -136,7 +136,7 @@ void stp_in(void) __banked // print_string("Flags: "); print_byte(STP_I->flags); write_char('\n'); print_string("Check new Root\n"); if (STP_I->root.prio < root_bridge.prio - || ((STP_I->root.prio == root_bridge.prio) && cmpMAC(STP_I->root.mac, STP_I->root.mac) < 0)) { + || ((STP_I->root.prio == root_bridge.prio) && cmpMAC(STP_I->root.mac, root_bridge.mac) < 0)) { print_string("Updating Root bridge\n"); root_bridge.prio = STP_I->root.prio; memcpy(root_bridge.mac, STP_I->root.mac, 6);