diff options
-rwxr-xr-x | scripts/netcfg-wpa_actiond | 3 | ||||
-rw-r--r-- | src/8021x | 14 |
2 files changed, 11 insertions, 6 deletions
diff --git a/scripts/netcfg-wpa_actiond b/scripts/netcfg-wpa_actiond index 345b9b0..7adde5c 100755 --- a/scripts/netcfg-wpa_actiond +++ b/scripts/netcfg-wpa_actiond @@ -16,8 +16,11 @@ case $1 in stop) [[ -z $2 ]] && echo "Please specify an interface to stop" && exit 1 interface=$2 + PIDFILE="/run/wpa_actiond_${interface}.pid" [[ -f "$IFACE_DIR/$interface" ]] && source "$IFACE_DIR/$interface" netcfg -D "$interface" + timeout_wait 1 '[[ ! -f "$PIDFILE" ]]' || \ + kill "$(< "$PIDFILE")" # only try to disable software rfkill switches (FS#25514) if [[ "$RFKILL" == "soft" ]]; then set_rf_state "$interface" disabled $RFKILL_NAME || exit $? @@ -51,7 +51,7 @@ start_wpa() { local INTERFACE="$1" WPA_CONF="$2" WPA_DRIVER="$3" shift 3 - local WPA_OPTS="$@" + local WPA_OPTS="$@" PIDFILE="/run/wpa_supplicant_${INTERFACE}.pid" if [[ -n "$WPA_CONF" ]]; then WPA_CONF="-c$WPA_CONF" @@ -60,22 +60,24 @@ start_wpa() WPA_CONF="-C$WPA_CTRL_DIR" fi - wpa_supplicant -B -P "/run/wpa_supplicant_${INTERFACE}.pid" -i "$INTERFACE" -D "$WPA_DRIVER" "$WPA_CONF" $WPA_OPTS + wpa_supplicant -B -P "$PIDFILE" -i "$INTERFACE" -D "$WPA_DRIVER" "$WPA_CONF" $WPA_OPTS # wait up to one second for the pid file to appear - timeout_wait 1 '[[ -f "/run/wpa_supplicant_${INTERFACE}.pid" ]]'; + timeout_wait 1 '[[ -f "$PIDFILE" ]]'; return $? } stop_wpa() { + local INTERFACE="$1" # we need this as long as wpa_cli has a different default than netcfg [[ -z "$WPA_CTRL_DIR" && -z "$WPA_CONF" ]] && WPA_CTRL_DIR="/run/wpa_supplicant" - wpa_call "$1" terminate > /dev/null + + wpa_call "$INTERFACE" terminate > /dev/null # wait up to one second for the pid file to be removed - timeout_wait 1 '[[ ! -f "/run/wpa_supplicant_$1.pid" ]]' || \ - kill "$(< "/run/wpa_supplicant_$1.pid")" &> /dev/null & + timeout_wait 1 '[[ ! -f "/run/wpa_supplicant_${INTERFACE}.pid" ]]' || \ + kill "$(< "/run/wpa_supplicant_${INTERFACE}.pid")" &> /dev/null & } wpa_reconfigure() { |