lede/package/kernel
Bob Cantor 9cdb2a6cd3 mac80211: fix no_reload logic (FS#3902)
If drv_mac80211_setup is called twice with the same wifi configuration,
then the second call returns early with error HOSTAPD_START_FAILED.
(wifi works nevertheless, despite the fact that setup is incomplete.  But
"ubus call network.wireless status" erroneously reports that radio0 is down.)

The relevant part of drv_mac80211_setup is,

if [ "$no_reload" != "0" ]; then
        add_ap=1
        ubus wait_for hostapd
        local hostapd_res="$(ubus call hostapd config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}")"
        ret="$?"
        [ "$ret" != 0 -o -z "$hostapd_res" ] && {
                wireless_setup_failed HOSTAPD_START_FAILED
                return
        }
        wireless_add_process "$(jsonfilter -s "$hostapd_res" -l 1 -e @.pid)" "/usr/sbin/hostapd" 1 1
fi

This commit sets no_reload = 0 during the second call of drv_mac80211_setup.

It is perhaps worth providing a way to reproduce the situation
where drv_mac80211_setup is called twice.

When /sbin/wifi is used to turn on wifi,
   uci set wireless.@wifi-iface[0].disabled=0
   uci set wireless.@wifi-device[0].disabled=0
   uci commit
   wifi

/sbin/wifi makes the following ubus calls,
   ubus call network reload
   ubus call network.wireless down
   ubus call network.wireless up

The first and third ubus calls both call drv_mac80211_setup,
while the second ubus call triggers wireless_device_setup_cancel.
So the call sequence becomes,

   drv_mac80211_setup
   wireless_device_setup_cancel
   drv_mac80211_setup

In contrast, when LuCI is used to turn on wifi only a single call
is made to drv_mac80211_setup.

branches affected: trunk, 21.02

Signed-off-by: Bob Cantor <coxede6557@w3boats.com>
2021-06-29 11:16:16 +08:00
..
acx-mac80211 x64: fix grub2 booting 2021-06-15 17:58:07 +08:00
ath10k-ct x64: fix grub2 booting 2021-06-15 17:58:07 +08:00
bcm27xx-gpu-fw bcm27xx: sync upstream source code (#6435) 2021-02-25 15:44:46 +08:00
bcm63xx-cfe add kernel 5.10 support and sync with upstream 2021-06-14 18:30:08 +08:00
broadcom-wl x64: fix grub2 booting 2021-06-15 17:58:07 +08:00
button-hotplug x64: fix grub2 booting 2021-06-15 17:58:07 +08:00
cryptodev-linux x64: fix grub2 booting 2021-06-15 17:58:07 +08:00
dtc/patches Merge branch 'master' of https://github.com/lede-project/source 2018-01-09 14:38:15 +08:00
gpio-button-hotplug x64: fix grub2 booting 2021-06-15 17:58:07 +08:00
gpio-nct5104d Sync to snapshot kernel 5.4 version 2020-07-02 23:30:56 +08:00
gpio-nxp-74hc153 x64: fix grub2 booting 2021-06-15 17:58:07 +08:00
hwmon-gsc x64: fix grub2 booting 2021-06-15 17:58:07 +08:00
lantiq x64: fix grub2 booting 2021-06-15 17:58:07 +08:00
linux ipq807x: add Redmi AX6, Xiaomi AX9000 support 2021-06-24 12:16:06 +08:00
mac80211 mac80211: fix no_reload logic (FS#3902) 2021-06-29 11:16:16 +08:00
mt76 x64: fix grub2 booting 2021-06-15 17:58:07 +08:00
mt7621-qtn-rgmii x64: fix grub2 booting 2021-06-15 17:58:07 +08:00
mwlwifi x64: fix grub2 booting 2021-06-15 17:58:07 +08:00
nat46 add kernel 5.10 support and sync with upstream 2021-06-14 18:30:08 +08:00
om-watchdog x64: fix grub2 booting 2021-06-15 17:58:07 +08:00
rtc-rv5c386a Sync to snapshot kernel 5.4 version 2020-07-02 23:30:56 +08:00
rtl8812au-ct x64: fix grub2 booting 2021-06-15 17:58:07 +08:00
trelay x64: fix grub2 booting 2021-06-15 17:58:07 +08:00