[openwrt/openwrt] wifi-scripts: fix broken match all case for wifi-vlan

LEDE Commits lede-commits at lists.infradead.org
Mon Dec 15 03:31:17 PST 2025


robimarko pushed a commit to openwrt/openwrt.git, branch openwrt-25.12:
https://git.openwrt.org/b13c6a732a7d289a05d53aa1d7f6ef2aebfeb8e5

commit b13c6a732a7d289a05d53aa1d7f6ef2aebfeb8e5
Author: Rany Hany <rany_hany at riseup.net>
AuthorDate: Sat Nov 29 12:37:22 2025 +0200

    wifi-scripts: fix broken match all case for wifi-vlan
    
    When iface is omitted, wifi-vlan will apply to all interfaces.
    However, netifd.set_vlan call is not successful as it assumes
    that every wifi-vlan section corresponds to one VIF.
    
    For this reason in the wifi-vlan case (cur_type == "vlan")
    we create a composite key in the form `${vif.name}/${vlan.name}`
    allowing the same vlan section to correspond to multiple VAPs.
    `/` was decided as a delimiter as it is an invalid character
    for a network interface name and UCI identifier; so it is
    impossible for it to cause conflicts.
    
    It was verified that the `ubus call network.wireless status`
    works as expected with this change. Moreover, wifi-station
    is not susceptible to this problem.
    
    This also means that it is now possible for wifi-vlan
    to support `list` iface similar to old shell-based wifi-scripts.
    This will be done in a follow-up commit.
    
    Fixes: 98435a37a7 ("wifi-scripts: iface should be optional in wifi-vlan definition")
    Signed-off-by: Rany Hany <rany_hany at riseup.net>
    Link: https://github.com/openwrt/openwrt/pull/20977
    Signed-off-by: Robert Marko <robimarko at gmail.com>
    (cherry picked from commit 211b11a56e6e6a45d2e3a2a733e78f3e9dd14a16)
---
 .../wifi-scripts/files/lib/netifd/wireless-device.uc     | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless-device.uc b/package/network/config/wifi-scripts/files/lib/netifd/wireless-device.uc
index cccb6c9c8c..428db6ee6a 100644
--- a/package/network/config/wifi-scripts/files/lib/netifd/wireless-device.uc
+++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless-device.uc
@@ -488,7 +488,11 @@ function wdev_set_data(wdev, vif, vlan, data)
 		cur_type = "vlan";
 	}
 
-	wdev.handler_data[cur.name] = {
+	let key = cur.name;
+	if (cur_type == "vlan")
+		key = vif.name + "/" + vlan.name;
+
+	wdev.handler_data[key] = {
 		...cur,
 		...data,
 		type: cur_type,
@@ -545,9 +549,13 @@ function hotplug(name, add)
 	}
 }
 
-function get_status_data(wdev, vif)
+function get_status_data(wdev, vif, parent_vif)
 {
-	let hdata = wdev.handler_data[vif.name];
+	let key = vif.name;
+	if (parent_vif)
+		key = parent_vif.name + "/" + vif.name;
+
+	let hdata = wdev.handler_data[key];
 	let data = {
 		section: vif.name,
 		config: vif.config
@@ -561,7 +569,7 @@ function get_status_vlans(wdev, vif)
 {
 	let vlans = [];
 	for (let vlan in vif.vlan)
-		push(vlans, get_status_data(wdev, vlan));
+		push(vlans, get_status_data(wdev, vlan, vif));
 	return vlans;
 }
 




More information about the lede-commits mailing list