]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-bootp.c
DHCP: Fix a comment about formats for (un)signed longs/shorts data
[tcpdump] / print-bootp.c
index 6ab6079d870599cf6e4a3ec99d2cfcd163ab6859..d84ba6f8b48f8cc6fea36eeceb13733c20eefb57 100644 (file)
@@ -21,9 +21,7 @@
 
 /* \summary: BOOTP and IPv4 DHCP printer */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include "netdissect-stdinc.h"
 
@@ -396,9 +394,9 @@ trunc:
  * The first character specifies the format to print:
  *     i - ip address (32 bits)
  *     p - ip address pairs (32 bits + 32 bits)
- *     l - long (32 bits)
- *     L - unsigned long (32 bits)
- *     s - short (16 bits)
+ *     l - unsigned longs (32 bits)
+ *     L - longs (32 bits)
+ *     s - unsigned shorts (16 bits)
  *     b - period-separated decimal bytes (variable length)
  *     x - colon-separated hex bytes (variable length)
  *     a - ASCII string (variable length)
@@ -719,7 +717,7 @@ rfc1048_print(netdissect_options *ndo,
                        break;
 
                case 's':
-                       /* shorts */
+                       /* unsigned shorts */
                        while (len >= 2) {
                                if (!first)
                                        ND_PRINT(",");
@@ -1014,22 +1012,24 @@ rfc1048_print(netdissect_options *ndo,
                                 * URI: URI of the SZTP bootstrap server.
                                 */
                                while (len >= 2) {
-                                       suboptlen = GET_BE_U_2(bp);
+                                       uint16_t suboptlen2;
+
+                                       suboptlen2 = GET_BE_U_2(bp);
                                        bp += 2;
                                        len -= 2;
                                        ND_PRINT("\n\t      ");
-                                       ND_PRINT("length %u: ", suboptlen);
-                                       if (len < suboptlen) {
+                                       ND_PRINT("length %u: ", suboptlen2);
+                                       if (len < suboptlen2) {
                                                ND_PRINT("length goes past end of option");
                                                bp += len;
                                                len = 0;
                                                break;
                                        }
                                        ND_PRINT("\"");
-                                       nd_printjn(ndo, bp, suboptlen);
+                                       nd_printjn(ndo, bp, suboptlen2);
                                        ND_PRINT("\"");
-                                       len -= suboptlen;
-                                       bp += suboptlen;
+                                       len -= suboptlen2;
+                                       bp += suboptlen2;
                                }
                                if (len != 0) {
                                        ND_PRINT("[ERROR: length < 2 bytes]");