[Guessnet-devel] [svn] r118 - in trunk: . debian scripts
Thomas Hood
guessnet-devel@lists.alioth.debian.org
Mon, 02 May 2005 13:49:15 +0000
Author: jdthood-guest
Date: Mon May 2 13:49:14 2005
New Revision: 118
Modified:
trunk/ChangeLog
trunk/debian/changelog
trunk/guessnet.8
trunk/scripts/test-wireless
trunk/scripts/test-wireless-ap
trunk/scripts/test-wireless-scan
Log:
Add comments to and fix bug in test-wireless-ap; speed up test-wireless; use ifconfig instead of ip in test-wireless and test-wireless-scan; note in guessnet.8 that the wireless test is not implemented cleanly; update changelog
Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog (original)
+++ trunk/ChangeLog Mon May 2 13:49:14 2005
@@ -3,6 +3,7 @@
* If link beat detection fails completely (like, is not supported),
then act as if the link beat is present
* Make test-wireless-ap handle MAC address argument properly
+ * Speed up test-wireless
* Remove dns-* lines from /etc/network/interfaces example stanzas
since these are Debian-specific and users may be confused by them
Modified: trunk/debian/changelog
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Mon May 2 13:49:14 2005
@@ -6,11 +6,11 @@
(Closes: #295518)
+ Make test-wireless-ap handle the MAC address argument properly
(Closes: #286835)
+ + Speed up test-wireless
+ Remove resolvconf-related lines from /etc/network/interfaces
example stanzas since users could be confused by them
(Closes: #297836)
- * Recommends: iproute because /usr/share/guessnet/test/test-wireless
- (still classified as an experimental test) uses the ip command
+ * No longer use ip command in /usr/share/guessnet/test/test-wireless
(Closes: #294346)
-- Enrico Zini <enrico@debian.org> Mon, 2 May 2005 14:11:32 +0200
Modified: trunk/guessnet.8
==============================================================================
--- trunk/guessnet.8 (original)
+++ trunk/guessnet.8 Mon May 2 13:49:14 2005
@@ -326,11 +326,13 @@
.sp
Note that the \fBwireless\fP test does not attempt
to change these properties; it only examines them.
-This test is designed to work with a program such as
+This test is designed to work with programs such as
.B waproamd
-which independently and dynamically manages
+which independently and dynamically manage
the wireless network adapter
to keep it associated to an access point.
+.sp
+Note that the \fBwireless\fP test is not yet implemented cleanly.
.P
Note that if one of several tests terminates successfully
Modified: trunk/scripts/test-wireless
==============================================================================
--- trunk/scripts/test-wireless (original)
+++ trunk/scripts/test-wireless Mon May 2 13:49:14 2005
@@ -1,12 +1,12 @@
-#!/bin/bash
+#!/bin/sh
#
# test-wireless
#
# Usage:
# test-wireless IFACE [mac MACADDRESS] [essid ESSID]
#
-# This tests whether the current interface has [the appropriate MAC address]
-# [and the approprate ESSID]
+# This tests whether the current interface has the appropriate MAC address
+# and/or the approprate ESSID
#
# MACADDRESS letters must be in upper case
#
@@ -25,45 +25,42 @@
do_sleep() { LANG=C sleep "$@" ; }
-is_ethernet_mac()
-{
- [ "$1" ] && [ ! "${1/[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]/}" ]
-}
-
IFACE="$1"
[ "$IFACE" ] || { report_err "Interface not specified. Exiting." ; exit 1 ; }
shift
-while [ "$2" ] ; do
+
+while [ "$1" ] ; do
case "$1" in
mac)
- is_ethernet_mac "$2" || { report_err "Argument of 'mac' is not a MAC address" ; exit 1 ; }
MAC_ADDRESS="$2"
+ shift
;;
essid)
ESSID="$2"
+ shift
;;
esac
- shift 2
+ shift
done
[ "$MAC_ADDRESS" ] || [ "$ESSID" ] || { report_err "Neither AP MAC address nor ESSID specified. Exiting." ; exit 1 ; }
-EXITSTATUS=0
-ip link set "$IFACE" up
+FAILED=0
+ifconfig "$IFACE" up
do_sleep 0.5
if [ "$MAC_ADDRESS" ] ; then
ACTUAL_MAC_ADDRESS="$(iwgetid "$IFACE" --ap)"
ACTUAL_MAC_ADDRESS="${ACTUAL_MAC_ADDRESS#*Cell:}"
ACTUAL_MAC_ADDRESS="${ACTUAL_MAC_ADDRESS# }"
ACTUAL_MAC_ADDRESS="${ACTUAL_MAC_ADDRESS% }"
- [ "$ACTUAL_MAC_ADDRESS" = "$MAC_ADDRESS" ] || EXITSTATUS=1
+ [ "$ACTUAL_MAC_ADDRESS" = "$MAC_ADDRESS" ] || FAILED=1
fi
-if [ "$ESSID" ] ; then
+if [ "$FAILED" = 0 ] && [ "$ESSID" ] ; then
ACTUAL_ESSID="$(iwgetid "$IFACE")"
ACTUAL_ESSID="${ACTUAL_ESSID#*ESSID:\"}"
ACTUAL_ESSID="${ACTUAL_ESSID%\"*}"
- [ "$ACTUAL_ESSID" = "$ESSID" ] || EXITSTATUS=1
+ [ "$ACTUAL_ESSID" = "$ESSID" ] || FAILED=1
fi
-ip link set "$IFACE" down
-exit "$EXITSTATUS"
+ifconfig "$IFACE" down
+exit "$FAILED"
Modified: trunk/scripts/test-wireless-ap
==============================================================================
--- trunk/scripts/test-wireless-ap (original)
+++ trunk/scripts/test-wireless-ap Mon May 2 13:49:14 2005
@@ -1,4 +1,5 @@
#!/bin/bash
+# Need bash because we use ${.../...}
#
# test-wireless-ap
#
@@ -39,6 +40,7 @@
[ "$1" ] && [ ! "${1/[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]/}" ]
}
+# Set ESSID to string following 'essid' in the array of function arguments
extract_ESSID()
{
while [ "$1" ] ; do
@@ -64,7 +66,7 @@
extract_ESSID "$@"
-iwconfig "$IFACE" "$@"
+[ "$1" ] && iwconfig "$IFACE" "$@"
ifconfig "$IFACE" up
for (( TIMELEFT="$TIMEOUT" ; TIMELEFT > 0 ; TIMELEFT-- )) ; do
Modified: trunk/scripts/test-wireless-scan
==============================================================================
--- trunk/scripts/test-wireless-scan (original)
+++ trunk/scripts/test-wireless-scan Mon May 2 13:49:14 2005
@@ -49,10 +49,10 @@
[ "$MAC_ADDRESS" ] || [ "$ESSID" ] || { report_err "Neither AP MAC address nor ESSID specified. Exiting." ; exit 1 ; }
-ip link set "$IFACE" up
+ifconfig "$IFACE" up
do_sleep 0.5
SCAN="$(iwlist "$IFACE" scan 2>&1)"
-ip link set "$IFACE" down
+ifconfig "$IFACE" down
shopt -s extglob # We need this to allow the ?( ) syntax in patterns
[ "$SCAN" = "${SCAN/Interface doesn?t support scanning/}" ] || exit 1