]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-esp.c
The stuff in the "linux-include" directory is no longer needed, as we no
[tcpdump] / print-esp.c
index 4e1c67b0b936a22bcfd7e710b5695633cc69dfc8..a57e072b31a654d9efeb7c6bbe100ced23c7c2c5 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.7 2000-09-23 08:03:34 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
@@ -36,17 +36,7 @@ static const char rcsid[] =
 #include <sys/types.h>
 #include <sys/socket.h>
 
-#include <net/route.h>
-#include <net/if.h>
-
 #include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/ip_icmp.h>
-#include <netinet/ip_var.h>
-#include <netinet/udp.h>
-#include <netinet/udp_var.h>
-#include <netinet/tcp.h>
 
 #ifdef HAVE_LIBCRYPTO
 #include <des.h>
@@ -61,33 +51,12 @@ static const char rcsid[] =
 
 #include <stdio.h>
 
+#include "ip.h"
+#include "esp.h"
 #ifdef INET6
-#include <netinet/ip6.h>
+#include "ip6.h"
 #endif
 
-/* 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"
 
@@ -111,14 +80,14 @@ esp_print(register const u_char *bp, register const u_char *bp2, int *nhdr)
        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(")");
 
@@ -163,7 +132,7 @@ esp_print(register const u_char *bp, register const u_char *bp2, int *nhdr)
        }
 
        ip = (struct ip *)bp2;
-       switch (ip->ip_v) {
+       switch (IP_V(ip)) {
 #ifdef INET6
        case 6:
                ip6 = (struct ip6_hdr *)bp2;