executor scripts: add vrf executor
This commit is contained in:
parent
a2a532c8ba
commit
ba2ad348ff
2 changed files with 27 additions and 1 deletions
3
Makefile
3
Makefile
|
@ -80,7 +80,8 @@ EXECUTOR_SCRIPTS_CORE ?= \
|
|||
link \
|
||||
|
||||
EXECUTOR_SCRIPTS_OPT ?= \
|
||||
bridge
|
||||
bridge \
|
||||
vrf
|
||||
|
||||
EXECUTOR_SCRIPTS ?= ${EXECUTOR_SCRIPTS_CORE} ${EXECUTOR_SCRIPTS_OPT}
|
||||
|
||||
|
|
25
executor-scripts/linux/vrf
Executable file
25
executor-scripts/linux/vrf
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
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
|
||||
pre-up)
|
||||
[ -n "$IF_VRF_TABLE" ] && handle_init "add"
|
||||
[ -n "$IF_VRF_MEMBER" ] && handle_member
|
||||
;;
|
||||
post-down)
|
||||
[ -n "$IF_VRF_TABLE" ] && handle_init "del"
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
Loading…
Reference in a new issue