1
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-06-26 09:37:29 +02:00
openwrt/package
Bob Cantor bea9380149 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>
(cherry-picked from commit a29ab3b79a)
2021-06-30 19:24:55 +02:00
..
base-files base-files: fix /tmp/TZ when zoneinfo not installed 2021-06-25 14:53:52 -10:00
boot ramips: add support for Linksys EA8100 v1 2021-06-10 17:09:35 +02:00
devel binutils: fix libbfd missing DSO dependency if NLS enabled 2021-04-10 14:22:28 +02:00
firmware wireless-regdb: update to version 2021.04.21 2021-06-08 20:44:12 +02:00
kernel mac80211: fix no_reload logic (FS#3902) 2021-06-30 19:24:55 +02:00
libs libusb: Fix parsing of descriptors for multi-configuration devices 2021-06-26 17:11:21 +02:00
network iwinfo: update to latest Git HEAD 2021-06-27 14:00:18 +02:00
system opkg: update to git HEAD 2021-06-14 00:02:19 +02:00
utils busybox: sysntpd: add trigger to reload server 2021-06-30 09:24:15 +02:00
Makefile build: always build package/kernel/linux 2020-10-15 13:25:58 +02:00