#!/bin/sh #---------------------------------------------------------------------------- # delete-all-routes - delete all existing routes on an interface # # called by imond # # Creation: 2000-11-14 fm # Last Update: $Id$ # # Copyright (c) 2000-@@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. #---------------------------------------------------------------------------- device=${1} if [ "${device}" = "pppoe" ] then device='ppp0' fi /usr/sbin/ip link set dev ${device} down if [ -f /run/${device}.conf ] then conf=$(cat /run/${device}.conf) set $conf ip=${1} subnet=${3} network=$(/usr/bin/netcalc network ${ip}:${subnet}) netmaskbits="/$(/usr/bin/netcalc netmaskbits ${network}:${subnet})" /usr/sbin/ip addr add ${ip}/${netmaskbits} peer ${2} dev ${interface} /usr/sbin/ip link set dev ${device} up else /usr/sbin/ip link set dev ${device} up fi exit 0 # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------