Skip to content

Commit 04d752d

Browse files
idoschkuba-moo
authored andcommitted
selftests: seg6: Add test cases for End.X with link-local nexthop
In the current test topology, all the routers are connected to each other via dedicated links with addresses of the form fcf0:0:x:y::/64. The test configures rt-3 with an adjacency with rt-4 and rt-4 with an adjacency with rt-1: # ip -n rt_3-IgWSBJ -6 route show tab 90 fcbb:0:300::/48 fcbb:0:300::/48 encap seg6local action End.X nh6 fcf0:0:3:4::4 flavors next-csid lblen 32 nflen 16 dev dum0 metric 1024 pref medium # ip -n rt_4-JdCunK -6 route show tab 90 fcbb:0:400::/48 fcbb:0:400::/48 encap seg6local action End.X nh6 fcf0:0:1:4::1 flavors next-csid lblen 32 nflen 16 dev dum0 metric 1024 pref medium The routes are used when pinging hs-2 from hs-1 and vice-versa. Extend the test to also cover End.X behavior with an IPv6 link-local nexthop address and an output interface. Configure every router interface with an IPv6 link-local address of the form fe80::x:y/64 and before re-running the ping tests, replace the previous End.X routes with routes that use the new IPv6 link-local addresses: # ip -n rt_3-IgWSBJ -6 route show tab 90 fcbb:0:300::/48 fcbb:0:300::/48 encap seg6local action End.X nh6 fe80::4:3 oif veth-rt-3-4 flavors next-csid lblen 32 nflen 16 dev dum0 metric 1024 pref medium # ip -n rt_4-JdCunK -6 route show tab 90 fcbb:0:400::/48 fcbb:0:400::/48 encap seg6local action End.X nh6 fe80::1:4 oif veth-rt-4-1 flavors next-csid lblen 32 nflen 16 dev dum0 metric 1024 pref medium The new test cases fail without the previous patch ("seg6: Allow End.X behavior to accept an oif"): # ./srv6_end_x_next_csid_l3vpn_test.sh [...] ################################################################################ TEST SECTION: SRv6 VPN connectivity test hosts (h1 <-> h2, IPv6), link-local ################################################################################ TEST: IPv6 Hosts connectivity: hs-1 -> hs-2 [FAIL] TEST: IPv6 Hosts connectivity: hs-2 -> hs-1 [FAIL] ################################################################################ TEST SECTION: SRv6 VPN connectivity test hosts (h1 <-> h2, IPv4), link-local ################################################################################ TEST: IPv4 Hosts connectivity: hs-1 -> hs-2 [FAIL] TEST: IPv4 Hosts connectivity: hs-2 -> hs-1 [FAIL] Tests passed: 40 Tests failed: 4 And pass with it: # ./srv6_end_x_next_csid_l3vpn_test.sh [...] ################################################################################ TEST SECTION: SRv6 VPN connectivity test hosts (h1 <-> h2, IPv6), link-local ################################################################################ TEST: IPv6 Hosts connectivity: hs-1 -> hs-2 [ OK ] TEST: IPv6 Hosts connectivity: hs-2 -> hs-1 [ OK ] ################################################################################ TEST SECTION: SRv6 VPN connectivity test hosts (h1 <-> h2, IPv4), link-local ################################################################################ TEST: IPv4 Hosts connectivity: hs-1 -> hs-2 [ OK ] TEST: IPv4 Hosts connectivity: hs-2 -> hs-1 [ OK ] Tests passed: 44 Tests failed: 0 Without the previous patch, rt-3 and rt-4 resolve the wrong routes for the link-local nexthops, with the output interface being the input interface: # perf script [...] ping 1067 [001] 37.554486: fib6:fib6_table_lookup: table 254 oif 0 iif 11 proto 41 cafe::254/0 -> fe80::4:3/0 flowlabel 0xb7973 tos 0 scope 0 flags 2 ==> dev veth-rt-3-1 gw :: err 0 [...] ping 1069 [002] 41.573360: fib6:fib6_table_lookup: table 254 oif 0 iif 12 proto 41 cafe::254/0 -> fe80::1:4/0 flowlabel 0xb7973 tos 0 scope 0 flags 2 ==> dev veth-rt-4-2 gw :: err 0 But the correct routes are resolved with the patch: # perf script [...] ping 1066 [006] 30.672355: fib6:fib6_table_lookup: table 254 oif 13 iif 1 proto 41 cafe::254/0 -> fe80::4:3/0 flowlabel 0x85941 tos 0 scope 0 flags 6 ==> dev veth-rt-3-4 gw :: err 0 [...] ping 1066 [006] 30.672411: fib6:fib6_table_lookup: table 254 oif 11 iif 1 proto 41 cafe::254/0 -> fe80::1:4/0 flowlabel 0x91de0 tos 0 scope 0 flags 6 ==> dev veth-rt-4-1 gw :: err 0 Reviewed-by: Petr Machata <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Reviewed-by: Andrea Mayer <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent a2840d4 commit 04d752d

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

tools/testing/selftests/net/srv6_end_x_next_csid_l3vpn_test.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@
7272
# Every fcf0:0:x:y::/64 network interconnects the SRv6 routers rt-x with rt-y in
7373
# the selftest network.
7474
#
75+
# In addition, every router interface connecting rt-x to rt-y is assigned an
76+
# IPv6 link-local address fe80::x:y/64.
77+
#
7578
# Local SID/C-SID table
7679
# =====================
7780
#
@@ -521,6 +524,9 @@ setup_rt_networking()
521524
ip -netns "${nsname}" addr \
522525
add "${net_prefix}::${rt}/64" dev "${devname}" nodad
523526

527+
ip -netns "${nsname}" addr \
528+
add "fe80::${rt}:${neigh}/64" dev "${devname}" nodad
529+
524530
ip -netns "${nsname}" link set "${devname}" up
525531
done
526532

@@ -609,6 +615,27 @@ set_end_x_nextcsid()
609615
nflen "${LCNODEFUNC_BLEN}" dev "${DUMMY_DEVNAME}"
610616
}
611617

618+
set_end_x_ll_nextcsid()
619+
{
620+
local rt="$1"
621+
local adj="$2"
622+
623+
eval nsname=\${$(get_rtname "${rt}")}
624+
lcnode_func_prefix="$(build_lcnode_func_prefix "${rt}")"
625+
nh6_ll_addr="fe80::${adj}:${rt}"
626+
oifname="veth-rt-${rt}-${adj}"
627+
628+
# enabled NEXT-C-SID SRv6 End.X behavior via an IPv6 link-local nexthop
629+
# address (note that "dev" is the dummy dum0 device chosen for the sake
630+
# of simplicity).
631+
ip -netns "${nsname}" -6 route \
632+
replace "${lcnode_func_prefix}" \
633+
table "${LOCALSID_TABLE_ID}" \
634+
encap seg6local action End.X nh6 "${nh6_ll_addr}" \
635+
oif "${oifname}" flavors next-csid lblen "${LCBLOCK_BLEN}" \
636+
nflen "${LCNODEFUNC_BLEN}" dev "${DUMMY_DEVNAME}"
637+
}
638+
612639
set_underlay_sids_reachability()
613640
{
614641
local rt="$1"
@@ -1016,6 +1043,27 @@ host_vpn_tests()
10161043

10171044
check_and_log_hs_ipv4_connectivity 1 2
10181045
check_and_log_hs_ipv4_connectivity 2 1
1046+
1047+
# Setup the adjacencies in the SRv6 aware routers using IPv6 link-local
1048+
# addresses.
1049+
# - rt-3 SRv6 End.X adjacency with rt-4
1050+
# - rt-4 SRv6 End.X adjacency with rt-1
1051+
set_end_x_ll_nextcsid 3 4
1052+
set_end_x_ll_nextcsid 4 1
1053+
1054+
log_section "SRv6 VPN connectivity test hosts (h1 <-> h2, IPv6), link-local"
1055+
1056+
check_and_log_hs_ipv6_connectivity 1 2
1057+
check_and_log_hs_ipv6_connectivity 2 1
1058+
1059+
log_section "SRv6 VPN connectivity test hosts (h1 <-> h2, IPv4), link-local"
1060+
1061+
check_and_log_hs_ipv4_connectivity 1 2
1062+
check_and_log_hs_ipv4_connectivity 2 1
1063+
1064+
# Restore the previous adjacencies.
1065+
set_end_x_nextcsid 3 4
1066+
set_end_x_nextcsid 4 1
10191067
}
10201068

10211069
__nextcsid_end_x_behavior_test()

0 commit comments

Comments
 (0)