summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Pryor <profjim@jimpryor.net>2009-09-14 05:43:41 +0200
committerJames Rayner <james@archlinux.org>2009-09-14 08:24:48 +0200
commit06f6fab07786329be1d4b03a09c5af177cadd609 (patch)
treebd9cb2c57963cc77cd1e68701fe6bd3d3567f448
parentf2da81ef36dcce8cfd4b841ca1677e744818b3be (diff)
downloadnetctl-06f6fab07786329be1d4b03a09c5af177cadd609.tar.gz
netctl-06f6fab07786329be1d4b03a09c5af177cadd609.tar.xz
revert regexp ESSID patches
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
-rw-r--r--doc/wireless-dbus2
-rw-r--r--src-wireless/netcfg-auto-wireless18
-rw-r--r--src/connections/wireless4
-rw-r--r--src/network10
-rw-r--r--src/wireless26
5 files changed, 21 insertions, 39 deletions
diff --git a/doc/wireless-dbus b/doc/wireless-dbus
index bddd565..886ea16 100644
--- a/doc/wireless-dbus
+++ b/doc/wireless-dbus
@@ -16,7 +16,7 @@ SECURITY (required)
KEY (required for SECURITY of 'wpa' or 'wep' only)
: Wireless encryption key.
ESSID (this or AP is required)
-: Name of network to connect to. Note that for "wireless-dbus" profiles this is always a Gnu regexp (as interpreted by "expr").
+: Name of network to connect to.
AP (this or ESSID is required)
: AP of the network to connect to.
TIMEOUT
diff --git a/src-wireless/netcfg-auto-wireless b/src-wireless/netcfg-auto-wireless
index f2b934a..fe042be 100644
--- a/src-wireless/netcfg-auto-wireless
+++ b/src-wireless/netcfg-auto-wireless
@@ -27,10 +27,9 @@ wifi_auto()
# Loop through all the found essid's, then find a matching profile.
- local found_profile found_essid
+ local found_profile
# JP: add ability to use AP instead of ESSID
- # JP: also, make ESSIDs in wireless-dbus CONNECTIONS a regexp instead of a literal
while read ap essid; do
while read network; do
(
@@ -42,11 +41,7 @@ wifi_auto()
if [[ "$ap" == "$AP" ]]; then
exit 2
elif [[ -z "$found_profile" ]]; then
- if [[ "$CONNECTION" == wireless-dbus ]]; then
- if expr match "$essid" "^$ESSID\$" 1>/dev/null; then
- exit 1
- fi
- elif [[ "$essid" == "$ESSID" ]]; then
+ if [[ "$essid" == "$ESSID" ]]; then
exit 1
fi
fi
@@ -57,11 +52,10 @@ wifi_auto()
)
case $? in
2) found_profile="$network"
- found_essid="$essid"
- break 2;;
+ break 2
+ ;;
1) found_profile="$network"
- found_essid="$essid"
- ;;
+ ;;
esac
done < <(list_profiles) # avoid subshell we'd get by piping list_profiles to while read
done < "$networks" # avoid subshell; list_networks returns name of a tmp file
@@ -69,7 +63,7 @@ wifi_auto()
if [[ -n "$found_profile" ]]; then
report_success
- if profile_up "$found_profile" "$found_essid"; then # JP: now we pass literal essid to profile_up as $2
+ if profile_up "$found_profile"; then
exit 0
else
set_interface forcedown "$interface"
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