summaryrefslogtreecommitdiffstats
path: root/src/lib/8021x
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/8021x')
-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