]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
selftests: forwarding: Add IPv6 GRE remote change tests
authorIdo Schimmel <idosch@nvidia.com>
Fri, 25 Oct 2024 14:26:29 +0000 (16:26 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 31 Oct 2024 01:24:40 +0000 (18:24 -0700)
Test that after changing the remote address of an ip6gre net device
traffic is forwarded as expected. Test with both flat and hierarchical
topologies and with and without an input / output keys.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Link: https://patch.msgid.link/02b05246d2cdada0cf2fccffc0faa8a424d0f51b.1729866134.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/forwarding/ip6gre_flat.sh
tools/testing/selftests/net/forwarding/ip6gre_flat_key.sh
tools/testing/selftests/net/forwarding/ip6gre_flat_keys.sh
tools/testing/selftests/net/forwarding/ip6gre_hier.sh
tools/testing/selftests/net/forwarding/ip6gre_hier_key.sh
tools/testing/selftests/net/forwarding/ip6gre_hier_keys.sh
tools/testing/selftests/net/forwarding/ip6gre_lib.sh

index 96c97064f2d33c381db573ba6527fae4126f4a61..becc7c3fc809f07d3bfc071b0180bef1f6aec2c7 100755 (executable)
@@ -8,6 +8,7 @@
 ALL_TESTS="
        gre_flat
        gre_mtu_change
+       gre_flat_remote_change
 "
 
 NUM_NETIFS=6
@@ -44,6 +45,19 @@ gre_mtu_change()
        test_mtu_change
 }
 
+gre_flat_remote_change()
+{
+       flat_remote_change
+
+       test_traffic_ip4ip6 "GRE flat IPv4-in-IPv6 (new remote)"
+       test_traffic_ip6ip6 "GRE flat IPv6-in-IPv6 (new remote)"
+
+       flat_remote_restore
+
+       test_traffic_ip4ip6 "GRE flat IPv4-in-IPv6 (old remote)"
+       test_traffic_ip6ip6 "GRE flat IPv6-in-IPv6 (old remote)"
+}
+
 cleanup()
 {
        pre_cleanup
index ff9fb0db9bd1285482e71854627c9e6bdaee4c50..e5335116a2fdde14f42595ed22ea961c7c078809 100755 (executable)
@@ -8,6 +8,7 @@
 ALL_TESTS="
        gre_flat
        gre_mtu_change
+       gre_flat_remote_change
 "
 
 NUM_NETIFS=6
@@ -44,6 +45,19 @@ gre_mtu_change()
        test_mtu_change
 }
 
+gre_flat_remote_change()
+{
+       flat_remote_change
+
+       test_traffic_ip4ip6 "GRE flat IPv4-in-IPv6 with key (new remote)"
+       test_traffic_ip6ip6 "GRE flat IPv6-in-IPv6 with key (new remote)"
+
+       flat_remote_restore
+
+       test_traffic_ip4ip6 "GRE flat IPv4-in-IPv6 with key (old remote)"
+       test_traffic_ip6ip6 "GRE flat IPv6-in-IPv6 with key (old remote)"
+}
+
 cleanup()
 {
        pre_cleanup
index 12c1387852421fa8aafb6c5d3283045ffe3d33ab..7e0cbfdefab0e15378f2d375154eb20deb8b177d 100755 (executable)
@@ -8,6 +8,7 @@
 ALL_TESTS="
        gre_flat
        gre_mtu_change
+       gre_flat_remote_change
 "
 
 NUM_NETIFS=6
@@ -44,6 +45,19 @@ gre_mtu_change()
        test_mtu_change gre
 }
 
+gre_flat_remote_change()
+{
+       flat_remote_change
+
+       test_traffic_ip4ip6 "GRE flat IPv4-in-IPv6 with ikey/okey (new remote)"
+       test_traffic_ip6ip6 "GRE flat IPv6-in-IPv6 with ikey/okey (new remote)"
+
+       flat_remote_restore
+
+       test_traffic_ip4ip6 "GRE flat IPv4-in-IPv6 with ikey/okey (old remote)"
+       test_traffic_ip6ip6 "GRE flat IPv6-in-IPv6 with ikey/okey (old remote)"
+}
+
 cleanup()
 {
        pre_cleanup
index 83b55c30a5c359b2df4e73e35ce2613201338ba0..e0844495f3d1cf435d3b0736b5bf8ab58c6595c0 100755 (executable)
@@ -8,6 +8,7 @@
 ALL_TESTS="
        gre_hier
        gre_mtu_change
+       gre_hier_remote_change
 "
 
 NUM_NETIFS=6
@@ -44,6 +45,19 @@ gre_mtu_change()
        test_mtu_change gre
 }
 
+gre_hier_remote_change()
+{
+       hier_remote_change
+
+       test_traffic_ip4ip6 "GRE hierarchical IPv4-in-IPv6 (new remote)"
+       test_traffic_ip6ip6 "GRE hierarchical IPv6-in-IPv6 (new remote)"
+
+       hier_remote_restore
+
+       test_traffic_ip4ip6 "GRE hierarchical IPv4-in-IPv6 (old remote)"
+       test_traffic_ip6ip6 "GRE hierarchical IPv6-in-IPv6 (old remote)"
+}
+
 cleanup()
 {
        pre_cleanup
index 256607916d92f43084530d8d143e7c781a4b887d..741bc9c928eb2c15d54a65770c1e2b95d8b11a4e 100755 (executable)
@@ -8,6 +8,7 @@
 ALL_TESTS="
        gre_hier
        gre_mtu_change
+       gre_hier_remote_change
 "
 
 NUM_NETIFS=6
@@ -44,6 +45,19 @@ gre_mtu_change()
        test_mtu_change gre
 }
 
+gre_hier_remote_change()
+{
+       hier_remote_change
+
+       test_traffic_ip4ip6 "GRE hierarchical IPv4-in-IPv6 with key (new remote)"
+       test_traffic_ip6ip6 "GRE hierarchical IPv6-in-IPv6 with key (new remote)"
+
+       hier_remote_restore
+
+       test_traffic_ip4ip6 "GRE hierarchical IPv4-in-IPv6 with key (old remote)"
+       test_traffic_ip6ip6 "GRE hierarchical IPv6-in-IPv6 with key (old remote)"
+}
+
 cleanup()
 {
        pre_cleanup
index ad1bcd6334a80b46f2f69e979ca393fb7dfde31a..ad9eab4b1367bce04270472d20e52c2cc2a68b8f 100755 (executable)
@@ -8,6 +8,7 @@
 ALL_TESTS="
        gre_hier
        gre_mtu_change
+       gre_hier_remote_change
 "
 
 NUM_NETIFS=6
@@ -44,6 +45,19 @@ gre_mtu_change()
        test_mtu_change gre
 }
 
+gre_hier_remote_change()
+{
+       hier_remote_change
+
+       test_traffic_ip4ip6 "GRE hierarchical IPv4-in-IPv6 with ikey/okey (new remote)"
+       test_traffic_ip6ip6 "GRE hierarchical IPv6-in-IPv6 with ikey/okey (new remote)"
+
+       hier_remote_restore
+
+       test_traffic_ip4ip6 "GRE hierarchical IPv4-in-IPv6 with ikey/okey (old remote)"
+       test_traffic_ip6ip6 "GRE hierarchical IPv6-in-IPv6 with ikey/okey (old remote)"
+}
+
 cleanup()
 {
        pre_cleanup
index 24f4ab328bd2de7267eca7c66e25f86324e612c4..2d91281dc5b7765e70cc9ea1e094ff1283bb465b 100644 (file)
@@ -436,3 +436,83 @@ test_mtu_change()
        check_err $?
        log_test "ping GRE IPv6, packet size 1800 after MTU change"
 }
+
+topo_flat_remote_change()
+{
+       local old1=$1; shift
+       local new1=$1; shift
+       local old2=$1; shift
+       local new2=$1; shift
+
+       ip link set dev g1a type ip6gre local $new1 remote $new2
+        __addr_add_del g1a add "$new1/128"
+        __addr_add_del g1a del "$old1/128"
+       ip -6 route add $new2/128 via 2001:db8:10::2
+       ip -6 route del $old2/128
+
+       ip link set dev g2a type ip6gre local $new2 remote $new1
+        __addr_add_del g2a add "$new2/128"
+        __addr_add_del g2a del "$old2/128"
+       ip -6 route add vrf v$ol2 $new1/128 via 2001:db8:10::1
+       ip -6 route del vrf v$ol2 $old1/128
+}
+
+flat_remote_change()
+{
+       local old1=2001:db8:3::1
+       local new1=2001:db8:3::10
+       local old2=2001:db8:3::2
+       local new2=2001:db8:3::20
+
+       topo_flat_remote_change $old1 $new1 $old2 $new2
+}
+
+flat_remote_restore()
+{
+       local old1=2001:db8:3::10
+       local new1=2001:db8:3::1
+       local old2=2001:db8:3::20
+       local new2=2001:db8:3::2
+
+       topo_flat_remote_change $old1 $new1 $old2 $new2
+}
+
+topo_hier_remote_change()
+{
+       local old1=$1; shift
+       local new1=$1; shift
+       local old2=$1; shift
+       local new2=$1; shift
+
+        __addr_add_del dummy1 del "$old1/64"
+        __addr_add_del dummy1 add "$new1/64"
+       ip link set dev g1a type ip6gre local $new1 remote $new2
+       ip -6 route add vrf v$ul1 $new2/128 via 2001:db8:10::2
+       ip -6 route del vrf v$ul1 $old2/128
+
+        __addr_add_del dummy2 del "$old2/64"
+        __addr_add_del dummy2 add "$new2/64"
+       ip link set dev g2a type ip6gre local $new2 remote $new1
+       ip -6 route add vrf v$ul2 $new1/128 via 2001:db8:10::1
+       ip -6 route del vrf v$ul2 $old1/128
+}
+
+hier_remote_change()
+{
+       local old1=2001:db8:3::1
+       local new1=2001:db8:3::10
+       local old2=2001:db8:3::2
+       local new2=2001:db8:3::20
+
+       topo_hier_remote_change $old1 $new1 $old2 $new2
+}
+
+hier_remote_restore()
+{
+       local old1=2001:db8:3::10
+       local new1=2001:db8:3::1
+       local old2=2001:db8:3::20
+       local new2=2001:db8:3::2
+
+       topo_hier_remote_change $old1 $new1 $old2 $new2
+}