2020-08-20 08:30:12 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Executor for advanced GRE tunnel management.
|
|
|
|
|
|
|
|
[ -z "$IF_GRE_LOCAL" ] && exit 1
|
|
|
|
[ -z "$IF_GRE_REMOTE" ] && exit 1
|
2020-08-20 08:33:38 +00:00
|
|
|
[ -z "$IF_GRE_MODE" ] && IF_GRE_MODE="gre"
|
2020-08-20 08:30:12 +00:00
|
|
|
|
|
|
|
COMMAND="link"
|
|
|
|
FAMILY="-4"
|
|
|
|
[ "$IF_GRE_MODE" = "ip6gre" ] && FAMILY="-6"
|
|
|
|
|
|
|
|
PARAMS="mode $IF_GRE_MODE local '$IF_GRE_LOCAL' remote '$IF_GRE_REMOTE'"
|
|
|
|
[ -n "$IF_GRE_TTL" ] && PARAMS="$PARAMS ttl '$IF_GRE_TTL'"
|
|
|
|
[ -n "$IF_GRE_FLAGS" ] && PARAMS="$PARAMS $IF_GRE_FLAGS"
|
|
|
|
|
|
|
|
[ -n "$PARAMS" ] || exit 0
|
|
|
|
|
|
|
|
case "$PHASE" in
|
2020-09-09 22:48:35 +00:00
|
|
|
create)
|
2020-08-20 08:30:12 +00:00
|
|
|
${MOCK} eval ip $FAMILY $COMMAND add $IFACE $PARAMS
|
|
|
|
;;
|
2020-09-09 22:48:35 +00:00
|
|
|
destroy)
|
2020-08-20 08:30:12 +00:00
|
|
|
${MOCK} ip $FAMILY $COMMAND del $IFACE
|
|
|
|
;;
|
|
|
|
depend)
|
2020-08-20 08:33:38 +00:00
|
|
|
echo "$IF_GRE_DEV"
|
2020-08-20 08:30:12 +00:00
|
|
|
;;
|
|
|
|
esac
|