Index: etc/network.subr =================================================================== --- etc/network.subr (revision 277815) +++ etc/network.subr (working copy) @@ -300,15 +300,22 @@ # outside this file. _ifconfig_getargs() { - local _ifn _af + local _ifn _af _default _ifn=$1 _af=${2+_$2} + _default="$ifconfig_DEFAULT" if [ -z "$_ifn" ]; then return 1 fi - get_if_var $_ifn ifconfig_IF$_af "$ifconfig_DEFAULT" + if checkyesno wlan_autoconfig; then + if is_wireless_interface $_ifn; then + _default="$ifconfig_WLANDEFAULT" + fi + fi + + get_if_var $_ifn ifconfig_IF$_af "$_default" } # ifconfig_getargs if [af] @@ -1549,7 +1556,7 @@ # list_net_interfaces() { - local type _tmplist _list _autolist _lo _if + local type _tmplist _list _autolist _lo _if _i type=$1 # Get a list of ALL the interfaces and make lo0 first if it's there. @@ -1635,6 +1642,16 @@ ;; esac + if checkyesno wlan_autoconfig; then + _i=0 + for _if in ${_tmplist} ; do + if is_wireless_interface $_if; then + eval wlans_${_if}=\"wlan${_i}\" + _i=$(($_i + 1)) + fi + done + fi + echo $_list return 0 @@ -1688,6 +1705,17 @@ test "$media" = "Ethernet" } +is_wireless_interface() +{ + local media + + case `${IFCONFIG_CMD} $1 2>/dev/null` in + *media:?IEEE?802.11?Wireless*) media=802.11 ;; + esac + + test "$media" = "802.11" +} + # network6_getladdr if [flag] # Echo link-local address from $if if any. # If flag is defined, tentative ones will be excluded. Index: etc/defaults/rc.conf =================================================================== --- etc/defaults/rc.conf (revision 277815) +++ etc/defaults/rc.conf (working copy) @@ -221,6 +221,11 @@ #create_args_vlan0="vlan 102" # vlan tag for vlan0 device #wlans_ath0="wlan0" # wlan(4) interfaces for ath0 device #wlandebug_wlan0="scan+auth+assoc" # Set debug flags with wlanddebug(8) +wlan_autoconfig="NO" # Auto-configure wlan(4) interfaces for all + # 802.11 devices + # NOTE: this can slow down init because extra + # fork(2) done for ifconfig(8) (required for + # media type detection) #ipv4_addrs_fxp0="192.168.0.1/24 192.168.1.1-5/28" # example IPv4 address entry. # #autobridge_interfaces="bridge0" # List of bridges to check