ifupdown-ng/executor-scripts/linux/gre
Maximilian Wilhelm af94d760d0 Update executors to reflect new create/destroy phase.
Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
2020-09-10 00:48:47 +02:00

31 lines
641 B
Bash
Executable file

#!/bin/sh
set -e
# Executor for advanced GRE tunnel management.
[ -z "$IF_GRE_LOCAL" ] && exit 1
[ -z "$IF_GRE_REMOTE" ] && exit 1
[ -z "$IF_GRE_MODE" ] && IF_GRE_MODE="gre"
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
create)
${MOCK} eval ip $FAMILY $COMMAND add $IFACE $PARAMS
;;
destroy)
${MOCK} ip $FAMILY $COMMAND del $IFACE
;;
depend)
echo "$IF_GRE_DEV"
;;
esac