2020-08-18 22:10:48 +00:00
|
|
|
#!/bin/sh
|
2020-08-18 22:28:34 +00:00
|
|
|
set -e
|
|
|
|
|
2020-08-18 22:10:48 +00:00
|
|
|
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
|
2020-09-09 22:48:35 +00:00
|
|
|
create)
|
2020-08-18 22:10:48 +00:00
|
|
|
[ -n "$IF_VRF_TABLE" ] && handle_init "add"
|
2020-09-09 22:48:35 +00:00
|
|
|
;;
|
|
|
|
pre-up)
|
2020-08-18 22:10:48 +00:00
|
|
|
[ -n "$IF_VRF_MEMBER" ] && handle_member
|
|
|
|
;;
|
2020-09-09 22:48:35 +00:00
|
|
|
destroy)
|
2020-08-18 22:10:48 +00:00
|
|
|
[ -n "$IF_VRF_TABLE" ] && handle_init "del"
|
|
|
|
;;
|
2020-08-18 22:52:11 +00:00
|
|
|
depend)
|
|
|
|
echo "$IF_VRF_MEMBER"
|
|
|
|
;;
|
2020-08-18 22:10:48 +00:00
|
|
|
*)
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|