From 06f6fab07786329be1d4b03a09c5af177cadd609 Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Sun, 13 Sep 2009 23:43:41 -0400 Subject: revert regexp ESSID patches Signed-off-by: Jim Pryor --- src/connections/wireless | 4 +--- src/network | 10 +++++----- src/wireless | 26 ++++++++------------------ 3 files changed, 14 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/connections/wireless b/src/connections/wireless index 955f957..42504d2 100644 --- a/src/connections/wireless +++ b/src/connections/wireless @@ -5,7 +5,6 @@ wireless_up() { load_profile "$1" - [[ -n "$2" ]] && ESSID="$2" # JP: use the literal ESSID (though currently we only interpret wireless-dbus ESSIDs as regexps) . "$SUBR_DIR/8021x" . "$SUBR_DIR/wireless" @@ -64,8 +63,7 @@ wireless_up() { if [[ -n "$AP" ]]; then ESSID=$(find_ap "$INTERFACE" "$AP") else - ESSID=$(find_essid "$INTERFACE" "$ESSID" "$CONNECTION") # JP: we could have left $3 null for default of treating ESSID as literal - # but instead we explicitly pass $CONNECTION + ESSID=$(find_essid "$INTERFACE" "$ESSID") fi if [[ $? -gt 0 ]]; then report_fail "Wireless network \"$OLDESSID\" not present." diff --git a/src/network b/src/network index 678fbb3..d1c4235 100644 --- a/src/network +++ b/src/network @@ -94,7 +94,7 @@ all_resume() done } -# profile_up profile [literal essid] +# profile_up profile # put all profiles up # profile_up() @@ -143,10 +143,10 @@ profile_up() exit 1 fi - if ! "$CONN_DIR/$CONNECTION" up "$PROFILE" "$2"; then + if ! "$CONN_DIR/$CONNECTION" up "$PROFILE"; then report_debug profile_up "connect failed" report_fail - # "$CONN_DIR/$CONNECTION" down "$PROFILE" "$2" # JP: should we do this to make sure? + # "$CONN_DIR/$CONNECTION" down "$PROFILE" # JP: should we do this to make sure? exit 1 fi @@ -154,7 +154,7 @@ profile_up() report_debug profile_up "POST_UP failed" report_fail # failing POST_UP will take interface down - "$CONN_DIR/$CONNECTION" down "$PROFILE" "$2" + "$CONN_DIR/$CONNECTION" down "$PROFILE" exit 1 fi @@ -208,7 +208,7 @@ profile_down() exit 1 fi - if ! "$CONN_DIR/$CONNECTION" down "$PROFILE" "$2"; then + if ! "$CONN_DIR/$CONNECTION" down "$PROFILE"; then report_debug profile_up "disconnect failed" report_fail exit 1 diff --git a/src/wireless b/src/wireless index 1292281..2a5b4a3 100644 --- a/src/wireless +++ b/src/wireless @@ -14,28 +14,18 @@ wep_check() } # Check if a particular network is within range -# find_essid interface essid connection (we treat ESSID as regexp when CONNECTION=wireless-dbus) +# find_essid interface essid connection find_essid() { - local INTERFACE="$1" ESSID="$2" CONNECTION="$3" RETRIES=10 try=0 res scanned + local INTERFACE="$1" ESSID="$2" RETRIES=10 try=0 res scanned while [[ "$try" -lt "$RETRIES" ]]; do sleep 0.5 let try++ - if [[ "$CONNECTION" == wireless-dbus ]]; then - # JP: ESSID is a regexp - found=$( - res=$(iwlist "$INTERFACE" scan 2>/dev/null) - [[ -z "$res" ]] && exit 1 - # if results were non-null, process them and exit 0 - echo "$res" | sed -nr 's/^\s+ESSID:"([^"]*)"$/\1/p' | egrep -xm1 "$ESSID" - ) - else - found=$( - res=$(iwlist "$INTERFACE" scan 2>/dev/null) - [[ -z "$res" ]] && exit 1 - # if results were non-null, process them and exit 0 - echo "$res" | sed -nr 's/^\s+ESSID:"([^"]*)"$/\1/p' | fgrep -xm1 "$ESSID" - ) - fi && { + found=$( + res=$(iwlist "$INTERFACE" scan 2>/dev/null) + [[ -z "$res" ]] && exit 1 + # if results were non-null, process them and exit 0 + echo "$res" | sed -nr 's/^\s+ESSID:"([^"]*)"$/\1/p' | fgrep -xm1 "$ESSID" + ) && { scanned=1 report_debug find_essid "\"$found\"" # we only bother with at most 5 successful scans -- cgit v1.2.3-24-g4f1b