]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-l2tp.c
CI: Add warning exemptions for Sun C (suncc-5.14) on Solaris 10
[tcpdump] / print-l2tp.c
index 024705f821ba5e1e25299bcb169a921f3f6355b4..a320873444f1a7b7b841c8f417633f7c8754ad01 100644 (file)
@@ -25,9 +25,7 @@
 
 /* specification: RFC 2661 */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include "netdissect-stdinc.h"
 
@@ -88,7 +86,7 @@
 #define        L2TP_MSGTYPE_SLI        16 /* Set-Link-Info */
 
 static const struct tok l2tp_msgtype2str[] = {
-       { L2TP_MSGTYPE_SCCRQ,   "SCCRQ" },
+       { L2TP_MSGTYPE_SCCRQ,   "SCCRQ" },
        { L2TP_MSGTYPE_SCCRP,   "SCCRP" },
        { L2TP_MSGTYPE_SCCCN,   "SCCCN" },
        { L2TP_MSGTYPE_STOPCCN, "StopCCN" },
@@ -114,17 +112,17 @@ static const struct tok l2tp_msgtype2str[] = {
 #define L2TP_AVP_FIRM_VER              6  /* Firmware Revision */
 #define L2TP_AVP_HOST_NAME             7  /* Host Name */
 #define L2TP_AVP_VENDOR_NAME           8  /* Vendor Name */
-#define L2TP_AVP_ASSND_TUN_ID          9  /* Assigned Tunnel ID */
+#define L2TP_AVP_ASSND_TUN_ID          9  /* Assigned Tunnel ID */
 #define L2TP_AVP_RECV_WIN_SIZE         10 /* Receive Window Size */
 #define L2TP_AVP_CHALLENGE             11 /* Challenge */
 #define L2TP_AVP_Q931_CC               12 /* Q.931 Cause Code */
 #define L2TP_AVP_CHALLENGE_RESP                13 /* Challenge Response */
-#define L2TP_AVP_ASSND_SESS_ID         14 /* Assigned Session ID */
-#define L2TP_AVP_CALL_SER_NUM          15 /* Call Serial Number */
+#define L2TP_AVP_ASSND_SESS_ID         14 /* Assigned Session ID */
+#define L2TP_AVP_CALL_SER_NUM          15 /* Call Serial Number */
 #define L2TP_AVP_MINIMUM_BPS           16 /* Minimum BPS */
 #define L2TP_AVP_MAXIMUM_BPS           17 /* Maximum BPS */
 #define L2TP_AVP_BEARER_TYPE           18 /* Bearer Type */
-#define L2TP_AVP_FRAMING_TYPE          19 /* Framing Type */
+#define L2TP_AVP_FRAMING_TYPE          19 /* Framing Type */
 #define L2TP_AVP_PACKET_PROC_DELAY     20 /* Packet Processing Delay (OBSOLETE) */
 #define L2TP_AVP_CALLED_NUMBER         21 /* Called Number */
 #define L2TP_AVP_CALLING_NUMBER                22 /* Calling Number */
@@ -144,7 +142,7 @@ static const struct tok l2tp_msgtype2str[] = {
 #define L2TP_AVP_RANDOM_VECTOR         36 /* Random Vector */
 #define L2TP_AVP_PRIVATE_GRP_ID                37 /* Private Group ID */
 #define L2TP_AVP_RX_CONN_SPEED         38 /* (Rx) Connect Speed */
-#define L2TP_AVP_SEQ_REQUIRED          39 /* Sequencing Required */
+#define L2TP_AVP_SEQ_REQUIRED          39 /* Sequencing Required */
 #define L2TP_AVP_PPP_DISCON_CC         46 /* PPP Disconnect Cause Code - RFC 3145 */
 
 static const struct tok l2tp_avp2str[] = {
@@ -265,16 +263,6 @@ static char *l2tp_error_code_general[] = {
 /******************************/
 /* generic print out routines */
 /******************************/
-static void
-print_string(netdissect_options *ndo, const u_char *dat, u_int length)
-{
-       u_int i;
-       for (i=0; i<length; i++) {
-               fn_print_char(ndo, GET_U_1(dat));
-               dat++;
-       }
-}
-
 static void
 print_octets(netdissect_options *ndo, const u_char *dat, u_int length)
 {
@@ -338,7 +326,7 @@ l2tp_result_code_print(netdissect_options *ndo, const u_char *dat, u_int length)
        if (length == 0)
                return;
        ND_PRINT(" ");
-       print_string(ndo, dat, length);
+       nd_printjn(ndo, dat, length);
 }
 
 static void
@@ -395,7 +383,7 @@ l2tp_q931_cc_print(netdissect_options *ndo, const u_char *dat, u_int length)
        length -= 3;
        if (length != 0) {
                ND_PRINT(" ");
-               print_string(ndo, dat, length);
+               nd_printjn(ndo, dat, length);
        }
 }
 
@@ -561,7 +549,7 @@ l2tp_ppp_discon_cc_print(netdissect_options *ndo, const u_char *dat, u_int lengt
 
        if (length != 0) {
                ND_PRINT(" ");
-               print_string(ndo, (const u_char *)dat, length);
+               nd_printjn(ndo, (const u_char *)dat, length);
        }
 }
 
@@ -577,7 +565,7 @@ l2tp_avp_print(netdissect_options *ndo, const u_char *dat, u_int length)
        len = GET_BE_U_2(dat) & L2TP_AVP_HDR_LEN_MASK;
 
        /* If it is not long enough to contain the header, we'll give up. */
-       ND_LCHECKMSG_U(len, 6, "AVP length");
+       ND_ICHECKMSG_U("AVP length", len, <, 6);
 
        /* If it goes past the end of the remaining length of the packet,
           we'll give up. */
@@ -661,7 +649,7 @@ l2tp_avp_print(netdissect_options *ndo, const u_char *dat, u_int length)
                        case L2TP_AVP_SUB_ADDRESS:
                        case L2TP_AVP_PROXY_AUTH_NAME:
                        case L2TP_AVP_PRIVATE_GRP_ID:
-                               print_string(ndo, dat, len-6);
+                               nd_printjn(ndo, dat, len-6);
                                break;
                        case L2TP_AVP_CHALLENGE:
                        case L2TP_AVP_INI_RECV_LCP: