]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
wifi-scripts: don't swap handler config under a running setup script
authorFelix Fietkau <nbd@nbd.name>
Fri, 10 Jul 2026 13:06:14 +0000 (15:06 +0200)
committerFelix Fietkau <nbd@nbd.name>
Thu, 16 Jul 2026 09:50:22 +0000 (11:50 +0200)
A reload during an in-flight setup ran wdev_config_init() immediately,
replacing handler_config/handler_data while the script was still running, so
its set_data notifications resolved against the new (renumbered) interface
table and link up/down calls became asymmetric. Defer the re-init in
check() while a handler run is in progress and re-apply from the setup and
teardown callbacks once it completes.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/network/config/wifi-scripts/files/lib/netifd/wireless-device.uc

index a3359bc0afd026c0686a887a995272699b640245..b85d4ee237422b5ce3b00e784b884d829f5174c6 100644 (file)
@@ -173,6 +173,9 @@ function wdev_teardown_cb(wdev)
                return;
        }
 
+       if (wdev.config_change)
+               wdev_config_init(wdev);
+
        wdev.setup();
 }
 
@@ -443,6 +446,14 @@ function check()
        if (!wdev_update_disabled_vifs(this))
                return;
 
+       /*
+        * Defer applying a new config while a handler run is in progress: the
+        * running script keeps its start-time config, and the setup/teardown
+        * callback re-applies once it finishes (config_change stays set).
+        */
+       if (this.state != "up" && this.state != "down")
+               return;
+
        wdev_config_init(this);
        this.setup();
 }