]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
wifi-scripts: add support for passing wifi-device settings via procd
authorFelix Fietkau <nbd@nbd.name>
Mon, 4 Aug 2025 10:08:27 +0000 (12:08 +0200)
committerFelix Fietkau <nbd@nbd.name>
Mon, 4 Aug 2025 10:08:29 +0000 (12:08 +0200)
Allows either overriding individual device settings, or passing complete devices

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

index a1ec40d79e3bd09746dbb1476afa1f208d901d1a..956ca54413e8902d1b164ab91c4865bb098843ef 100644 (file)
@@ -183,6 +183,41 @@ function config_init(uci)
        }
 
        let udata = ubus.call({
+               object: "service",
+               method: "get_data",
+               data: {
+                       type: "wifi-device"
+               },
+       });
+       for (let svcname, svc in udata) {
+               for (let typename, data in svc) {
+                       for (let radio, config in data) {
+                               if (type(config) != "object")
+                                       continue;
+
+                               let dev = devices[radio];
+                               if (dev) {
+                                       dev.config = { ...dev.config, ...config };
+                                       continue;
+                               }
+
+                               let handler = wireless.handlers[config.type];
+                               if (!handler)
+                                       continue;
+
+                               dev = devices[radio] = {
+                                       name,
+                                       config,
+
+                                       vif: [],
+                               };
+                               handlers[radio] = handler;
+                       }
+               }
+       }
+
+
+       udata = ubus.call({
                object: "service",
                method: "get_data",
                data: {
@@ -193,6 +228,9 @@ function config_init(uci)
        for (let svcname, svc in udata) {
                for (let typename, data in svc) {
                        for (let radio, vifs in data) {
+                               if (type(vifs) != "object")
+                                       continue;
+
                                for (let name, vif in vifs) {
                                        let devs = vif.device;
                                        if (type(devs) != "array")