#---------------------------------------------------------------------------- # /etc/rc.d/rc320.route - configuration of additional routes # was file /etc/rc.d/route # # Creation: 02.01.2001 fm # Last Update: $Id$ #---------------------------------------------------------------------------- if [ 0"$IP_ROUTE_N" -gt 0 ] then begin_script ROUTE "setting up additional routes ..." dgw= ddev= for idx in `seq 1 $IP_ROUTE_N` do eval route='$IP_ROUTE_'$idx set $route net=$1 gw=$2 case $gw in @*) translate_ip_net $gw IP_ROUTE_$idx gw || continue ;; esac if ! netcalc isip $gw then dev=$3 else gw= dev=$2 fi if [ "$net" = "0.0.0.0/0" ] then dgw=$gw ddev=$dev else [ "$gw" ] && gw="via $gw" [ "$dev" ] && dev="dev $dev" if ! ip route add $net $gw $dev > /tmp/route.$$ 2>&1 then log_error "Error setting route: ip route add $net $gw $dev" log_error < /tmp/route.$$ fi fi done rm -f /tmp/route.$$ end_script fi if [ "$dgw" -o "$ddev" ] then begin_script IP_DEFAULT_GATEWAY "setting up default gateway ..." [ "$ddev" ] && ddev="dev $ddev" [ "$dgw" ] && dgw="via $dgw" ip route add default $dgw $ddev end_script fi