mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2026-03-14 11:29:49 +01:00
wifi-scripts: fix reload handling with random macaddr
Some checks are pending
Build all core packages / Build all core packages for selected target (push) Waiting to run
Some checks are pending
Build all core packages / Build all core packages for selected target (push) Waiting to run
Allow initially generated MAC address to be preserved across reload
Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry picked from commit 5bdb7a5990)
This commit is contained in:
parent
6bf869db0f
commit
76eb96c875
2 changed files with 8 additions and 1 deletions
|
|
@ -563,6 +563,7 @@ mac80211_hostapd_setup_bss() {
|
|||
$hostapd_cfg
|
||||
bssid=$macaddr
|
||||
${default_macaddr:+#default_macaddr}
|
||||
${random_macaddr:+#random_macaddr}
|
||||
${dtim_period:+dtim_period=$dtim_period}
|
||||
${max_listen_int:+max_listen_interval=$max_listen_int}
|
||||
EOF
|
||||
|
|
@ -691,12 +692,14 @@ mac80211_prepare_vif() {
|
|||
json_add_string _ifname "$ifname"
|
||||
|
||||
default_macaddr=
|
||||
random_macaddr=
|
||||
if [ -z "$macaddr" ]; then
|
||||
macaddr="$(mac80211_generate_mac $phy)"
|
||||
macidx="$(($macidx + 1))"
|
||||
default_macaddr=1
|
||||
elif [ "$macaddr" = 'random' ]; then
|
||||
macaddr="$(macaddr_random)"
|
||||
random_macaddr=1
|
||||
fi
|
||||
json_add_string _macaddr "$macaddr"
|
||||
json_add_string _default_macaddr "$default_macaddr"
|
||||
|
|
|
|||
|
|
@ -485,7 +485,9 @@ function iface_reload_config(name, phydev, config, old_config)
|
|||
|
||||
// try to preserve MAC address of this BSS by reassigning another
|
||||
// BSS if necessary
|
||||
if (cur_config.default_macaddr &&
|
||||
if ((cur_config.default_macaddr || cur_config.random_macaddr) &&
|
||||
cur_config.random_macaddr == prev_config.random_macaddr &&
|
||||
cur_config.default_macaddr == prev_config.default_macaddr &&
|
||||
!macaddr_list[prev_config.bssid]) {
|
||||
macaddr_list[prev_config.bssid] = i;
|
||||
cur_config.bssid = prev_config.bssid;
|
||||
|
|
@ -761,6 +763,8 @@ function iface_load_config(phy, radio, filename)
|
|||
while ((line = rtrim(f.read("line"), "\n")) != null) {
|
||||
if (line == "#default_macaddr")
|
||||
bss.default_macaddr = true;
|
||||
if (line == "#random_macaddr")
|
||||
bss.random_macaddr = true;
|
||||
|
||||
let val = split(line, "=", 2);
|
||||
if (!val[0])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue