diff options
author | James Rayner <james@archlinux.org> | 2008-07-14 21:24:33 +1000 |
---|---|---|
committer | Aaron Griffin <aaronmgriffin@gmail.com> | 2008-07-17 16:30:07 -0400 |
commit | e13ee23fd2d0035150d178fc683079696fb446fc (patch) | |
tree | 330a52e2ae0fc898f36093997209f4a208d19990 /network | |
parent | 84f76aafc5f6d7f3d2c2141d2930e42dcb82def0 (diff) |
Add some useful error messages to wireless code
Additionally add optional WIRELESS_TIMEOUT parameter
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Diffstat (limited to 'network')
-rwxr-xr-x | network | 25 |
1 files changed, 20 insertions, 5 deletions
@@ -18,11 +18,9 @@ ifup() echo "usage: $0 ifup <interface_name>" return 1 fi - eval iwcfg="\$wlan_${1}" - if [ "$iwcfg" != "" ]; then - /usr/sbin/iwconfig $iwcfg - /bin/sleep 2 - fi + + wi_up $1 || return 1 + eval ifcfg="\$${1}" if [ "$ifcfg" = "dhcp" ]; then # remove the .pid file if it exists @@ -35,6 +33,23 @@ ifup() return $? } +wi_up() +{ + eval iwcfg="\$wlan_${1}" + [ "$iwcfg" = "" ] && return 0 + + /usr/sbin/iwconfig $iwcfg + [[ -z "$WIRELESS_TIMEOUT" ]] && WIRELESS_TIMEOUT=2 + sleep $WIRELESS_TIMEOUT + + bssid=`iwgetid $1 -ra` + if [[ "$bssid" = "00:00:00:00:00:00" ]]; then + printhl "Could not associate $1 - try increasing WIRELESS_TIMEOUT and check network is WEP or has no security" + return 1 + fi + return 0 +} + ifdown() { if [ "$1" = "" ]; then |