Skip to content

Commit d7bd61f

Browse files
idoschkuba-moo
authored andcommitted
selftests: forwarding: Add IPv6 GRE remote change tests
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 <[email protected]> Reviewed-by: Petr Machata <[email protected]> Signed-off-by: Petr Machata <[email protected]> Link: https://patch.msgid.link/02b05246d2cdada0cf2fccffc0faa8a424d0f51b.1729866134.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 12ae97c commit d7bd61f

File tree

7 files changed

+164
-0
lines changed

7 files changed

+164
-0
lines changed

tools/testing/selftests/net/forwarding/ip6gre_flat.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
ALL_TESTS="
99
gre_flat
1010
gre_mtu_change
11+
gre_flat_remote_change
1112
"
1213

1314
NUM_NETIFS=6
@@ -44,6 +45,19 @@ gre_mtu_change()
4445
test_mtu_change
4546
}
4647

48+
gre_flat_remote_change()
49+
{
50+
flat_remote_change
51+
52+
test_traffic_ip4ip6 "GRE flat IPv4-in-IPv6 (new remote)"
53+
test_traffic_ip6ip6 "GRE flat IPv6-in-IPv6 (new remote)"
54+
55+
flat_remote_restore
56+
57+
test_traffic_ip4ip6 "GRE flat IPv4-in-IPv6 (old remote)"
58+
test_traffic_ip6ip6 "GRE flat IPv6-in-IPv6 (old remote)"
59+
}
60+
4761
cleanup()
4862
{
4963
pre_cleanup

tools/testing/selftests/net/forwarding/ip6gre_flat_key.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
ALL_TESTS="
99
gre_flat
1010
gre_mtu_change
11+
gre_flat_remote_change
1112
"
1213

1314
NUM_NETIFS=6
@@ -44,6 +45,19 @@ gre_mtu_change()
4445
test_mtu_change
4546
}
4647

48+
gre_flat_remote_change()
49+
{
50+
flat_remote_change
51+
52+
test_traffic_ip4ip6 "GRE flat IPv4-in-IPv6 with key (new remote)"
53+
test_traffic_ip6ip6 "GRE flat IPv6-in-IPv6 with key (new remote)"
54+
55+
flat_remote_restore
56+
57+
test_traffic_ip4ip6 "GRE flat IPv4-in-IPv6 with key (old remote)"
58+
test_traffic_ip6ip6 "GRE flat IPv6-in-IPv6 with key (old remote)"
59+
}
60+
4761
cleanup()
4862
{
4963
pre_cleanup

tools/testing/selftests/net/forwarding/ip6gre_flat_keys.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
ALL_TESTS="
99
gre_flat
1010
gre_mtu_change
11+
gre_flat_remote_change
1112
"
1213

1314
NUM_NETIFS=6
@@ -44,6 +45,19 @@ gre_mtu_change()
4445
test_mtu_change gre
4546
}
4647

48+
gre_flat_remote_change()
49+
{
50+
flat_remote_change
51+
52+
test_traffic_ip4ip6 "GRE flat IPv4-in-IPv6 with ikey/okey (new remote)"
53+
test_traffic_ip6ip6 "GRE flat IPv6-in-IPv6 with ikey/okey (new remote)"
54+
55+
flat_remote_restore
56+
57+
test_traffic_ip4ip6 "GRE flat IPv4-in-IPv6 with ikey/okey (old remote)"
58+
test_traffic_ip6ip6 "GRE flat IPv6-in-IPv6 with ikey/okey (old remote)"
59+
}
60+
4761
cleanup()
4862
{
4963
pre_cleanup

tools/testing/selftests/net/forwarding/ip6gre_hier.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
ALL_TESTS="
99
gre_hier
1010
gre_mtu_change
11+
gre_hier_remote_change
1112
"
1213

1314
NUM_NETIFS=6
@@ -44,6 +45,19 @@ gre_mtu_change()
4445
test_mtu_change gre
4546
}
4647

48+
gre_hier_remote_change()
49+
{
50+
hier_remote_change
51+
52+
test_traffic_ip4ip6 "GRE hierarchical IPv4-in-IPv6 (new remote)"
53+
test_traffic_ip6ip6 "GRE hierarchical IPv6-in-IPv6 (new remote)"
54+
55+
hier_remote_restore
56+
57+
test_traffic_ip4ip6 "GRE hierarchical IPv4-in-IPv6 (old remote)"
58+
test_traffic_ip6ip6 "GRE hierarchical IPv6-in-IPv6 (old remote)"
59+
}
60+
4761
cleanup()
4862
{
4963
pre_cleanup

tools/testing/selftests/net/forwarding/ip6gre_hier_key.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
ALL_TESTS="
99
gre_hier
1010
gre_mtu_change
11+
gre_hier_remote_change
1112
"
1213

1314
NUM_NETIFS=6
@@ -44,6 +45,19 @@ gre_mtu_change()
4445
test_mtu_change gre
4546
}
4647

48+
gre_hier_remote_change()
49+
{
50+
hier_remote_change
51+
52+
test_traffic_ip4ip6 "GRE hierarchical IPv4-in-IPv6 with key (new remote)"
53+
test_traffic_ip6ip6 "GRE hierarchical IPv6-in-IPv6 with key (new remote)"
54+
55+
hier_remote_restore
56+
57+
test_traffic_ip4ip6 "GRE hierarchical IPv4-in-IPv6 with key (old remote)"
58+
test_traffic_ip6ip6 "GRE hierarchical IPv6-in-IPv6 with key (old remote)"
59+
}
60+
4761
cleanup()
4862
{
4963
pre_cleanup

tools/testing/selftests/net/forwarding/ip6gre_hier_keys.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
ALL_TESTS="
99
gre_hier
1010
gre_mtu_change
11+
gre_hier_remote_change
1112
"
1213

1314
NUM_NETIFS=6
@@ -44,6 +45,19 @@ gre_mtu_change()
4445
test_mtu_change gre
4546
}
4647

48+
gre_hier_remote_change()
49+
{
50+
hier_remote_change
51+
52+
test_traffic_ip4ip6 "GRE hierarchical IPv4-in-IPv6 with ikey/okey (new remote)"
53+
test_traffic_ip6ip6 "GRE hierarchical IPv6-in-IPv6 with ikey/okey (new remote)"
54+
55+
hier_remote_restore
56+
57+
test_traffic_ip4ip6 "GRE hierarchical IPv4-in-IPv6 with ikey/okey (old remote)"
58+
test_traffic_ip6ip6 "GRE hierarchical IPv6-in-IPv6 with ikey/okey (old remote)"
59+
}
60+
4761
cleanup()
4862
{
4963
pre_cleanup

tools/testing/selftests/net/forwarding/ip6gre_lib.sh

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,3 +436,83 @@ test_mtu_change()
436436
check_err $?
437437
log_test "ping GRE IPv6, packet size 1800 after MTU change"
438438
}
439+
440+
topo_flat_remote_change()
441+
{
442+
local old1=$1; shift
443+
local new1=$1; shift
444+
local old2=$1; shift
445+
local new2=$1; shift
446+
447+
ip link set dev g1a type ip6gre local $new1 remote $new2
448+
__addr_add_del g1a add "$new1/128"
449+
__addr_add_del g1a del "$old1/128"
450+
ip -6 route add $new2/128 via 2001:db8:10::2
451+
ip -6 route del $old2/128
452+
453+
ip link set dev g2a type ip6gre local $new2 remote $new1
454+
__addr_add_del g2a add "$new2/128"
455+
__addr_add_del g2a del "$old2/128"
456+
ip -6 route add vrf v$ol2 $new1/128 via 2001:db8:10::1
457+
ip -6 route del vrf v$ol2 $old1/128
458+
}
459+
460+
flat_remote_change()
461+
{
462+
local old1=2001:db8:3::1
463+
local new1=2001:db8:3::10
464+
local old2=2001:db8:3::2
465+
local new2=2001:db8:3::20
466+
467+
topo_flat_remote_change $old1 $new1 $old2 $new2
468+
}
469+
470+
flat_remote_restore()
471+
{
472+
local old1=2001:db8:3::10
473+
local new1=2001:db8:3::1
474+
local old2=2001:db8:3::20
475+
local new2=2001:db8:3::2
476+
477+
topo_flat_remote_change $old1 $new1 $old2 $new2
478+
}
479+
480+
topo_hier_remote_change()
481+
{
482+
local old1=$1; shift
483+
local new1=$1; shift
484+
local old2=$1; shift
485+
local new2=$1; shift
486+
487+
__addr_add_del dummy1 del "$old1/64"
488+
__addr_add_del dummy1 add "$new1/64"
489+
ip link set dev g1a type ip6gre local $new1 remote $new2
490+
ip -6 route add vrf v$ul1 $new2/128 via 2001:db8:10::2
491+
ip -6 route del vrf v$ul1 $old2/128
492+
493+
__addr_add_del dummy2 del "$old2/64"
494+
__addr_add_del dummy2 add "$new2/64"
495+
ip link set dev g2a type ip6gre local $new2 remote $new1
496+
ip -6 route add vrf v$ul2 $new1/128 via 2001:db8:10::1
497+
ip -6 route del vrf v$ul2 $old1/128
498+
}
499+
500+
hier_remote_change()
501+
{
502+
local old1=2001:db8:3::1
503+
local new1=2001:db8:3::10
504+
local old2=2001:db8:3::2
505+
local new2=2001:db8:3::20
506+
507+
topo_hier_remote_change $old1 $new1 $old2 $new2
508+
}
509+
510+
hier_remote_restore()
511+
{
512+
local old1=2001:db8:3::10
513+
local new1=2001:db8:3::1
514+
local old2=2001:db8:3::20
515+
local new2=2001:db8:3::2
516+
517+
topo_hier_remote_change $old1 $new1 $old2 $new2
518+
}

0 commit comments

Comments
 (0)