summaryrefslogtreecommitdiffstats
path: root/src/connections/wireless
diff options
context:
space:
mode:
authorJames Rayner <james@archlinux.org>2009-09-07 12:00:22 +0200
committerJames Rayner <james@archlinux.org>2009-09-07 12:00:22 +0200
commit13406e34b1179d748b98791d1a15387ba053a4fa (patch)
tree4af421b5703462b43929fe56a23808d1680d28da /src/connections/wireless
parent3ae7e093c27350ced6ffaf99a3bca6bc56c559b8 (diff)
downloadnetctl-13406e34b1179d748b98791d1a15387ba053a4fa.tar.gz
netctl-13406e34b1179d748b98791d1a15387ba053a4fa.tar.xz
Lots of little tweaks that should never hurt. Some of them may help in
corner cases; others probably make no difference. Signed-off-by: Jim Pryor <profjim@jimpryor.net>
Diffstat (limited to 'src/connections/wireless')
-rw-r--r--src/connections/wireless18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/connections/wireless b/src/connections/wireless
index d341e99..2951cdd 100644
--- a/src/connections/wireless
+++ b/src/connections/wireless
@@ -19,8 +19,8 @@ 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"
+ . "$SUBR_DIR/8021x"
+ . "$SUBR_DIR/wireless"
# If rfkill is specified, enable device.
if [[ -n "$RFKILL_NAME" ]]; then
@@ -33,7 +33,7 @@ wireless_up() {
fi
# Check if interface exists
- if [[ ! -e /sys/class/net/"$INTERFACE" ]]; then
+ if [[ ! -e "/sys/class/net/$INTERFACE" ]]; then
if ! echo "$INTERFACE" | fgrep -q ":"; then
report_fail "interface $INTERFACE does not exist"
return 1
@@ -79,7 +79,7 @@ wireless_up() {
fi
# Manually set iwconfig options
- if [[ "$IWCONFIG" ]]; then
+ if [[ -n "$IWCONFIG" ]]; then
report_debug wireless_up iwconfig "$INTERFACE" $IWCONFIG
iwconfig "$INTERFACE" $IWCONFIG
fi
@@ -113,7 +113,7 @@ wireless_up() {
fi
report_debug wireless_up iwconfig "$INTERFACE" $WEP_OPTS
- if ! eval iwconfig $INTERFACE $WEP_OPTS; then
+ if ! eval "iwconfig \"$INTERFACE\" $WEP_OPTS"; then
report_fail "Could not set wireless configuration."
return 1
fi
@@ -149,6 +149,8 @@ wireless_up() {
# Generate configuration
if [[ "${#KEY}" -eq 64 ]]; then
echo -e "network={ \nssid=\"$ESSID\" \npsk=$KEY \n}">> "$WPA_CONF/wpa.conf"
+ # JP: formerly I had { \nssid=\"$ESSID\" \nproto=WPA \nkey_mgmt=WPA-PSK \npsk=$KEY \n}
+ # JP: is what's above better?
elif ! echo "$KEY" | wpa_passphrase "$ESSID" >> "$WPA_CONF/wpa.conf"; then
report_fail "Configuration generation failed."
cat "$WPA_CONF/wpa.conf" >&2
@@ -169,7 +171,7 @@ wireless_up() {
fi
;;
wpa-config)
- . "${SUBR_DIR}/8021x"
+ . "$SUBR_DIR/8021x"
[[ -z "$WPA_CONF" ]] && WPA_CONF="/etc/wpa_supplicant.conf" # defaults
[[ -z "$WPA_OPTS" ]] && WPA_OPTS="-Dwext"
report_debug wireless_up start_wpa "$INTERFACE" "$WPA_CONF" "$WPA_OPTS"
@@ -187,7 +189,7 @@ wireless_up() {
conn=ethernet
checkyesno "${IPROUTE:-no}" && conn=ethernet-iproute
- if ! "${CONN_DIR}/$conn" up "$1"; then
+ if ! "$CONN_DIR/$conn" up "$1"; then
wireless_down "$1" YES
return 1
fi
@@ -196,7 +198,7 @@ wireless_up() {
wireless_down() {
local PROFILE="$1" NOETHERNETDOWN="$2"
load_profile "$PROFILE"
- . "${SUBR_DIR}/8021x"
+ . "$SUBR_DIR/8021x"
if ! checkyesno "$NOETHERNETDOWN"; then
conn=ethernet
checkyesno "${IPROUTE:-no}" && conn=ethernet-iproute