X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=scripts%2Fifdown;fp=scripts%2Fifdown;h=784b1e28d4dbbeacf3459c099fa0096873bdcefc;hb=9ea1bff7b049ce152767460c68bb61f6aa500cef;hp=0000000000000000000000000000000000000000;hpb=f0735327127a921d3ee96f51b84f23208bc6f445;p=startuptools diff --git a/scripts/ifdown b/scripts/ifdown new file mode 100755 index 0000000..784b1e2 --- /dev/null +++ b/scripts/ifdown @@ -0,0 +1,42 @@ +#!/bin/sh + +net=$1 + +IFS=';' + +# TODO allow for /etc/sysconfig/$net also +test -f /etc/sysconfig/$net.net || echo "unknown network configuration '$net'" >&2 && exit 1 + +ifdown_post() { + return 0 +} + +ifdown_pre() { + return 0 +} + +. /etc/sysconfig/$net.net + +#if [ $enable = 'no' || $enable -eq 0 ]; then; exit 0; fi + +ifdown_pre + +#ip link set dev $dev up + +for r in $route; do + ip route del $r +done + +for address in $addr do + ip addr del $address dev $dev +done + +# how do we determine if we should bring the link down? +# there could be other configurations that also set up IP +# addresses. Also, what happens exactly if the primary +# ip address is removed, but not the secondary ones also? + +# for now, just leave the link up, I don't think it hurts +# anything + +ifdown_post