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.

Dependency Surface

Detected Declarations

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

Implementation Notes