mirror of https://github.com/hak5/openwrt.git
use pidfiles for hostapd/wpa_supplicant instead of killing all processes when bringing an interface down - fixes an issue with random hostapd death
SVN-Revision: 13078lede-17.01
parent
9161a70235
commit
a4f11ca22e
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue