]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-esp.c
Add CAP_FCNTL and use cap_fcntls_limit().
[tcpdump] / print-esp.c
index 86b6f0ca2bebbd4cc4445e6485b84088a74337ed..8e267d45cdf9381d0eff7f70dbbaee8eaefeb0e0 100644 (file)
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
+#define NETDISSECT_REWORKED
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include <string.h>
-
 #include <tcpdump-stdinc.h>
 
+#include <string.h>
 #include <stdlib.h>
 
 /* Any code in this file that depends on HAVE_LIBCRYPTO depends on
 #endif
 #endif
 
-#include <stdio.h>
-
 #include "ip.h"
 #ifdef INET6
 #include "ip6.h"
 #endif
 
-#include "netdissect.h"
+#include "interface.h"
 #include "extract.h"
 
 /*
@@ -87,8 +85,8 @@
  */
 
 struct newesp {
-       u_int32_t       esp_spi;        /* ESP */
-       u_int32_t       esp_seq;        /* Sequence number */
+       uint32_t        esp_spi;        /* ESP */
+       uint32_t        esp_seq;        /* Sequence number */
        /*variable size*/               /* (IV and) Payload data */
        /*variable size*/               /* padding */
        /*8bit*/                        /* pad size */
@@ -108,7 +106,7 @@ struct sa_list {
        struct sa_list  *next;
        u_int           daddr_version;
        union inaddr_u  daddr;
-       u_int32_t       spi;          /* if == 0, then IKEv2 */
+       uint32_t        spi;          /* if == 0, then IKEv2 */
        int             initiator;
        u_char          spii[8];      /* for IKEv2 */
        u_char          spir[8];
@@ -467,7 +465,7 @@ static void esp_print_decode_onesecret(netdissect_options *ndo, char *line,
        if (spikey) {
 
                char *spistr, *foo;
-               u_int32_t spino;
+               uint32_t spino;
 
                spistr = strsep(&spikey, "@");
 
@@ -596,12 +594,12 @@ esp_print(netdissect_options *ndo,
        ep = ndo->ndo_snapend;
 
        if ((u_char *)(esp + 1) >= ep) {
-               fputs("[|ESP]", stdout);
+               ND_PRINT((ndo, "[|ESP]"));
                goto fail;
        }
-       (*ndo->ndo_printf)(ndo, "ESP(spi=0x%08x", EXTRACT_32BITS(&esp->esp_spi));
-       (*ndo->ndo_printf)(ndo, ",seq=0x%x)", EXTRACT_32BITS(&esp->esp_seq));
-        (*ndo->ndo_printf)(ndo, ", length %u", length);
+       ND_PRINT((ndo, "ESP(spi=0x%08x", EXTRACT_32BITS(&esp->esp_spi)));
+       ND_PRINT((ndo, ",seq=0x%x)", EXTRACT_32BITS(&esp->esp_seq)));
+       ND_PRINT((ndo, ", length %u", length));
 
 #ifndef HAVE_LIBCRYPTO
        goto fail;
@@ -705,7 +703,7 @@ esp_print(netdissect_options *ndo,
        if (nhdr)
                *nhdr = *(ep - 1);
 
-       (ndo->ndo_printf)(ndo, ": ");
+       ND_PRINT((ndo, ": "));
        return advance;
 #endif