--- etc/network.subr Sat Sep 10 19:05:03 2005 +++ etc/network.subr Sat Oct 15 04:44:17 2005 @@ -30,6 +30,41 @@ # Requires that rc.conf be loaded first. # +ipv4_ifconfig_up() +{ + _cfg=1 + ipv4_ifconfig_args=`ipv4_ifconfig_getargs $1` + if [ -n "${ipv4_ifconfig_args}" ]; then + ifconfig $1 up + + for _ip_ifconfig in ${ipv4_ifconfig_args}; do + + _ipaddr=${_ip_ifconfig%%/*} + _netmask=${_ip_ifconfig##*/} + _range=${_ipaddr##*.} + _ipnet=${_ipaddr%.*} + _iplow=${_range%-*} + _iphigh=${_range#*-} + + eval "ifconfig $1 add ${_ipnet}.${_iplow}/${_netmask}" + + # handle single aliases + if [ "${_iphigh}" != "" ]; then + _ipcount=${_iplow} + while [ "${_ipcount}" -lt "${_iphigh}" ]; do + _ipcount=$((${_ipcount}+1)) + eval "ifconfig $1 add ${_ipnet}.${_ipcount}/32" + done + fi + + done + + _cfg=0 + fi + + return $_cfg +} + # ifconfig_up if # Evaluate ifconfig(8) arguments for interface $if and # run ifconfig(8) with those arguments. It returns 0 if @@ -106,6 +141,22 @@ fi return $_cfg +} + +# ipv4_ifconfig_getargs if +# Echos the arguments for the supplied interface to stdout. +# returns 1 if empty. In general, ifconfig_getargs should be used +# outside this file. +ipv4_ifconfig_getargs() +{ + _ifn=$1 + if [ -z "$_ifn" ]; then + return 1 + fi + + eval _args=\${ipv4_ifconfig_$1-$ifconfig_DEFAULT} + + echo "$_args" } # _ifconfig_getargs if --- etc/rc.d/netif Sat Oct 15 04:50:49 2005 +++ etc/rc.d/netif Sat Oct 15 04:50:41 2005 @@ -150,6 +150,7 @@ ifscript_up ${ifn} && cfg=0 ifconfig_up ${ifn} && cfg=0 + ipv4_ifconfig_up ${ifn} && cfg=0 ifalias_up ${ifn} && cfg=0 ipx_up ${ifn} && cfg=0