Lines Matching +full:1 +full:- +full:6
1 // SPDX-License-Identifier: GPL-2.0-only
3 /* Connects 6 network namespaces through veths.
7 * lo veth1 <-> veth2 veth3 <-> veth4 veth5 <-> veth6 lo veth7 <-> veth8 veth9 <-> veth10 lo
8 * fb00 ::1 ::12 ::21 ::34 ::43 ::56 ::65 ::78 ::87 ::910 ::109 ::6
10 * fc42 ::1
14 * fd00::1 -> fd00::2 -> fd00::3 -> fd00::4
17 * - fd00::1 : add a TLV, change the flags and apply a End.X action to fc42::1
18 * - fd00::2 : remove the TLV, change the flags, add a tag
19 * - fd00::3 : apply an End.T action to fd00::4, through routing table 117
25 * An UDP datagram is sent from fb00::1 to fb00::6. The test succeeds if this
26 * datagram can be read on NS6 when binding to fb00::6.
32 #define NETNS_BASE "lwt-seg6local-"
39 for (ns = 1; ns < 7; ns++) in cleanup()
47 for (ns = 1; ns < 7; ns++) in setup()
50 SYS(fail, "ip -n %s6 link set dev lo up", NETNS_BASE); in setup()
52 for (ns = 1; ns < 6; ns++) { in setup()
53 int local_id = ns * 2 - 1; in setup()
55 int next_ns = ns + 1; in setup()
57 SYS(fail, "ip -n %s%d link add veth%d type veth peer name veth%d netns %s%d", in setup()
60 SYS(fail, "ip -n %s%d link set dev veth%d up", NETNS_BASE, ns, local_id); in setup()
61 SYS(fail, "ip -n %s%d link set dev veth%d up", NETNS_BASE, next_ns, peer_id); in setup()
64 SYS(fail, "ip -n %s%d -6 addr add fb00::%d%d/16 dev veth%d scope link", in setup()
66 SYS(fail, "ip -n %s%d -6 addr add fb00::%d%d/16 dev veth%d scope link", in setup()
71 SYS(fail, "ip -n %s5 -6 route add fb00::109 table 117 dev veth9 scope link", NETNS_BASE); in setup()
73 SYS(fail, "ip -n %s1 -6 addr add fb00::1/16 dev lo", NETNS_BASE); in setup()
74 SYS(fail, "ip -n %s1 -6 route add fb00::6 dev veth1 via fb00::21", NETNS_BASE); in setup()
76 SYS(fail, "ip -n %s2 -6 route add fb00::6 encap bpf in obj %s sec encap_srh dev veth2", in setup()
78 SYS(fail, "ip -n %s2 -6 route add fd00::1 dev veth3 via fb00::43 scope link", NETNS_BASE); in setup()
80 SYS(fail, "ip -n %s3 -6 route add fc42::1 dev veth5 via fb00::65", NETNS_BASE); in setup()
82 …"ip -n %s3 -6 route add fd00::1 encap seg6local action End.BPF endpoint obj %s sec add_egr_x dev v… in setup()
86 …"ip -n %s4 -6 route add fd00::2 encap seg6local action End.BPF endpoint obj %s sec pop_egr dev vet… in setup()
88 SYS(fail, "ip -n %s4 -6 addr add fc42::1 dev lo", NETNS_BASE); in setup()
89 SYS(fail, "ip -n %s4 -6 route add fd00::3 dev veth7 via fb00::87", NETNS_BASE); in setup()
91 SYS(fail, "ip -n %s5 -6 route add fd00::4 table 117 dev veth9 via fb00::109", NETNS_BASE); in setup()
93 …"ip -n %s5 -6 route add fd00::3 encap seg6local action End.BPF endpoint obj %s sec inspect_t dev v… in setup()
96 SYS(fail, "ip -n %s6 -6 addr add fb00::6/16 dev lo", NETNS_BASE); in setup()
97 SYS(fail, "ip -n %s6 -6 addr add fd00::4/16 dev lo", NETNS_BASE); in setup()
99 for (ns = 1; ns < 6; ns++) in setup()
100 SYS(fail, "ip netns exec %s%d sysctl -wq net.ipv6.conf.all.forwarding=1", in setup()
103 SYS(fail, "ip netns exec %s6 sysctl -wq net.ipv6.conf.all.seg6_enabled=1", NETNS_BASE); in setup()
104 SYS(fail, "ip netns exec %s6 sysctl -wq net.ipv6.conf.lo.seg6_enabled=1", NETNS_BASE); in setup()
105 SYS(fail, "ip netns exec %s6 sysctl -wq net.ipv6.conf.veth10.seg6_enabled=1", NETNS_BASE); in setup()
109 return -1; in setup()
117 const char *ns1 = NETNS_BASE "1"; in test_lwt_seg6local()
118 const char *ns6 = NETNS_BASE "6"; in test_lwt_seg6local()
132 sfd = start_server_str(AF_INET6, SOCK_DGRAM, "fb00::6", SERVER_PORT, NULL); in test_lwt_seg6local()
142 cfd = start_server_str(AF_INET6, SOCK_DGRAM, "fb00::1", CLIENT_PORT, NULL); in test_lwt_seg6local()
152 if (!ASSERT_EQ(inet_pton(AF_INET6, "fb00::6", &server_addr.sin6_addr), 1, in test_lwt_seg6local()