]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-isakmp.c
CI: Add warning exemptions for Sun C (suncc-5.14) on Solaris 10
[tcpdump] / print-isakmp.c
index c78de52fc72ed2d6bbcfe1c70a354855d97ccdf3..be5b0930c1aea385bd023f4dabb998cc8ae94707 100644 (file)
 
 /* specification: RFC 2407, RFC 2408, RFC 5996 */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
-
-/* The functions from print-esp.c used in this file are only defined when both
- * OpenSSL and evp.h are detected. Employ the same preprocessor device here.
- */
-#ifndef HAVE_OPENSSL_EVP_H
-#undef HAVE_LIBCRYPTO
-#endif
 
 #include "netdissect-stdinc.h"
 
@@ -55,7 +46,7 @@
 
 #include "ip.h"
 #include "ip6.h"
-#include "ipproto.h"
+#include "ipproto.h"   /* for netdb_protoname() */
 
 typedef nd_byte cookie_t[8];
 typedef nd_byte msgid_t[4];
@@ -122,9 +113,9 @@ struct isakmp {
 #define ISAKMP_FLAG_extra 0x04
 
 /* IKEv2 */
-#define ISAKMP_FLAG_I (1 << 3)  /* (I)nitiator */
-#define ISAKMP_FLAG_V (1 << 4)  /* (V)ersion   */
-#define ISAKMP_FLAG_R (1 << 5)  /* (R)esponse  */
+#define ISAKMP_FLAG_I (1 << 3)  /* Initiator */
+#define ISAKMP_FLAG_V (1 << 4)  /* Version   */
+#define ISAKMP_FLAG_R (1 << 5)  /* Response  */
 
 
 /* 3.2 Payload Generic Header
@@ -243,7 +234,7 @@ struct ikev1_pl_cr {
        Certificate Types (variable length)
          -- Contains a list of the types of certificates requested,
          sorted in order of preference.  Each individual certificate
-         type is 1 octet.  This field is NOT requiredo
+         type is 1 octet.  This field is NOT required.
        */
        /* # Certificate Authorities (1 octet) */
        /* Certificate Authorities (variable length) */
@@ -1446,10 +1437,8 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_,
                case IPSECDOI_ID_FQDN:
                case IPSECDOI_ID_USER_FQDN:
                    {
-                       u_int i;
                        ND_PRINT(" len=%u ", len);
-                       for (i = 0; i < len; i++)
-                               fn_print_char(ndo, GET_U_1(data + i));
+                       nd_printjn(ndo, data, len);
                        len = 0;
                        break;
                    }
@@ -1884,14 +1873,16 @@ ikev1_d_print(netdissect_options *ndo, u_char tpay _U_,
        ND_PRINT(" spilen=%u", spi_size);
        num_spi = GET_BE_U_2(p->num_spi);
        ND_PRINT(" nspi=%u", num_spi);
-       ND_PRINT(" spi=");
        q = (const uint8_t *)(p + 1);
-       for (i = 0; i < num_spi; i++) {
-               if (i != 0)
-                       ND_PRINT(",");
-               if (!rawprint(ndo, (const uint8_t *)q, spi_size))
-                       goto trunc;
-               q += spi_size;
+       if (spi_size) {
+               ND_PRINT(" spi=");
+               for (i = 0; i < num_spi; i++) {
+                       if (i != 0)
+                               ND_PRINT(",");
+                       if (!rawprint(ndo, (const uint8_t *)q, spi_size))
+                               goto trunc;
+                       q += spi_size;
+               }
        }
        return q;
 trunc:
@@ -2259,7 +2250,7 @@ ikev2_ID_print(netdissect_options *ndo, u_char tpay,
                uint32_t proto _U_, int depth _U_)
 {
        const struct ikev2_id *idp;
-       u_int idtype_len, i;
+       u_int idtype_len;
        unsigned int dumpascii, dumphex;
        const unsigned char *typedata;
 
@@ -2316,13 +2307,7 @@ ikev2_ID_print(netdissect_options *ndo, u_char tpay,
 
        if(dumpascii) {
                ND_TCHECK_LEN(typedata, idtype_len);
-               for(i=0; i<idtype_len; i++) {
-                       if(ND_ASCII_ISPRINT(GET_U_1(typedata + i))) {
-                               ND_PRINT("%c", GET_U_1(typedata + i));
-                       } else {
-                               ND_PRINT(".");
-                       }
-               }
+               nd_printjn(ndo, typedata, idtype_len);
        }
        if(dumphex) {
                if (!rawprint(ndo, (const uint8_t *)typedata, idtype_len))
@@ -2513,7 +2498,7 @@ ikev2_n_print(netdissect_options *ndo, u_char tpay _U_,
                break;
 
        case IV2_NOTIFY_TS_UNACCEPTABLE:
-               notify_name = "ts_unnacceptable";
+               notify_name = "ts_unacceptable";
                break;
 
        case IV2_NOTIFY_INVALID_SELECTORS:
@@ -2857,7 +2842,7 @@ ikev2_vid_print(netdissect_options *ndo, u_char tpay,
                uint32_t proto _U_, int depth _U_)
 {
        const u_char *vid;
-       u_int i, len;
+       u_int len;
 
        ND_TCHECK_SIZE(ext);
        ikev2_pay_print(ndo, NPSTR(tpay), GET_U_1(ext->critical));
@@ -2870,11 +2855,7 @@ ikev2_vid_print(netdissect_options *ndo, u_char tpay,
        vid = (const u_char *)(ext+1);
        len = item_len - 4;
        ND_TCHECK_LEN(vid, len);
-       for(i=0; i<len; i++) {
-               if(ND_ASCII_ISPRINT(GET_U_1(vid + i)))
-                       ND_PRINT("%c", GET_U_1(vid + i));
-               else ND_PRINT(".");
-       }
+       nd_printjn(ndo, vid, len);
        if (2 < ndo->ndo_vflag && 4 < len) {
                /* Print the entire payload in hex */
                ND_PRINT(" ");