executors: static: bring down routes before addresses
This commit is contained in:
parent
83440e3f88
commit
326e27cdb4
1 changed files with 23 additions and 15 deletions
|
@ -1,11 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
case "$PHASE" in
|
|
||||||
up) cmd="add" ;;
|
|
||||||
down) cmd="del" ;;
|
|
||||||
*) exit 0 ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
addr_family() {
|
addr_family() {
|
||||||
if [ "$1" != "${1#*[0-9].[0-9]}" ]; then
|
if [ "$1" != "${1#*[0-9].[0-9]}" ]; then
|
||||||
echo "-4"
|
echo "-4"
|
||||||
|
@ -16,14 +10,28 @@ addr_family() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in $(ifquery -p address -i $INTERFACES_FILE $IFACE); do
|
configure_addresses() {
|
||||||
addrfam=$(addr_family $i)
|
for i in $(ifquery -p address -i $INTERFACES_FILE $IFACE); do
|
||||||
|
addrfam=$(addr_family $i)
|
||||||
|
${MOCK} ip $addrfam addr $1 $i dev $IFACE
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
${MOCK} ip $addrfam addr $cmd $i dev $IFACE
|
configure_gateways() {
|
||||||
done
|
for i in $(ifquery -p gateway -i $INTERFACES_FILE $IFACE); do
|
||||||
|
addrfam=$(addr_family $i)
|
||||||
|
${MOCK} ip $addrfam route $1 default via $i
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
for i in $(ifquery -p gateway -i $INTERFACES_FILE $IFACE); do
|
case "$PHASE" in
|
||||||
addrfam=$(addr_family $i)
|
up)
|
||||||
|
configure_addresses add
|
||||||
${MOCK} ip $addrfam route $cmd default via $i
|
configure_gateways add
|
||||||
done
|
;;
|
||||||
|
down)
|
||||||
|
configure_gateways del
|
||||||
|
configure_addresses del
|
||||||
|
;;
|
||||||
|
*) exit 0 ;;
|
||||||
|
esac
|
||||||
|
|
Loading…
Reference in a new issue