misc/161547: [patch]bsdinstall should identify wireless network interfaces

Warren Block wblock at wonkity.com
Thu Oct 13 16:10:11 UTC 2011


>Number:         161547
>Category:       misc
>Synopsis:       [patch]bsdinstall should identify wireless network interfaces
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 13 16:10:10 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Warren Block
>Release:        9.0-BETA3
>Organization:
>Environment:
FreeBSD machine3.example.com 9.0-BETA3 FreeBSD 9.0-BETA3 #0: Sat Sep 24 21:31:28 UTC 2011     root at farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
bsdinstall's netconfig script shows a list of interfaces, but does not explicitly identify which are wireless.  The description does not always show that, either.
>How-To-Repeat:
# bsdinstall netconfig

Note that wireless interfaces are included in the list but not identified as such.
>Fix:
Apply attached patch.  The patch factors out the existing wireless detection into a function.  If a card is wireless but the existing description does not contain "wireless" (case-insensitive because manufacturers are not consistent), prefix the description with "Wireless ".

The previous wireless check is replaced with a call to the function.

Not extensively tested, but works on an Acer netbook with re0 and ath0 interfaces.

Patch attached with submission follows:

--- netconfig.orig	2011-10-13 08:14:01.000000000 -0600
+++ netconfig	2011-10-13 09:44:19.000000000 -0600
@@ -41,11 +41,18 @@
 : ${DIALOG_ITEM_HELP=4}
 : ${DIALOG_ESC=255}
 
+# Do a dirty check to see if this a wireless interface -- there
+# should be a better way
+IsWireless() {
+	ifconfig $1 | grep -q 'media: IEEE 802.11 Wireless'
+}
+
 for IF in `ifconfig -l`; do
 	test "$IF" = "lo0" && continue
 	(ifconfig -g wlan | egrep -wq $IF) && continue
 	INTERFACES="$INTERFACES $IF"
 	DESC=`sysctl -n dev.$(echo $IF | sed -E 's/([[:alpha:]]*)([[:digit:]]*)/\1.\2/g').%desc`
+	IsWireless $IF && echo $DESC | grep -iqv wireless && DESC="Wireless $DESC"
 	DIALOG_TAGS="$DIALOG_TAGS $IF \"$DESC\""
 done
 
@@ -56,10 +63,9 @@
 
 : > $BSDINSTALL_TMPETC/._rc.conf.net
 
-# Do a dirty check to see if this a wireless interface -- there should be a
-# better way
 IFCONFIG_PREFIX=""
-if ifconfig $INTERFACE | grep -q 'media: IEEE 802.11 Wireless'; then
+IsWireless $INTERFACE
+if [ $? -eq 0 ]; then
 	NEXT_WLAN_IFACE=wlan0	# XXX
 	echo wlans_$INTERFACE=\"$NEXT_WLAN_IFACE\" >> $BSDINSTALL_TMPETC/._rc.conf.net
 	IFCONFIG_PREFIX="WPA "


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list