예제 #1
0
u_int
enc_if_print(const struct pcap_pkthdr *h, register const u_char *p)
{
	register u_int length = h->len;
	register u_int caplen = h->caplen;
	int flags;
	const struct enchdr *hdr;

	if (caplen < ENC_HDRLEN) {
		printf("[|enc]");
		goto out;
	}

	hdr = (struct enchdr *)p;
	flags = hdr->flags;
	if (flags == 0)
		printf("(unprotected): ");
	else
		printf("(");
	ENC_PRINT_TYPE(flags, M_AUTH, "authentic");
	ENC_PRINT_TYPE(flags, M_CONF, "confidential");
	
	printf("SPI 0x%08x: ", (u_int32_t)ntohl(hdr->spi));

	length -= ENC_HDRLEN;
	
	ip_print(gndo, p + ENC_HDRLEN, length);

out:
	return (ENC_HDRLEN);
}
예제 #2
0
u_int
enc_if_print(const struct pcap_pkthdr *h, packetbody_t p)
{
	register u_int length = h->len;
	register u_int caplen = h->caplen;
	int flags;
	__capability const struct enchdr *hdr;

	if (caplen < ENC_HDRLEN) {
		printf("[|enc]");
		goto out;
	}

	hdr = (__capability struct enchdr *)p;
	flags = hdr->flags;
	if (flags == 0)
		printf("(unprotected): ");
	else
		printf("(");
	ENC_PRINT_TYPE(flags, M_AUTH, "authentic");
	ENC_PRINT_TYPE(flags, M_CONF, "confidential");
	/* ENC_PRINT_TYPE(flags, M_TUNNEL, "tunnel"); */
	printf("SPI 0x%08x: ", EXTRACT_32BITS(&hdr->spi));

	length -= ENC_HDRLEN;
	caplen -= ENC_HDRLEN;
	p += ENC_HDRLEN;
	
	switch (hdr->af) {
	case AF_INET:
		ip_print(gndo, p, length);
		break;
#ifdef INET6
	case AF_INET6:
		ip6_print(gndo, p, length);
		break;
#endif /*INET6*/
	}

out:
	return (ENC_HDRLEN);
}