#!/bin/sh #---------------------------------------------------------------------------- # /etc/rc.d/route - configuration of additional routes # # Creation : 2001-10-15 fm # Last Update: $Id$ # # Copyright (c) 2001-@@YEAR@@ the eisfair team, team(at)eisfair(dot)org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- . /etc/config.d/base . /etc/init.d/functions if [ "${ROUTE_DO_DEBUG}" = "yes" ] then set -x fi case ${1} in start) boot_mesg " * Setting up additional routes ..." idx=1 while [ "${idx}" -le "${IP_ROUTE_N}" ] do eval route='${IP_ROUTE_'${idx}} set ${route} net=${1} netmask=${2} gw=${3} netmaskbits=$(/usr/local/bin/netcalc netmaskbits ${net}:${netmask}) /usr/sbin/ip route add ${net}/${netmaskbits} via ${gw} # route add -net $net netmask $netmask gw $gw idx=$((${idx} + 1)) done if [ -n "${IP_DEFAULT_GATEWAY}" ] then /usr/sbin/ip route add default via ${IP_DEFAULT_GATEWAY} # route add default gw $IP_DEFAULT_GATEWAY fi evaluate_retval ;; stop) boot_mesg " * Deleting additional routes ..." idx=1 while [ "${idx}" -le "${IP_ROUTE_N}" ] do eval route='${IP_ROUTE_'${idx}} set ${route} net=${1} netmask=${2} gw=${3} netmaskbits=$(/usr/local/bin/netcalc netmaskbits ${net}:${netmask}) /usr/sbin/ip route del ${net}/${netmaskbits} via ${gw} # route del -net $net netmask $netmask gw $gw idx=$((${idx} + 1)) done if [ -n "${IP_DEFAULT_GATEWAY}" ] then if [ "${START_BONDING}" != "yes" ] then /usr/sbin/ip route del default via ${IP_DEFAULT_GATEWAY} # route del default gw $IP_DEFAULT_GATEWAY fi fi evaluate_retval ;; esac set +x # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------