diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 14:18:53 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 14:18:53 +0000 |
commit | a0e0018c9a7ef5ce7f6d2c3ae16aecbbd16a8f67 (patch) | |
tree | 8feaf1a1932871b139b3b30be4c09c66489918be /testsuite/tests/ip/tunnel/add_tunnel.t | |
parent | Initial commit. (diff) | |
download | iproute2-upstream.tar.xz iproute2-upstream.zip |
Adding upstream version 6.1.0.upstream/6.1.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testsuite/tests/ip/tunnel/add_tunnel.t')
-rwxr-xr-x | testsuite/tests/ip/tunnel/add_tunnel.t | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/tests/ip/tunnel/add_tunnel.t b/testsuite/tests/ip/tunnel/add_tunnel.t new file mode 100755 index 0000000..65db431 --- /dev/null +++ b/testsuite/tests/ip/tunnel/add_tunnel.t @@ -0,0 +1,27 @@ +#!/bin/sh + +. lib/generic.sh + +TUNNEL_NAME="tunnel_test_ip" +KMODS="ip6_gre ip6_tunnel ip_gre ip_tunnel gre" + +# unload kernel modules to remove dummy interfaces only if they were not in use beforehand +kmods_remove= +# note that checkbashism reports command -v, but dash supports it and it's POSIX 2008 compliant +if command -v lsmod >/dev/null 2>&1 && command -v rmmod >/dev/null 2>&1; then + for i in $KMODS; do + lsmod | grep -q "^$i" || kmods_remove="$kmods_remove $i"; + done +fi + +ts_log "[Testing add/del tunnels]" + +ts_ip "$0" "Add GRE tunnel over IPv4" tunnel add name $TUNNEL_NAME mode gre local 1.1.1.1 remote 2.2.2.2 +ts_ip "$0" "Del GRE tunnel over IPv4" tunnel del $TUNNEL_NAME + +ts_ip "$0" "Add GRE tunnel over IPv6" tunnel add name $TUNNEL_NAME mode ip6gre local dead:beef::1 remote dead:beef::2 +ts_ip "$0" "Del GRE tunnel over IPv6" tunnel del $TUNNEL_NAME + +for mod in $kmods_remove; do + sudo rmmod "$mod" +done |