From 8f057286d36a8e5bf09b4ccd9d1dd5d3210ee0c6 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Thu, 20 Aug 2020 02:30:12 -0600 Subject: [PATCH] add gre executor --- executor-scripts/linux/gre | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 executor-scripts/linux/gre diff --git a/executor-scripts/linux/gre b/executor-scripts/linux/gre new file mode 100755 index 0000000..7006d4c --- /dev/null +++ b/executor-scripts/linux/gre @@ -0,0 +1,29 @@ +#!/bin/sh + +# Executor for advanced GRE tunnel management. + +[ -z "$IF_GRE_LOCAL" ] && exit 1 +[ -z "$IF_GRE_REMOTE" ] && exit 1 +[ -z "$IF_GRE_MODE" ] && exit 1 + +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 +pre-up) + ${MOCK} eval ip $FAMILY $COMMAND add $IFACE $PARAMS + ;; +post-down) + ${MOCK} ip $FAMILY $COMMAND del $IFACE + ;; +depend) + echo "$IF_TUNNEL_DEV" + ;; +esac