Merge pull request #147 from BarbarossaTM/feature/tunnel

Add support for gretap tunnels over IPv6 networks
This commit is contained in:
Ariadne Conill 2021-03-25 18:10:31 -08:00 committed by GitHub
commit 381c0ed1a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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
# Store tunnel type/mode separaltely and unset input variable to exclude it
# from PARAMS below
TUNNEL_MODE="$IF_TUNNEL_MODE"
unset IF_TUNNEL_MODE
# 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}
}