[openwrt/openwrt] hostapd: add new ubus method for performig channel switch

LEDE Commits lede-commits at lists.infradead.org
Mon Sep 29 04:41:22 PDT 2025


nbd pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/0f56141c6c779a1a74c3cab14ff872d5288a01f6

commit 0f56141c6c779a1a74c3cab14ff872d5288a01f6
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Mon Sep 29 13:40:08 2025 +0200

    hostapd: add new ubus method for performig channel switch
    
    This is a replacement for the bss based function, which cannot be used for MLO.
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/network/services/hostapd/files/hostapd.uc | 28 +++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc
index 30be818c69..1ec2bb6945 100644
--- a/package/network/services/hostapd/files/hostapd.uc
+++ b/package/network/services/hostapd/files/hostapd.uc
@@ -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: {}




More information about the lede-commits mailing list