tunnel executor: Add support for ip6gretap tunnels

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
This commit is contained in:
Maximilian Wilhelm 2021-03-25 21:03:27 +01:00
parent 258d397d84
commit bec5fcefce
2 changed files with 28 additions and 7 deletions

View file

@ -23,15 +23,23 @@ esac
# and therefor require 'type' keyword instead of 'mode'
OBJECT="tunnel"
TYPE_KW="mode"
if [ "${IF_TUNNEL_MODE}" = "gretap" ]; then
case "${IF_TUNNEL_MODE}" in
*gretap)
OBJECT="link"
TYPE_KW="type"
fi
# Strip possible "ip6" from tunnel mode
TUNNEL_MODE="gretap"
;;
*)
# Store tunnel type/mode separaltely and unset input variable to exclude it
# from PARAMS below
TUNNEL_MODE="$IF_TUNNEL_MODE"
unset IF_TUNNEL_MODE
;;
esac
# Mangle residual IF_TUNNEL_* params into single string
PARAMS=$(set | sed -E '

View file

@ -7,7 +7,8 @@ tests_init \
tunnel_bringup \
tunnel_teardown \
gretap_up \
gretap_down
gretap_down \
ip6gretap_up
tunnel_bringup_body() {
export MOCK=echo IFACE=tun0 PHASE=create IF_TUNNEL_MODE=gre \
@ -50,3 +51,15 @@ gretap_down_body() {
-o match:"ip -4 link del foo" \
${EXECUTOR}
}
ip6gretap_up_body() {
export MOCK=echo IFACE=foo PHASE=create IF_TUNNEL_MODE=ip6gretap \
IF_TUNNEL_LOCAL=2001:db8::aaaa IF_TUNNEL_REMOTE=2001:db8::eeee
atf_check -s exit:0 \
-o match:"ip -6 link add foo" \
-o match:"type gretap" \
-o match:"local '2001:db8::aaaa'" \
-o match:"remote '2001:db8::eeee'" \
${EXECUTOR}
}