#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.11 2000-09-29 04:58:37 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.17 2000-12-12 09:58:41 itojun Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include <sys/types.h>
#include <sys/socket.h>
-#include <net/route.h>
-
#include <netinet/in.h>
#ifdef HAVE_LIBCRYPTO
#include <stdio.h>
+#include "ip.h"
+#include "esp.h"
#ifdef INET6
-#include <netinet/ip6.h>
+#include "ip6.h"
#endif
-#include "ip.h"
-
-/* there's no standard definition so we are on our own */
-struct esp {
- u_int32_t esp_spi; /* ESP */
- /*variable size, 32bit bound*/ /* Initialization Vector */
- /*variable size*/ /* Payload data */
- /*variable size*/ /* padding */
- /*8bit*/ /* pad size */
- /*8bit*/ /* next header */
- /*8bit*/ /* next header */
- /*variable size, 32bit bound*/ /* Authentication data (new IPsec) */
-};
-
-struct newesp {
- u_int32_t esp_spi; /* ESP */
- u_int32_t esp_seq; /* Sequence number */
- /*variable size*/ /* (IV and) Payload data */
- /*variable size*/ /* padding */
- /*8bit*/ /* pad size */
- /*8bit*/ /* next header */
- /*8bit*/ /* next header */
- /*variable size, 32bit bound*/ /* Authentication data */
-};
-
#include "interface.h"
#include "addrtoname.h"
esp = (struct esp *)bp;
spi = (u_int32_t)ntohl(esp->esp_spi);
- /* 'ep' points to the end of avaible data. */
+ /* 'ep' points to the end of available data. */
ep = snapend;
if ((u_char *)(esp + 1) >= ep - sizeof(struct esp)) {
fputs("[|ESP]", stdout);
goto fail;
}
- printf("ESP(spi=%u", spi);
+ printf("ESP(spi=0x%08x", spi);
printf(",seq=0x%x", (u_int32_t)ntohl(*(u_int32_t *)(esp + 1)));
printf(")");
}
ip = (struct ip *)bp2;
- switch (ip->ip_v) {
+ switch (IP_V(ip)) {
#ifdef INET6
case 6:
ip6 = (struct ip6_hdr *)bp2;