wpa_supplicant: fix num_global_macaddr handling
authorFelix Fietkau <nbd@nbd.name>
Sat, 21 Sep 2024 18:30:01 +0000 (20:30 +0200)
committerFelix Fietkau <nbd@nbd.name>
Sat, 21 Sep 2024 18:33:45 +0000 (20:33 +0200)
Pass num_global_macaddr via ubus in the top level config_set call

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

index 0079c498e765b4388e6c98c717dba69ab3d5923d..11b11c411f43585047d70bc632954dd06d2d528d 100755 (executable)
@@ -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() {
index 1709bb019e310785ac4083feef7fbc23cb71235d..31d45346257e687b4e2eb09175f4aeb5fa6d5dad 100644 (file)
@@ -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);