port iproute2 configuration from C to shell
This commit is contained in:
parent
cae16c5758
commit
e29e552cc2
2 changed files with 30 additions and 18 deletions
29
executor-scripts/static
Executable file
29
executor-scripts/static
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/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"
|
||||
elif [ "$1" != "${1#*:[0-9a-fA-F]}" ]; then
|
||||
echo "-6"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
for i in $(ifquery -p address -i $INTERFACES_FILE $IFACE); do
|
||||
addrfam=$(addr_family $i)
|
||||
|
||||
${MOCK} ip $addrfam addr $cmd $i dev $IFACE
|
||||
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
|
|
@ -1,18 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
case "$PHASE" in
|
||||
up)
|
||||
cmd="add"
|
||||
;;
|
||||
down)
|
||||
cmd="del"
|
||||
;;
|
||||
esac
|
||||
|
||||
for i in $(ifquery -p address -i $INTERFACES_FILE $IFACE); do
|
||||
echo ip addr $cmd $i dev $IFACE
|
||||
done
|
||||
|
||||
for i in $(ifquery -p gateway -i $INTERFACES_FILE $IFACE); do
|
||||
echo ip route $cmd default via $i
|
||||
done
|
1
tests/executors/static
Symbolic link
1
tests/executors/static
Symbolic link
|
@ -0,0 +1 @@
|
|||
mock-executor
|
Loading…
Reference in a new issue