]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-esp.c
OpenFlow: Have a function for each message type.
[tcpdump] / print-esp.c
index 91d394ff61de8dc6f3d41db7e9b9030cd08c3d2c..8b664b61ec8115da255684cd42dceb30e5de5b18 100644 (file)
 #endif
 
 #include "netdissect.h"
-#include "strtoaddr.h"
 #include "extract.h"
 
+#ifdef HAVE_LIBCRYPTO
+#include "strtoaddr.h"
 #include "ascii_strcasecmp.h"
+#endif
 
 #include "ip.h"
 #include "ip6.h"
@@ -277,7 +279,7 @@ do_decrypt(netdissect_options *ndo, const char *caller, struct sa_list *sa,
  * anything in the old buffer.  That will free the new buffer.
  */
 USES_APPLE_DEPRECATED_API
-int esp_print_decrypt_buffer_by_ikev2(netdissect_options *ndo,
+int esp_decrypt_buffer_by_ikev2_print(netdissect_options *ndo,
                                      int initiator,
                                      const u_char spii[8],
                                      const u_char spir[8],
@@ -315,7 +317,7 @@ int esp_print_decrypt_buffer_by_ikev2(netdissect_options *ndo,
 
        if(end <= ct) return 0;
 
-       pt = do_decrypt(ndo, "esp_print_decrypt_buffer_by_ikev2", sa, iv,
+       pt = do_decrypt(ndo, "esp_decrypt_buffer_by_ikev2_print", sa, iv,
            ct, ctlen);
        if (pt == NULL)
                return 0;
@@ -345,7 +347,7 @@ static void esp_print_addsa(netdissect_options *ndo,
        nsa = (struct sa_list *)malloc(sizeof(struct sa_list));
        if (nsa == NULL)
                (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
-                                 "esp_print_addsa: malloc");
+                                 "%s: malloc", __func__);
 
        *nsa = *sa;
 
@@ -601,8 +603,8 @@ static void esp_print_decode_onesecret(netdissect_options *ndo, char *line,
                secretfile = fopen(filename, FOPEN_READ_TXT);
                if (secretfile == NULL) {
                        (*ndo->ndo_error)(ndo, S_ERR_ND_OPEN_FILE,
-                                         "print_esp: can't open %s: %s\n",
-                                         filename, strerror(errno));
+                                         "%s: can't open %s: %s\n",
+                                         __func__, filename, strerror(errno));
                }
 
                while (fgets(fileline, sizeof(fileline)-1, secretfile) != NULL) {
@@ -683,7 +685,7 @@ static void esp_init(netdissect_options *ndo _U_)
 }
 USES_APPLE_RST
 
-void esp_print_decodesecret(netdissect_options *ndo)
+void esp_decodesecret_print(netdissect_options *ndo)
 {
        char *line;
        char *p;
@@ -763,7 +765,7 @@ esp_print(netdissect_options *ndo,
                if (!ndo->ndo_espsecret)
                        return;
 
-               esp_print_decodesecret(ndo);
+               esp_decodesecret_print(ndo);
        }
 
        if (ndo->ndo_sa_list_head == NULL)
@@ -878,7 +880,7 @@ esp_print(netdissect_options *ndo,
        if (!nd_push_buffer(ndo, pt, pt, ep)) {
                free(pt);
                (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
-                       "esp_print: can't push buffer on buffer stack");
+                       "%s: can't push buffer on buffer stack", __func__);
        }
 
        /*
@@ -902,7 +904,7 @@ esp_print(netdissect_options *ndo,
        ND_PRINT(": ");
 
        /* Now dissect the plaintext. */
-       ip_print_demux(ndo, pt, payloadlen - (padlen + 2), ver, fragmented,
+       ip_demux_print(ndo, pt, payloadlen - (padlen + 2), ver, fragmented,
            ttl_hl, nh, bp2);
 
        /* Pop the buffer, freeing it. */