From ecd9fd25076b715d23184317384e37315f5a8c8e Mon Sep 17 00:00:00 2001 From: Jouke Witteveen Date: Mon, 31 Dec 2012 14:01:03 +0100 Subject: Fix netctl-auto Curtis Shimamoto noted it did not work. --- src/lib/8021x | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/8021x b/src/lib/8021x index 60f3552..1cd4343 100644 --- a/src/lib/8021x +++ b/src/lib/8021x @@ -23,6 +23,12 @@ wpa_call() { do_debug wpa_cli "${args[@]}" "$@" } +## Check if an instance of the wpa supplicant is active on an interface +# $1: interface name +wpa_is_active(){ + [[ $(wpa_call "$1" ping 2> /dev/null) == "PONG" ]] +} + ## Retrieves the state of an instance of the wpa supplicant ## Displays one of: DISCONNECTED, INTERFACE_DISABLED, INACTIVE, SCANNING, ## AUTHENTICATING, ASSOCIATING, ASSOCIATED, 4WAY_HANDSHAKE, @@ -113,7 +119,7 @@ wpa_supplicant_scan() { [[ $interface ]] || return 1 essids=$(mktemp --tmpdir essid.XXXXXXXX) - if [[ "$(wpa_call "$interface" ping 2> /dev/null)" != "PONG" ]]; then + if ! wpa_is_active "$interface"; then wpa_start "$interface" "${WPADriver:-nl80211,wext}" || return 1 spawned_wpa=1 fi -- cgit v1.2.3-24-g4f1b