mac80211: always call wireless_set_data (FS#3784)
authorBob Cantor <coxede6557@w3boats.com>
Thu, 24 Jun 2021 18:07:34 +0000 (04:07 +1000)
committerFelix Fietkau <nbd@nbd.name>
Mon, 28 Jun 2021 15:24:11 +0000 (17:24 +0200)
commitd515f6b6cde357bf480d32a7387f07ea40e85e52
treea2b2c1850d4a5e5aef7ea48f55648c840e4c21f0
parenta29ab3b79affb62fda82e0825ed811eaf482dd3c
mac80211: always call wireless_set_data  (FS#3784)

When wifi is turned off, drv_mac80211_teardown sometimes fails (silently)
because the device to be torn down is not defined.

This situation arises if drv_mac80211_setup was called twice when
wifi was turned on.

This commit ensures that the device to be torn down is always defined
in drv_mac80211_teardown.

Steps to reproduce:

1) Use /sbin/wifi to turn on wifi.
   uci set wireless.@wifi-iface[0].disabled=0
   uci set wireless.@wifi-device[0].disabled=0
   uci commit
   wifi

2) Use /sbin/wifi to turn off wifi.
   uci set wireless.@wifi-device[0].disabled=1
   uci commit
   wifi

3) Observe that wifi is still up.

branches affected: trunk, 21.02

Signed-off-by: Bob Cantor <coxede6557@w3boats.com>
package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh