summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2012-12-31 14:01:03 +0100
committerJouke Witteveen <j.witteveen@gmail.com>2012-12-31 14:01:03 +0100
commitecd9fd25076b715d23184317384e37315f5a8c8e (patch)
tree7dccbd0e8e65aac998282ae71887ee7798a5a543 /src/lib
parent454d7b63d70895ca8278c439ce75775d58c9ed6f (diff)
downloadnetctl-ecd9fd25076b715d23184317384e37315f5a8c8e.tar.gz
netctl-ecd9fd25076b715d23184317384e37315f5a8c8e.tar.xz
Fix netctl-auto
Curtis Shimamoto noted it did not work.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/8021x8
1 files changed, 7 insertions, 1 deletions
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