summaryrefslogtreecommitdiffstats
path: root/src-wireless
diff options
context:
space:
mode:
Diffstat (limited to 'src-wireless')
-rw-r--r--src-wireless/net-auto4
-rw-r--r--src-wireless/netcfg-auto-wireless4
-rw-r--r--src-wireless/wireless-dbus26
3 files changed, 17 insertions, 17 deletions
diff --git a/src-wireless/net-auto b/src-wireless/net-auto
index ca52b3e..5f972c3 100644
--- a/src-wireless/net-auto
+++ b/src-wireless/net-auto
@@ -35,9 +35,9 @@ case "$1" in
exit_stderr "net-auto not running"
fi
- for iface in $(cat "$STATE_DIR/net-auto"); do
+ while read iface; do
/usr/bin/netcfg2 iface-down "$iface"
- done
+ done < "$STATE_DIR/net-auto"
rm -f "$STATE_DIR/net-auto"
rm_daemon net-auto
;;
diff --git a/src-wireless/netcfg-auto-wireless b/src-wireless/netcfg-auto-wireless
index a3e3fb9..4d0a5e1 100644
--- a/src-wireless/netcfg-auto-wireless
+++ b/src-wireless/netcfg-auto-wireless
@@ -19,7 +19,7 @@ wifi_auto()
set_rf_state "$interface" up || exit $?
fi
- bring_interface up "$interface" # uses iproute methods---is it there any value to providing option to use ifconfig?
+ bring_interface up "$interface" # uses iproute methods - is there an option to use ifconfig?
networks=$(list_networks "$interface")
if [[ -z "$networks" ]]; then
@@ -31,7 +31,7 @@ wifi_auto()
local found_profile
- [ -z "$AUTO_PROFILES" ] && AUTO_PROFILES=$(list_profiles)
+ [[ "$AUTO_PROFILES" ]] || AUTO_PROFILES=$(list_profiles)
# JP: add ability to use AP instead of ESSID
while read ap essid; do
diff --git a/src-wireless/wireless-dbus b/src-wireless/wireless-dbus
index 0e219b6..f3773ee 100644
--- a/src-wireless/wireless-dbus
+++ b/src-wireless/wireless-dbus
@@ -35,7 +35,7 @@ def read_config(config):
def wep_hex2dec(key):
if len(key) not in [10, 26]:
fail("Bad key", report_type="err")
-
+
x=0
new_key=[]
while x<len(key):
@@ -76,7 +76,7 @@ def start(profile, essid):
# Base arguments
args=["wpa_supplicant", "-Bu", "-P/run/wpa_supplicant.pid"]
-
+
try:
args.append(profile['WPA_OPTS'])
except KeyError:
@@ -103,7 +103,7 @@ def start(profile, essid):
bus = dbus.SystemBus()
wpas_obj = bus.get_object(WPAS_DBUS_SERVICE, WPAS_DBUS_OPATH)
wpas = dbus.Interface(wpas_obj, WPAS_DBUS_INTERFACE)
-
+
# Add/Get interface path
try:
driver=profile["WPA_DRIVER"]
@@ -117,12 +117,12 @@ def start(profile, essid):
# Get interface object
if_obj = bus.get_object(WPAS_DBUS_SERVICE, path)
- iface = dbus.Interface(if_obj, WPAS_DBUS_INTERFACES_INTERFACE);
-
+ iface = dbus.Interface(if_obj, WPAS_DBUS_INTERFACES_INTERFACE);
+
# Add and select the network. Networks already specified for wpa-config
if profile['SECURITY'] in ['wpa','wep','none']:
report('debug', 'wireless_dbus', 'add and select network')
-
+
path = iface.addNetwork()
net_obj = bus.get_object(WPAS_DBUS_SERVICE, path)
rnet = dbus.Interface(net_obj, WPAS_DBUS_NETWORKS_INTERFACE)
@@ -132,8 +132,8 @@ def start(profile, essid):
essid = profile["ESSID"]
if profile['SECURITY'] == "wpa":
- opts = dbus.Dictionary({"ssid": dbus.ByteArray(essid),
- "psk": dbus.String(profile['KEY'])},
+ opts = dbus.Dictionary({"ssid": dbus.ByteArray(essid),
+ "psk": dbus.String(profile['KEY'])},
signature="sv")
report('debug', 'wireless_dbus', 'connect to network with security=wpa')
rnet.set(opts)
@@ -141,7 +141,7 @@ def start(profile, essid):
key=profile['KEY']
if key[:2] == "s:": # String key prefixed by "s:"
keydbus=key[2:]
- else: # Hex key
+ else: # Hex key
key=wep_hex2dec(key)
keydbus = dbus.ByteArray()
for l in key:
@@ -155,11 +155,11 @@ def start(profile, essid):
report('debug', 'wireless_dbus', 'connect to network with security=wep')
rnet.set(opts)
elif profile['SECURITY'] == "none":
- opts = dbus.Dictionary({"ssid": dbus.ByteArray(essid)},
+ opts = dbus.Dictionary({"ssid": dbus.ByteArray(essid)},
signature="sv")
report('debug', 'wireless_dbus', 'connect to network with security=none')
rnet.set(opts)
-
+
# Determine timeout
try:
timeout = int(profile["TIMEOUT"])
@@ -174,7 +174,7 @@ def start(profile, essid):
state = iface.state()
if state == "COMPLETED":
break
-
+
if n == timeout:
fail("Association/Authentication failed:" + state)
@@ -184,7 +184,7 @@ def start(profile, essid):
except subprocess.CalledProcessError:
fail()
sys.exit(0)
-
+
def stop(profile):
ret = subprocess.call([ETHERNET_IPROUTE, "down", sys.argv[2]])
os.kill(int(open("/run/wpa_supplicant.pid").read()),SIGTERM)