--- etc/rc.d/routing 2010-03-24 20:58:48.000000000 +0300 +++ etc/rc.d/routing 2010-05-06 20:24:03.000000000 +0400 @@ -27,28 +27,48 @@ routing_stop() { - route -n flush + _fibs_num=`sysctl -n net.fibs` + i=0 + while [ $i -lt ${_fibs_num} ] ; do + setfib -F $i route -n flush + i=$((i + 1)) + done } static_start() { - case ${defaultrouter} in - [Nn][Oo] | '') - ;; - *) - static_routes="default ${static_routes}" - route_default="default ${defaultrouter}" - ;; - esac + _fibs_num=`sysctl -n net.fibs` + if [ -n "${static_routes}" ]; then + static_routes_fib0=${static_routes} + fi + if [ -n "${defaultrouter}" ]; then + defaultrouter_fib0=${defaultrouter} + fi # Setup static routes. This should be done before router discovery. # - if [ -n "${static_routes}" ]; then - for i in ${static_routes}; do - eval route_args=\$route_${i} - route add ${route_args} - done - fi + n=0 + while [ $n -lt ${_fibs_num} ] ; do + eval _drouter=\$defaultrouter_fib${n} + eval _routes=\$static_routes_fib${n} + + case ${_drouter} in + [Nn][Oo] | '') + ;; + *) + _routes="default ${_routes}" + route_default="default ${_drouter}" + ;; + esac + + if [ -n "${_routes}" ]; then + for i in ${_routes}; do + eval route_args=\$route_${i} + setfib -F $n route add ${route_args} + done + fi + n=$((n + 1)) + done # Now ATM static routes # if [ -n "${natm_static_routes}" ]; then --- share/man/man5/rc.conf.5 2009-03-04 12:41:55.000000000 +0300 +++ share/man/man5/rc.conf.5 2009-03-09 20:19:45.000000000 +0300 @@ -2187,7 +2187,14 @@ .Dq Li NO , create a default route to this host name or IP address (use an IP address if this router is also required to get to the -name server!). +name server!). It's an equivalent of +.Va defaultrouter_fib0 . +.It Va defaultrouter_fibN +.Pq Vt str +If not set to +.Dq Li NO , +create a default route to this host name or IP address in FIB +number N. See the setfib(1). .It Va ipv6_defaultrouter .Pq Vt str The IPv6 equivalent of @@ -2195,10 +2202,9 @@ .It Va static_routes .Pq Vt str Set to the list of static routes that are to be added at system -boot time. -If not set to -.Dq Li NO -then for each whitespace separated +boot time. (It's an equivalent of +.Va static_routes_fib0 ) +If not empty then for each whitespace separated .Ar element in the value, a .Va route_ Ns Aq Ar element @@ -2212,6 +2218,10 @@ route_mcast="-net 224.0.0.0/4 -iface gif0" route_gif0local="-host 169.254.1.1 -iface lo0" .Ed +.It Va static_routes_fibN +.Pq Vt str +Set to the list of static routes that are to be added in FIB +number N. See setfib(1). .It Va ipv6_static_routes .Pq Vt str The IPv6 equivalent of