hostapd: add new ubus method for performig channel switch
authorFelix Fietkau <[email protected]>
Mon, 29 Sep 2025 11:40:08 +0000 (13:40 +0200)
committerFelix Fietkau <[email protected]>
Mon, 29 Sep 2025 11:41:06 +0000 (13:41 +0200)
This is a replacement for the bss based function, which cannot be used for MLO.

Signed-off-by: Felix Fietkau <[email protected]>
package/network/services/hostapd/files/hostapd.uc

index 30be818c693b1a1a5704477f02309e831b01b59e..1ec2bb6945cd6d50db74bae732b6491ec9498007 100644 (file)
@@ -1210,6 +1210,34 @@ let main_obj = {
                        return ret;
                }
        },
+       switch_channel: {
+               args: {
+                       phy: "",
+                       radio: 0,
+                       csa_count: 0,
+                       sec_channel: 0,
+                       oper_chwidth: 0,
+                       frequency: 0,
+                       center_freq1: 0,
+                       center_freq2: 0,
+               },
+               call: function(req) {
+                       let phy = phy_name(req.args.phy, req.args.radio);
+                       if (!req.args.frequency || !phy)
+                               return libubus.STATUS_INVALID_ARGUMENT;
+
+                       let iface = hostapd.interfaces[phy];
+                       if (!iface)
+                               return libubus.STATUS_NOT_FOUND;
+
+                       req.args.csa_count ??= 10;
+                       let ret = iface.switch_channel(req.args);
+                       if (!ret)
+                               return libubus.STATUS_UNKNOWN_ERROR;
+
+                       return 0;
+               },
+       },
        mld_set: {
                args: {
                        config: {}