#!/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. #---------------------------------------------------------------------------- ### BEGIN INIT INFO # Provides: # Required-Start: $network # Should-Start: $network # Required-Stop: # Should-Stop: # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: route # Description: route ### END INIT INFO # # Important: # if settings change, please update /var/install/include/restore-route also # . /etc/config.d/base if [ -f '/etc/config.d/bonding' ] then . /etc/config.d/bonding fi . /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:-0} ] do eval route='${IP_ROUTE_'${idx}'}' set ${route} net=${1} netmask=${2} gw=${3} netmaskbits=$(/usr/bin/netcalc netmaskbits ${net}:${netmask}) /usr/sbin/ip route add ${net}/${netmaskbits} via ${gw} idx=$((${idx} + 1)) done if [ -n "${IP_DEFAULT_GATEWAY}" ] then /usr/sbin/ip route add default via ${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/bin/netcalc netmaskbits ${net}:${netmask}) /usr/sbin/ip route del ${net}/${netmaskbits} via ${gw} idx=$((${idx} + 1)) done if [ -n "${IP_DEFAULT_GATEWAY}" ] then if [ "${START_BONDING:-no}" != "yes" ] then /usr/sbin/ip route del default via ${IP_DEFAULT_GATEWAY} fi fi evaluate_retval ;; esac set +x # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------