mac80211: print an error if wifi teardown fails
authorBob Cantor <coxede6557@w3boats.com>
Thu, 24 Jun 2021 18:14:47 +0000 (04:14 +1000)
committerFelix Fietkau <nbd@nbd.name>
Wed, 30 Jun 2021 17:24:55 +0000 (19:24 +0200)
drv_mac80211_teardown fails silently if the device to be torn down is
not defined.  This commit prints an error message.

branches affected: trunk, 21.02

Signed-off-by: Bob Cantor <coxede6557@w3boats.com>
(cherry-picked from commit 3933e29d1b87c713167cf4730b68e5f18af4f140)

package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh

index e3b26b287c09b0314b5f8a3c943d1501860a265f..9a9c35fb5fa1c071e3867cabd3cd7a687fe1d992 100644 (file)
@@ -1076,6 +1076,10 @@ drv_mac80211_teardown() {
        json_select data
        json_get_vars phy
        json_select ..
+       [ -n "$phy" ] || {
+               echo "Bug: PHY is undefined for device '$1'"
+               return 1
+       }
 
        mac80211_interface_cleanup "$phy"
        uci -q -P /var/state revert wireless._${phy}