]> 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 cf5f05e45a2324711676f9777f26518b1f7f11da..a57e072b31a654d9efeb7c6bbe100ced23c7c2c5 100644 (file)
@@ -23,7 +23,7 @@
 
 #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
@@ -36,8 +36,6 @@ static const char rcsid[] =
 #include <sys/types.h>
 #include <sys/socket.h>
 
-#include <net/route.h>
-
 #include <netinet/in.h>
 
 #ifdef HAVE_LIBCRYPTO
@@ -53,35 +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
 
-#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"
 
@@ -105,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(")");
 
@@ -157,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;