diff --git a/executor-scripts/linux/tunnel b/executor-scripts/linux/tunnel index 10fa1e3..2eec499 100755 --- a/executor-scripts/linux/tunnel +++ b/executor-scripts/linux/tunnel @@ -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 ' diff --git a/tests/linux/tunnel_test b/tests/linux/tunnel_test index 8c37928..49a296a 100755 --- a/tests/linux/tunnel_test +++ b/tests/linux/tunnel_test @@ -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} +} +