From 7d67985300c2c4436142f24d31bb457ea524a4fc Mon Sep 17 00:00:00 2001 From: brooks Date: Fri, 2 Sep 2005 17:11:13 +0000 Subject: - Alwasy explicitly bring the interface up before configuring it. - If an interface's ifconfig_ is set, but empty, don't set it to ifconfig_DEFAULT. This way interfaces can be disabled even in the presence of ifconfig_DEFAULT. - When listing interfaces and network_interfaces=auto, place lo0 first if it's around. --- etc/network.subr | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'etc/network.subr') diff --git a/etc/network.subr b/etc/network.subr index 1ec62d4..d5a1703 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -43,16 +43,23 @@ ifconfig_up() ifconfig_args=`ifconfig_getargs $1` if [ -n "${ifconfig_args}" ]; then + ifconfig $1 up eval "ifconfig $1 ${ifconfig_args}" _cfg=0 fi if wpaif $1; then + if [ $_cfg -ne 0 ] ; then + ifconfig $1 up + fi /etc/rc.d/wpa_supplicant start $1 _cfg=0 # XXX: not sure this should count fi if dhcpif $1; then + if [ $_cfg -ne 0 ] ; then + ifconfig $1 up + fi /etc/rc.d/dhclient start $1 _cfg=0 fi @@ -112,10 +119,7 @@ _ifconfig_getargs() return 1 fi - eval _args=\$ifconfig_$1 - if [ -z "$_args" ]; then - _args=$ifconfig_DEFAULT - fi + eval _args=\${ifconfig_$1-$ifconfig_DEFAULT} echo "$_args" } @@ -400,18 +404,24 @@ list_net_interfaces() { type=$1 - # Get a list of ALL the interfaces + # Get a list of ALL the interfaces and make lo0 first if it's there. # case ${network_interfaces} in [Aa][Uu][Tt][Oo]) _prefix='' _autolist="`ifconfig -l`" + _lo= for _if in ${_autolist} ; do if autoif $_if; then - _tmplist="${_tmplist}${_prefix}${_if}" - [ -z "$_prefix" ] && _prefix=' ' + if [ "$_if" = "lo0" ]; then + _lo="lo0 " + else + _tmplist="${_tmplist}${_prefix}${_if}" + [ -z "$_prefix" ] && _prefix=' ' + fi fi done + _tmplist="${_lo}${_tmplist}" ;; *) _tmplist="${network_interfaces} ${cloned_interfaces}" -- cgit v1.1