tools/testing/selftests/bpf/prog_tests/test_tunnel.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/prog_tests/test_tunnel.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/prog_tests/test_tunnel.c- Extension
.c- Size
- 29892 bytes
- Lines
- 1075
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
arpa/inet.hlinux/if_link.hlinux/if_tun.hlinux/limits.hlinux/sysctl.hlinux/time_types.hlinux/net_tstamp.hnet/if.hstdbool.hstdio.hsys/stat.hunistd.htest_progs.hnetwork_helpers.htest_tunnel_kern.skel.h
Detected Declarations
enum ipip_encapenum gre_testenum ip6gre_testenum erspan_testenum ip6tnl_testfunction config_devicefunction cleanupfunction add_vxlan_tunnelfunction delete_vxlan_tunnelfunction add_ip6vxlan_tunnelfunction delete_ip6vxlan_tunnelfunction set_ipip_encapfunction set_ipv4_addrfunction add_ipip_tunnelfunction delete_ipip_tunnelfunction add_xfrm_tunnelfunction delete_xfrm_tunnelfunction add_ipv4_tunnelfunction delete_tunnelfunction set_ipv6_addrfunction add_ipv6_tunnelfunction add_geneve_tunnelfunction add_ip6geneve_tunnelfunction test_pingfunction ping_dev0function ping_dev1function ping6_veth0function ping6_dev0function ping6_dev1function test_vxlan_tunnelfunction test_ip6vxlan_tunnelfunction test_ipip_tunnelfunction test_xfrm_tunnelfunction test_gre_tunnelfunction test_ip6gre_tunnelfunction test_erspan_tunnelfunction test_ip6erspan_tunnelfunction test_geneve_tunnelfunction test_ip6geneve_tunnelfunction test_ip6tnl_tunnelfunction test_tunnel
Annotated Snippet
if (test__start_subtest(#name)) { \
config_device(); \
test_ ## name(__VA_ARGS__); \
cleanup(); \
} \
})
static void *test_tunnel_run_tests(void *arg)
{
RUN_TEST(vxlan_tunnel);
RUN_TEST(ip6vxlan_tunnel);
RUN_TEST(ipip_tunnel, NONE);
RUN_TEST(ipip_tunnel, FOU);
RUN_TEST(ipip_tunnel, GUE);
RUN_TEST(xfrm_tunnel);
RUN_TEST(gre_tunnel, GRE);
RUN_TEST(gre_tunnel, GRE_NOKEY);
RUN_TEST(gre_tunnel, GRETAP);
RUN_TEST(gre_tunnel, GRETAP_NOKEY);
RUN_TEST(ip6gre_tunnel, IP6GRE);
RUN_TEST(ip6gre_tunnel, IP6GRETAP);
RUN_TEST(erspan_tunnel, V1);
RUN_TEST(erspan_tunnel, V2);
RUN_TEST(ip6erspan_tunnel, V1);
RUN_TEST(ip6erspan_tunnel, V2);
RUN_TEST(geneve_tunnel);
RUN_TEST(ip6geneve_tunnel);
RUN_TEST(ip6tnl_tunnel, IPIP6);
RUN_TEST(ip6tnl_tunnel, IP6IP6);
return NULL;
}
void test_tunnel(void)
{
pthread_t test_thread;
int err;
/* Run the tests in their own thread to isolate the namespace changes
* so they do not affect the environment of other tests.
* (specifically needed because of unshare(CLONE_NEWNS) in open_netns())
*/
err = pthread_create(&test_thread, NULL, &test_tunnel_run_tests, NULL);
if (ASSERT_OK(err, "pthread_create"))
ASSERT_OK(pthread_join(test_thread, NULL), "pthread_join");
}
Annotation
- Immediate include surface: `arpa/inet.h`, `linux/if_link.h`, `linux/if_tun.h`, `linux/limits.h`, `linux/sysctl.h`, `linux/time_types.h`, `linux/net_tstamp.h`, `net/if.h`.
- Detected declarations: `enum ipip_encap`, `enum gre_test`, `enum ip6gre_test`, `enum erspan_test`, `enum ip6tnl_test`, `function config_device`, `function cleanup`, `function add_vxlan_tunnel`, `function delete_vxlan_tunnel`, `function add_ip6vxlan_tunnel`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.