Page MenuHomeFreeBSD

D49696.id153271.diff
No OneTemporary

D49696.id153271.diff

Index: libexec/rc/network.subr
===================================================================
--- libexec/rc/network.subr
+++ libexec/rc/network.subr
@@ -112,6 +112,15 @@
return $_cfg
}
+ifconfig_description()
+{
+ local _ifconfig_descr
+ _ifconfig_descr=`get_if_var $1 ifconfig_IF_descr`
+ if [ -n "${_ifconfig_descr}" ]; then
+ ${IFCONFIG_CMD} $1 description "${_ifconfig_descr}"
+ fi
+}
+
# ifconfig_up if
# Evaluate ifconfig(8) arguments for interface $if and
# run ifconfig(8) with those arguments. It returns 0 if
@@ -121,7 +130,7 @@
#
ifconfig_up()
{
- local _cfg _ifconfig_descr _ipv6_opts ifconfig_args
+ local _cfg _ipv6_opts ifconfig_args
_cfg=1
# Make sure lo0 always comes up.
@@ -211,11 +220,6 @@
ifalias $1 link alias
ifalias $1 ether alias
- _ifconfig_descr=`get_if_var $1 ifconfig_IF_descr`
- if [ -n "${_ifconfig_descr}" ]; then
- ${IFCONFIG_CMD} $1 description "${_ifconfig_descr}"
- fi
-
if wpaif $1; then
/etc/rc.d/wpa_supplicant start $1
_cfg=0 # XXX: not sure this should count
@@ -1603,6 +1607,21 @@
return 0
}
+list_expanded_epair()
+{
+ if [ $# -ne 1 ]; then
+ err 3 'USAGE: list_expanded_epair needs ONE argument (epair#)'
+ return 1
+ fi
+ case ${1#epair} in
+ [0-9]*[ab]) echo ${1} ;;
+ [0-9]*) echo ${1}a ${1}b ;;
+ *) return 1 ;;
+ esac
+
+ return 0
+}
+
# list_net_interfaces type
# List all network interfaces. The type of interface returned
# can be controlled by the type argument. The type
@@ -1637,6 +1656,10 @@
else
_tmplist="${_tmplist} ${_if}"
fi
+ else
+ # All list type requests but 'skip' will re-
+ # define $_list, collect excluded $_if
+ _list="$_list${_list:+ }$_if"
fi
done
_tmplist="${_lo}${_tmplist# }"
@@ -1701,6 +1724,8 @@
fi
done
;;
+ skip) # !autoif() was collected in $_list
+ ;;
*)
_list=${_tmplist}
;;
Index: libexec/rc/rc.d/netif
===================================================================
--- libexec/rc/rc.d/netif
+++ libexec/rc/rc.d/netif
@@ -52,7 +52,7 @@
netif_start()
{
- local _if
+ local _if _cmdifn _ifname
# Set the list of interfaces to work on.
#
@@ -75,6 +75,14 @@
# Rename interfaces.
ifnet_rename $cmdifn
+ # Adjust $cmdifn if defined (devd(8) etc.)
+ for _if in ${cmdifn}; do
+ _ifname=`get_if_var $_if ifconfig_IF_name`
+ _cmdifn="${_cmdifn}${_cmdifn:+ }${_ifname:-$_if}"
+ done
+ if [ -n "$_cmdifn" ]; then
+ cmdifn="$_cmdifn"
+ fi
# Configure the interface(s).
netif_common ifn_start $cmdifn
@@ -155,7 +163,7 @@
# an interface and then calls $routine.
netif_common()
{
- local _cooked_list _tmp_list _fail _func _ok _str _cmdifn
+ local _cooked_list _fail _func _ok _str _cmdifn
_func=
@@ -166,36 +174,48 @@
shift
fi
- # Set the scope of the command (all interfaces or just one).
- #
- _cooked_list=
- _tmp_list=
- _cmdifn=$*
- if [ -n "$_cmdifn" ]; then
- # Don't check that the interface(s) exist. We need to run
- # the down code even when the interface doesn't exist to
- # kill off wpa_supplicant.
- # XXXBED: is this really true or does wpa_supplicant die?
- # if so, we should get rid of the devd entry
- _cooked_list="$_cmdifn"
- else
+ _cmdifn= # inherited from parent function
+ # Define _cmdifn from rest of $*
+ for _if in $*; do
+ # Expand epair if passed as argument
+ if [ ${_if#epair} != $_if ]; then
+ _ok="`list_expanded_epair $_if`"
+ if [ -n "$_ok" ]; then
+ _if="$_ok"
+ fi
+ fi
+ _cmdifn="$_cmdifn${_cmdifn:+ }$_if"
+ done
+ # Don't check that the interface(s) exist. We need to run
+ # the down code even when the interface doesn't exist to
+ # kill off wpa_supplicant.
+ # XXXBED: is this really true or does wpa_supplicant die?
+ # if so, we should get rid of the devd entry
+ if [ -z "${_cmdifn# }" ]; then
_cooked_list="`list_net_interfaces`"
+ if [ X$_func = Xifn_start ]; then
+ # If interface description is configured, also process
+ # interfaces which are else skipped from auto config
+ # (NOAUTO), but only if $_func=ifn_start
+ for _if in `list_net_interfaces skip` ${_cooked_list# }
+ do
+ ifconfig_description $_if
+ done
+ fi
fi
-
- # Expand epair[0-9] to epair[0-9][ab].
- for ifn in $_cooked_list; do
- case ${ifn#epair} in
- [0-9]*[ab]) ;; # Skip epair[0-9]*[ab].
- [0-9]*)
- for _str in $_cooked_list; do
- case $_str in
- $ifn) _tmp_list="$_tmp_list ${ifn}a ${ifn}b" ;;
- *) _tmp_list="$_tmp_list ${ifn}" ;;
- esac
- done
- _cooked_list=${_tmp_list# }
- ;;
- esac
+ # virtually else [ -z "${_cmdifn# }" ]
+ for _if in $_cmdifn; do
+ # If interface description is configured (and $_func=ifn_start),
+ # here's the place to apply for all selectivly listed interfaces
+ if [ X$_func = Xifn_start ]; then
+ ifconfig_description $_if
+ fi
+ if ! autoif $_if; then
+ continue
+ elif [ -z "`ifconfig_getargs $_if`" ]; then
+ continue
+ fi
+ _cooked_list="$_cooked_list${_cooked_list:+ }$_if"
done
_dadwait=

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 8, 1:51 AM (5 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29362909
Default Alt Text
D49696.id153271.diff (4 KB)

Event Timeline