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
|
||||
|
||||
case "$PHASE" in
|
||||
up) cmd="add" ;;
|
||||
down) cmd="del" ;;
|
||||
*) exit 0 ;;
|
||||
esac
|
||||
|
||||
addr_family() {
|
||||
if [ "$1" != "${1#*[0-9].[0-9]}" ]; then
|
||||
echo "-4"
|
||||
|
@ -16,14 +10,28 @@ addr_family() {
|
|||
fi
|
||||
}
|
||||
|
||||
for i in $(ifquery -p address -i $INTERFACES_FILE $IFACE); do
|
||||
addrfam=$(addr_family $i)
|
||||
configure_addresses() {
|
||||
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
|
||||
done
|
||||
configure_gateways() {
|
||||
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
|
||||
addrfam=$(addr_family $i)
|
||||
|
||||
${MOCK} ip $addrfam route $cmd default via $i
|
||||
done
|
||||
case "$PHASE" in
|
||||
up)
|
||||
configure_addresses add
|
||||
configure_gateways add
|
||||
;;
|
||||
down)
|
||||
configure_gateways del
|
||||
configure_addresses del
|
||||
;;
|
||||
*) exit 0 ;;
|
||||
esac
|
||||
|
|
Loading…
Reference in a new issue