diff options
author | Felix Fietkau <nbd@openwrt.org> | 2008-10-29 17:26:49 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2008-10-29 17:26:49 +0000 |
commit | 382a56d914fd45b0854cd2a770473c46810d0a85 (patch) | |
tree | 89c63dd19afe8179a1aba0e96724bf46b633795f /package | |
parent | a3dae311fd51f6c35d5355d2fc6c31e6cdb138e0 (diff) | |
download | master-187ad058-382a56d914fd45b0854cd2a770473c46810d0a85.tar.gz master-187ad058-382a56d914fd45b0854cd2a770473c46810d0a85.tar.bz2 master-187ad058-382a56d914fd45b0854cd2a770473c46810d0a85.zip |
use pidfiles for hostapd/wpa_supplicant instead of killing all processes when bringing an interface down - fixes an issue with random hostapd death
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@13078 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rwxr-xr-x | package/base-files/files/sbin/wifi | 2 | ||||
-rw-r--r-- | package/hostapd/files/hostapd.sh | 2 | ||||
-rwxr-xr-x | package/madwifi/files/lib/wifi/madwifi.sh | 10 | ||||
-rw-r--r-- | package/wpa_supplicant/files/wpa_supplicant.sh | 2 |
4 files changed, 7 insertions, 9 deletions
diff --git a/package/base-files/files/sbin/wifi b/package/base-files/files/sbin/wifi index 63e132d4f1..e9752c6039 100755 --- a/package/base-files/files/sbin/wifi +++ b/package/base-files/files/sbin/wifi @@ -84,6 +84,8 @@ set_wifi_down() { local cfg="$1" local vifs vif vifstr + [ -f "/var/run/wifi-${cfg}.pid" ] && + kill "$(cat "/var/run/wifi-${cfg}.pid")" uci_revert_state wireless "$cfg" config_get vifs "$cfg" vifs for vif in $vifs; do diff --git a/package/hostapd/files/hostapd.sh b/package/hostapd/files/hostapd.sh index 1159c3b156..707fd8c4b8 100644 --- a/package/hostapd/files/hostapd.sh +++ b/package/hostapd/files/hostapd.sh @@ -96,6 +96,6 @@ wpa=$wpa wpa_pairwise=$crypto $hostapd_cfg EOF - hostapd -B /var/run/hostapd-$ifname.conf + hostapd -P /var/run/wifi-$ifname.conf -B /var/run/hostapd-$ifname.conf } diff --git a/package/madwifi/files/lib/wifi/madwifi.sh b/package/madwifi/files/lib/wifi/madwifi.sh index 6ee6435658..5ce288f6e6 100755 --- a/package/madwifi/files/lib/wifi/madwifi.sh +++ b/package/madwifi/files/lib/wifi/madwifi.sh @@ -50,18 +50,14 @@ disable_atheros() ( local device="$1" set_wifi_down "$device" - # kill all running hostapd and wpa_supplicant processes that - # are running on atheros vifs - for pid in `pidof hostapd wpa_supplicant`; do - grep ath /proc/$pid/cmdline >/dev/null && \ - kill $pid - done include /lib/network cd /proc/sys/net for dev in *; do grep "$device" "$dev/%parent" >/dev/null 2>/dev/null && { - ifconfig "$dev" down + [ -f "/var/run/wifi-${dev}.pid" ] && + kill "$(cat "/var/run/wifi-${dev}.pid")" + ifconfig "$dev" down unbridge "$dev" wlanconfig "$dev" destroy } diff --git a/package/wpa_supplicant/files/wpa_supplicant.sh b/package/wpa_supplicant/files/wpa_supplicant.sh index 37ebef7a4b..debdf811a5 100644 --- a/package/wpa_supplicant/files/wpa_supplicant.sh +++ b/package/wpa_supplicant/files/wpa_supplicant.sh @@ -75,5 +75,5 @@ network={ $password } EOF - [ -z "$proto" ] || wpa_supplicant ${bridge:+ -b $bridge} -B -D ${driver:-wext} -i "$ifname" -c /var/run/wpa_supplicant-$ifname.conf + [ -z "$proto" ] || wpa_supplicant ${bridge:+ -b $bridge} -B -P "/var/run/wifi-${ifname}.pid" -D ${driver:-wext} -i "$ifname" -c /var/run/wpa_supplicant-$ifname.conf } |