int __init filtering_test_init(void) { START_TESTS("Filtering and Updating"); log_debug("\n\n\n"); log_debug("\n\nNAT64 %s TEST module inserted!", "filtering_test"); // Initialize the NAT configuration for the tests. if ( !config_init() ) return -EINVAL; /* UDP & ICMP */ CALL_TEST(test_transport_address_ipv4(), "test_transport_address_ipv4"); CALL_TEST(test_transport_address_ipv6(), "test_transport_address_ipv6"); CALL_TEST(test_extract_ipv4_from_ipv6(), "test_extract_ipv4_from_ipv6"); CALL_TEST(test_embed_ipv4_in_ipv6(), "test_embed_ipv4_in_ipv6"); CALL_TEST(test_allocate_ipv4_transport_address(), "test_allocate_ipv4_transport_address"); CALL_TEST(test_allocate_ipv4_transport_address_digger(), "test_allocate_ipv4_transport_address_digger"); INIT_CALL_END(init_full(), test_ipv6_udp(), end_full(), "test_ipv6_udp"); INIT_CALL_END(init_full(), test_ipv4_udp(), end_full(), "test_ipv4_udp"); INIT_CALL_END(init_full(), test_ipv6_icmp6(), end_full(), "test_ipv6_icmp6"); INIT_CALL_END(init_full(), test_ipv4_icmp4(), end_full(), "test_ipv4_icmp4"); //~ CALL_TEST(test_send_icmp_error_message(), "test_send_icmp_error_message"); // Not implemented yet! INIT_CALL_END(init_full(), test_filtering_and_updating(), end_full(), "test_filtering_and_updating"); /* TCP */ CALL_TEST(test_packet_is_ipv4(), "test_packet_is_ipv4"); CALL_TEST(test_packet_is_ipv6(), "test_packet_is_ipv6"); CALL_TEST(test_packet_is_v4_syn(), "test_packet_is_v4_syn"); CALL_TEST(test_packet_is_v6_syn(), "test_packet_is_v6_syn"); CALL_TEST(test_packet_is_v4_fin(), "test_packet_is_v4_fin"); CALL_TEST(test_packet_is_v6_fin(), "test_packet_is_v6_fin"); CALL_TEST(test_packet_is_v4_rst(), "test_packet_is_v4_rst"); CALL_TEST(test_packet_is_v6_rst(), "test_packet_is_v6_rst"); CALL_TEST(test_send_probe_packet(), "test_send_probe_packet"); INIT_CALL_END(init_full(), test_tcp_closed_state_handle_6(), end_full(), "test_tcp_closed_state_handle_6"); INIT_CALL_END(init_full(), test_tcp_closed_state_handle_4(), end_full(), "test_tcp_closed_state_handle_4"); CALL_TEST(test_tcp_v4_init_state_handle(), "test_tcp_v4_init_state_handle"); CALL_TEST(test_tcp_v6_init_state_handle(), "test_tcp_v6_init_state_handle"); CALL_TEST(test_tcp_established_state_handle(), "test_tcp_established_state_handle"); CALL_TEST(test_tcp_v4_fin_rcv_state_handle(), "test_tcp_v4_fin_rcv_state_handle"); CALL_TEST(test_tcp_v6_fin_rcv_state_handle(), "test_tcp_v6_fin_rcv_state_handle"); CALL_TEST(test_tcp_trans_state_handle(), "test_tcp_trans_state_handle"); INIT_CALL_END(init_full(), test_tcp(), end_full(), "test_tcp"); config_destroy(); /* A non 0 return means a test failed; module can't be loaded. */ END_TESTS; }
static bool init(void) { if (is_error(fragdb_init())) goto fragdb_fail; if (!init_full()) goto initfull_fail; if (!bib_inject_str(SERVER_ADDR6, SERVER_PORT6, NAT64_POOL4, SERVER_PORT6, L4PROTO_UDP)) goto inject_fail; if (!bib_inject_str(SERVER_ADDR6, SERVER_PORT6, NAT64_POOL4, SERVER_PORT6, L4PROTO_TCP)) goto inject_fail; if (!bib_inject_str(SERVER_ADDR6, SERVER_PORT6, NAT64_POOL4, SERVER_PORT6, L4PROTO_ICMP)) goto inject_fail; return true; inject_fail: end_full(); initfull_fail: fragdb_destroy(); fragdb_fail: return false; }
static void deinit(void) { end_full(); fragdb_destroy(); }