]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
wifi-scripts: retry setup of wireless devices that show up late
authorFelix Fietkau <nbd@nbd.name>
Thu, 2 Oct 2025 11:29:57 +0000 (13:29 +0200)
committerFelix Fietkau <nbd@nbd.name>
Thu, 2 Oct 2025 11:30:31 +0000 (13:30 +0200)
When a phy appears after setup has already been attempted, tell netifd
to retry setup for all failed wireless devices.

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

index b86555266138a814ee56ad9ddb4c2dd12d5018dc..64eeb7235bf477e5acee84350886eb07ae0f3799 100644 (file)
@@ -2,4 +2,5 @@
 
 [ "${ACTION}" = "add" ] && {
        /sbin/wifi config
+       ubus call network.wireless retry
 }
index e982338737a10d577a469ddf74c92007c0abe5ae..cccb6c9c8c3b2667377635ed887ba68d9b7d6495 100644 (file)
@@ -405,6 +405,19 @@ function start()
        this.setup();
 }
 
+
+function retry_setup()
+{
+       if (this.delete)
+               return;
+
+       if (this.state != "down" || !this.autostart)
+               return;
+
+       this.start();
+}
+
+
 function stop()
 {
        this.dbg("stop, state=" + this.state);
@@ -604,6 +617,7 @@ function dbg(msg)
 const wdev_proto = {
        update,
        destroy,
+       retry_setup,
        start,
        stop,
        setup,
index 500033be975a1525187a987dbdb3ff1d35af3325..7c5913ac6021f93b87366a4ebe1b484c6e221478 100644 (file)
@@ -446,6 +446,17 @@ const ubus_obj = {
                        });
                }
        },
+       retry: {
+               args: wdev_args,
+               call: function(req) {
+                       hostapd_update_mlo();
+
+                       return wdev_call(req, (dev) => {
+                               dev.retry_setup();
+                               return 0;
+                       });
+               }
+       },
        reconf: {
                args: wdev_args,
                call: function(req) {