From 81a48e7d1a2752ebcc292052381b30250905cf5d Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 21 Sep 2024 20:30:01 +0200 Subject: [PATCH] wpa_supplicant: fix num_global_macaddr handling Pass num_global_macaddr via ubus in the top level config_set call Signed-off-by: Felix Fietkau --- .../wifi-scripts/files/lib/netifd/wireless/mac80211.sh | 3 ++- package/network/services/hostapd/files/wpa_supplicant.uc | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index 0079c498e765..11b11c411f43 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -896,6 +896,7 @@ wpa_supplicant_set_config() { json_set_namespace wpa_supp prev json_close_array json_add_string phy "$phy" + json_add_int num_global_macaddr "$num_global_macaddr" json_add_boolean defer 1 local data="$(json_dump)" @@ -938,7 +939,7 @@ wpa_supplicant_start() { [ -n "$wpa_supp_init" ] || return 0 - ubus_call wpa_supplicant config_set '{ "phy": "'"$phy"'" }' > /dev/null + ubus_call wpa_supplicant config_set '{ "phy": "'"$phy"'", "num_global_macaddr": '"$num_global_macaddr"' }' > /dev/null } mac80211_setup_supplicant() { diff --git a/package/network/services/hostapd/files/wpa_supplicant.uc b/package/network/services/hostapd/files/wpa_supplicant.uc index 1709bb019e31..31d45346257e 100644 --- a/package/network/services/hostapd/files/wpa_supplicant.uc +++ b/package/network/services/hostapd/files/wpa_supplicant.uc @@ -68,7 +68,7 @@ function prepare_config(config) return { config: config }; } -function set_config(phy_name, config_list) +function set_config(phy_name, num_global_macaddr, config_list) { let phy = wpas.data.config[phy_name]; @@ -77,6 +77,8 @@ function set_config(phy_name, config_list) wpas.data.config[phy_name] = phy; } + phy.num_global_macaddr = num_global_macaddr; + let values = []; for (let config in config_list) push(values, [ config.iface, prepare_config(config) ]); @@ -99,7 +101,7 @@ function start_pending(phy_name) } let macaddr_list = wpas.data.macaddr_list[phy_name]; - phydev.macaddr_init(macaddr_list); + phydev.macaddr_init(macaddr_list, { num_global: phy.num_global_macaddr }); for (let ifname in phy.data) iface_start(phydev, phy.data[ifname]); @@ -185,6 +187,7 @@ let main_obj = { config_set: { args: { phy: "", + num_global_macaddr: 0, config: [], defer: true, }, @@ -195,7 +198,7 @@ let main_obj = { wpas.printf(`Set new config for phy ${req.args.phy}`); try { if (req.args.config) - set_config(req.args.phy, req.args.config); + set_config(req.args.phy, req.args.num_global_macaddr, req.args.config); if (!req.args.defer) start_pending(req.args.phy); -- 2.30.2