Skip to content

Commit

Permalink
wpa_supplicant: fix num_global_macaddr handling
Browse files Browse the repository at this point in the history
Pass num_global_macaddr via ubus in the top level config_set call

Signed-off-by: Felix Fietkau <[email protected]>
  • Loading branch information
nbd168 committed Sep 21, 2024
1 parent b4e7682 commit 81a48e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)"

Expand Down Expand Up @@ -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() {
Expand Down
9 changes: 6 additions & 3 deletions package/network/services/hostapd/files/wpa_supplicant.uc
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand All @@ -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) ]);
Expand All @@ -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]);
Expand Down Expand Up @@ -185,6 +187,7 @@ let main_obj = {
config_set: {
args: {
phy: "",
num_global_macaddr: 0,
config: [],
defer: true,
},
Expand All @@ -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);
Expand Down

0 comments on commit 81a48e7

Please sign in to comment.