diff --git a/Makefile b/Makefile index ef9acff..3874745 100644 --- a/Makefile +++ b/Makefile @@ -80,7 +80,8 @@ EXECUTOR_SCRIPTS_CORE ?= \ link \ EXECUTOR_SCRIPTS_OPT ?= \ - bridge + bridge \ + vrf EXECUTOR_SCRIPTS ?= ${EXECUTOR_SCRIPTS_CORE} ${EXECUTOR_SCRIPTS_OPT} diff --git a/executor-scripts/linux/vrf b/executor-scripts/linux/vrf new file mode 100755 index 0000000..2696d0f --- /dev/null +++ b/executor-scripts/linux/vrf @@ -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