コード例 #1
0
ファイル: translate_packet_test.c プロジェクト: magg/NAT64
int init_module(void)
{
	START_TESTS("Translating the Packet");

	if (is_error(translate_packet_init()))
		return -EINVAL;

	/* Misc single function tests */
	CALL_TEST(test_function_has_unexpired_src_route(), "Unexpired source route querier");
	CALL_TEST(test_function_build_id_field(), "Identification builder");
	CALL_TEST(test_function_icmp6_minimum_mtu(), "ICMP6 Minimum MTU function");
	CALL_TEST(test_function_icmp4_to_icmp6_param_prob(), "Param problem function");

	CALL_TEST(test_function_generate_ipv4_id_nofrag(), "Generate id function (no frag)");
	CALL_TEST(test_function_generate_df_flag(), "Generate DF flag function");
	CALL_TEST(test_function_build_protocol_field(), "Build protocol function");
	CALL_TEST(test_function_has_nonzero_segments_left(), "Segments left indicator function");
	CALL_TEST(test_function_generate_ipv4_id_dofrag(), "Generate id function (frag)");
	CALL_TEST(test_function_icmp4_minimum_mtu(), "ICMP4 Minimum MTU function");

	/* Full packet translation tests */
	CALL_TEST(test_4to6_udp(), "Full translation, 4->6 UDP");
	CALL_TEST(test_4to6_tcp(), "Full translation, 4->6 TCP");
	CALL_TEST(test_4to6_icmp_info(), "Full translation, 4->6 ICMP info");
	CALL_TEST(test_4to6_icmp_error(), "Full translation, 4->6 ICMP error");
	CALL_TEST(test_4to6frag_tcp(), "Full Fragments, 4->6 TCP");
	CALL_TEST(test_4to6frag_udp(), "Full Fragments, 4->6 UDP");
	CALL_TEST(test_4to6frag_icmp(), "Full Fragments, 4->6 ICMP");

	CALL_TEST(test_6to4_udp(), "Full translation, 6->4 UDP");
	CALL_TEST(test_6to4_tcp(), "Full translation, 6->4 TCP");
	CALL_TEST(test_6to4_icmp_info(), "Full translation, 6->4 ICMP info");
	CALL_TEST(test_6to4_icmp_error(), "Full translation, 6->4 ICMP error");
	CALL_TEST(test_6to4frag_tcp(), "Full Fragments, 6->4 TCP");
	CALL_TEST(test_6to4frag_udp(), "Full Fragments, 6->4 UDP");
	CALL_TEST(test_6to4frag_icmp(), "Full Fragments, 6->4 ICMP");

	/* TODO (test) still need to test zero IPv4-UDP checksums. I think that's all. */

	translate_packet_destroy();

	END_TESTS;
}
コード例 #2
0
int init_module(void)
{
	START_TESTS("Translating the Packet");

	if (config_init(&config))
		return false;

	/* Misc single function tests */
	CALL_TEST(test_function_has_unexpired_src_route(), "Unexpired source route querier");
	CALL_TEST(test_function_build_id_field(), "Identification builder");
	CALL_TEST(test_function_icmp6_minimum_mtu(), "ICMP6 Minimum MTU function");
	CALL_TEST(test_function_icmp4_to_icmp6_param_prob(), "Param problem function");

	CALL_TEST(test_function_generate_ipv4_id(), "Generate id function");
	CALL_TEST(test_function_generate_df_flag(), "Generate DF flag function");
	CALL_TEST(test_function_build_protocol_field(), "Build protocol function");
	CALL_TEST(test_function_has_nonzero_segments_left(), "Segments left indicator function");
	CALL_TEST(test_function_icmp4_minimum_mtu(), "ICMP4 Minimum MTU function");

	config_put(config);

	END_TESTS;
}