summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/8021x12
-rw-r--r--src/connections/wireless2
2 files changed, 13 insertions, 1 deletions
diff --git a/src/8021x b/src/8021x
index a4a08ca..cbc8588 100644
--- a/src/8021x
+++ b/src/8021x
@@ -56,6 +56,18 @@ wpa_reconfigure() {
return $?
}
+wpa_check_current_essid() {
+ # usage: wpa_check_current_essid $interface $essid
+ # check that wpa_supplicant is connected to the right essid
+ local INTERFACE=$1 ESSID=$2 status
+ status=$($WPA_CLI -i "$INTERFACE" status | grep "^ssid=")
+ if (( $? == 0 )) && [[ "$status" == "ssid=$ESSID" ]]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
wpa_find_essid() {
# usage: wpa_find_essid $INTERFACE $ESSID
# look for existence of a given essid. Assumes wpa_supplicant is
diff --git a/src/connections/wireless b/src/connections/wireless
index 9915165..ccc877c 100644
--- a/src/connections/wireless
+++ b/src/connections/wireless
@@ -124,7 +124,7 @@ wireless_down() {
# Returns status of profile - is it still functional?
wireless_status() {
load_profile "$1"
- if [[ "$(iwgetid -r)" -ne "$ESSID" ]]; then
+ if ! wpa_check_current_essid "$INTERFACE" "$ESSID"; then
return 1
elif ! ip link show dev "$INTERFACE" | fgrep -q "state UP"; then
return 1