X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/5c2c8ca46715e5a54a99c31b87197ba30f47250e..7f1760652d125ff3867abe3c62dcb0f22a0013f1:/package/mac80211/files/lib/wifi/mac80211.sh?ds=sidebyside diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh index ca38805f7..1c12a154c 100644 --- a/package/mac80211/files/lib/wifi/mac80211.sh +++ b/package/mac80211/files/lib/wifi/mac80211.sh @@ -174,12 +174,13 @@ disable_mac80211() ( # kill all running hostapd and wpa_supplicant processes that # are running on atheros/mac80211 vifs for pid in `pidof hostapd wpa_supplicant`; do - grep "$phy" /proc/$pid/cmdline >/dev/null && \ + grep -E "($phy|wlan)" /proc/$pid/cmdline >/dev/null && \ kill $pid done include /lib/network for wdev in $(ls /sys/class/ieee80211/${phy}/device/net 2>/dev/null); do + [ -f "/var/run/$wdev.pid" ] && kill $(cat /var/run/$wdev.pid) >&/dev/null 2>&1 ifconfig "$wdev" down 2>/dev/null unbridge "$dev" iw dev "$wdev" del @@ -408,7 +409,7 @@ enable_mac80211() { start_hostapd=1 done - [ -n "$start_hostapd" ] || return + [ -n "$start_hostapd" ] || return 0 hostapd -P /var/run/wifi-$phy.pid -B /var/run/hostapd-$phy.conf || { echo "Failed to start hostapd for $phy"