[openwrt/openwrt] wifi-scripts: fix spurious teardown on config_change during setup

LEDE Commits lede-commits at lists.infradead.org
Sun Feb 8 23:23:14 PST 2026


nbd pushed a commit to openwrt/openwrt.git, branch openwrt-25.12:
https://git.openwrt.org/910eb0cc4e3f8c2ebc7eaafa9d436b3f2b235091

commit 910eb0cc4e3f8c2ebc7eaafa9d436b3f2b235091
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Sun Feb 8 18:46:07 2026 +0000

    wifi-scripts: fix spurious teardown on config_change during setup
    
    When config_change is set during an active setup (e.g. by a concurrent
    reconf call), wdev_mark_up() attempted to call setup() while still in
    "setup" state. Since setup() requires state "up" or "down", it silently
    returned, leaving the state as "setup". The subsequent wdev_setup_cb()
    then treated this as a setup failure, triggering an unnecessary
    teardown+restart cycle.
    
    Fix this by removing the config_change handling from wdev_mark_up() and
    moving it to wdev_setup_cb() instead. wdev_mark_up() now always
    transitions to "up" state. When wdev_setup_cb() runs afterwards and
    finds the device already "up" with config_change set, it initiates a
    clean re-setup from the "up" state where setup() can run.
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
    (cherry picked from commit 3553eda28379f1074b8c2cc4d3ab9930552f0cad)
---
 .../config/wifi-scripts/files/lib/netifd/wireless-device.uc  | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless-device.uc b/package/network/config/wifi-scripts/files/lib/netifd/wireless-device.uc
index 428db6ee6a..6e3a5d938f 100644
--- a/package/network/config/wifi-scripts/files/lib/netifd/wireless-device.uc
+++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless-device.uc
@@ -142,8 +142,13 @@ function wdev_config_init(wdev)
 
 function wdev_setup_cb(wdev)
 {
-	if (wdev.state != "setup")
+	if (wdev.state != "setup") {
+		if (wdev.state == "up" && wdev.config_change) {
+			wdev_config_init(wdev);
+			wdev.setup();
+		}
 		return;
+	}
 
 	if (wdev.retry > 0)
 		wdev.retry--;
@@ -448,11 +453,6 @@ function wdev_mark_up(wdev)
 	if (wdev.state != "setup")
 		return;
 
-	if (wdev.config_change) {
-		wdev.setup();
-		return;
-	}
-
 	for (let section, data in wdev.handler_data) {
 		if (data.ifname)
 			handle_link(data.ifname, data, true);




More information about the lede-commits mailing list