ifupdown-ng/executor-scripts/linux/vrf
Maximilian Wilhelm af94d760d0 Update executors to reflect new create/destroy phase.
Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
2020-09-10 00:48:47 +02:00

32 lines
560 B
Bash
Executable file

#!/bin/sh
set -e
handle_init() {
${MOCK} /sbin/ip link $1 $IFACE type vrf table $IF_VRF_TABLE
${MOCK} /sbin/ip rule $1 iif $IFACE table $IF_VRF_TABLE
${MOCK} /sbin/ip rule $1 oif $IFACE table $IF_VRF_TABLE
}
handle_member() {
${MOCK} /sbin/ip link set $IFACE master $IF_VRF_MEMBER
}
[ -n "$VERBOSE" ] && set -x
case "$PHASE" in
create)
[ -n "$IF_VRF_TABLE" ] && handle_init "add"
;;
pre-up)
[ -n "$IF_VRF_MEMBER" ] && handle_member
;;
destroy)
[ -n "$IF_VRF_TABLE" ] && handle_init "del"
;;
depend)
echo "$IF_VRF_MEMBER"
;;
*)
exit 0
;;
esac