tunnel executore: Add support for setting pmtudisc / ignore-df for tunnels.
Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
This commit is contained in:
parent
2b358fafc6
commit
73d9788fab
1 changed files with 32 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
||||||
# Based on alpine's tunnel configuration script.
|
# Based on alpine's tunnel configuration script.
|
||||||
# Copyright (c) 2017 Kaarle Ritvanen
|
# Copyright (c) 2017 Kaarle Ritvanen
|
||||||
# Copyright (c) 2020 Ariadne Conill (extended for ifupdown-ng)
|
# Copyright (c) 2020 Ariadne Conill (extended for ifupdown-ng)
|
||||||
# Copyright (c) 2021 Maximilian Wilhelm (make sure mode/type is 1st parameter)
|
# Copyright (c) 2021 Maximilian Wilhelm (make sure mode/type is 1st parameter, add more options)
|
||||||
|
|
||||||
[ -z "$IF_TUNNEL_LOCAL" -a -z "$IF_TUNNEL_LOCAL_DEV" ] && exit 1
|
[ -z "$IF_TUNNEL_LOCAL" -a -z "$IF_TUNNEL_LOCAL_DEV" ] && exit 1
|
||||||
[ -z "$IF_TUNNEL_REMOTE" ] && exit 1
|
[ -z "$IF_TUNNEL_REMOTE" ] && exit 1
|
||||||
|
@ -10,6 +10,13 @@
|
||||||
|
|
||||||
[ -n "$VERBOSE" ] && set -x
|
[ -n "$VERBOSE" ] && set -x
|
||||||
|
|
||||||
|
yesno() {
|
||||||
|
case "$1" in
|
||||||
|
yes|1) echo 1 ;;
|
||||||
|
*) echo 0 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
# Figure out address familiy
|
# Figure out address familiy
|
||||||
FAMILY="4"
|
FAMILY="4"
|
||||||
|
|
||||||
|
@ -70,6 +77,29 @@ if [ ${PHASE} = "create" -a ! "${IF_TUNNEL_LOCAL}" -a "${IF_TUNNEL_LOCAL_DEV}" ]
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Handle boolean switches
|
||||||
|
MORE_PARAMS=""
|
||||||
|
if [ "${IF_TUNNEL_IGNORE_DF}" ]; then
|
||||||
|
if $(yesno "${IF_TUNNEL_IGNORE_DF}"); then
|
||||||
|
MORE_PARAMS="ignore-df"
|
||||||
|
else
|
||||||
|
MORE_PARAMS="noignore-df"
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset IF_TUNNEL_IGNORE_DF
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${IF_TUNNEL_PMTUDISC}" ]; then
|
||||||
|
if $(yesno "${IF_TUNNEL_PMTUDISC}"); then
|
||||||
|
MORE_PARAMS="pmtudisc"
|
||||||
|
else
|
||||||
|
MORE_PARAMS="nopmtudisc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset IF_TUNNEL_PMTUDISC
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Mangle residual IF_TUNNEL_* params into single string
|
# Mangle residual IF_TUNNEL_* params into single string
|
||||||
PARAMS=$(set | sed -E '
|
PARAMS=$(set | sed -E '
|
||||||
s/^IF_TUNNEL_([A-Z0-9_]+)=(.+)/\1\n\2/
|
s/^IF_TUNNEL_([A-Z0-9_]+)=(.+)/\1\n\2/
|
||||||
|
@ -87,7 +117,7 @@ PARAMS=$(set | sed -E '
|
||||||
|
|
||||||
case "$PHASE" in
|
case "$PHASE" in
|
||||||
create)
|
create)
|
||||||
${MOCK} eval ip -$FAMILY $OBJECT add $IFACE $TYPE_KW $TUNNEL_MODE $PARAMS
|
${MOCK} eval ip -$FAMILY $OBJECT add $IFACE $TYPE_KW $TUNNEL_MODE $PARAMS $MORE_PARAMS
|
||||||
;;
|
;;
|
||||||
destroy)
|
destroy)
|
||||||
${MOCK} ip -$FAMILY $OBJECT del $IFACE
|
${MOCK} ip -$FAMILY $OBJECT del $IFACE
|
||||||
|
|
Loading…
Reference in a new issue