static int init_test_module(void)
{
	START_TESTS("Handling Hairpinning");

	if (!init())
		return -EINVAL;

	/*
	 * Well, the only thing not being tested here, I think, is hairpinning not getting in the way
	 * when there's no need for it.
	 * But that's handled in every other test, ever.
	 */

	CALL_TEST(test_hairpin(L4PROTO_UDP, create_skb6_udp), "UDP");
	CALL_TEST(test_hairpin(L4PROTO_TCP, create_skb6_tcp), "TCP");
	CALL_TEST(test_icmp(), "ICMP");

	deinit();

	END_TESTS;
}
Esempio n. 2
0
int
main(void)
{
	static const char *pcap_files[] = {
		"../../sample/icmp.pcap",
		"../../sample/tcp.pcap",
		"../../sample/udp.pcap",
		"../../sample/tcp6.pcap",
		"../../sample/udp6.pcap",
	};

	pout("peak packet test suite... ");

	/* make sure this is always aligned to 8 bytes */
	assert(!(sizeof(struct peak_packet) % sizeof(uint64_t)));

	memset(&net_saddr4, 0, sizeof(net_saddr4));
	memset(&net_daddr4, 0, sizeof(net_daddr4));
	memset(&net_saddr6, 0, sizeof(net_saddr6));
	memset(&net_daddr6, 0, sizeof(net_daddr6));

	netaddr4(&net_saddr4, be32dec(&src_ip4));
	netaddr4(&net_daddr4, be32dec(&dst_ip4));
	netaddr6(&net_saddr6, src_ip6);
	netaddr6(&net_daddr6, dst_ip6);

	test_icmp(pcap_files[0]);
	test_transport_ip4(pcap_files[1]); /* TCP over IPv4 */
	test_transport_ip4(pcap_files[2]); /* UDP over IPv4 */
	test_transport_ip6(pcap_files[3]); /* TCP over IPv6 */
	test_transport_ip6(pcap_files[4]); /* UDP over IPv6 */

	pout("ok\n");

	return (0);
}