]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-bootp.c
Squelch a Coverity warning.
[tcpdump] / print-bootp.c
index 7f42492d4188d29446c2ddf418a575caa87adfaf..83fa02785fb8e8eb8912d8dca4130680972a36f0 100644 (file)
  * Format and print bootp packets.
  */
 
-#define NETDISSECT_REWORKED
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
 
 #include <string.h>
 
-#include "interface.h"
+#include "netdissect.h"
 #include "addrtoname.h"
 #include "extract.h"
 
@@ -195,6 +194,8 @@ struct bootp {
 /* RFC 3442 */
 #define TAG_CLASSLESS_STATIC_RT        ((uint8_t) 121)
 #define TAG_CLASSLESS_STA_RT_MS        ((uint8_t) 249)
+/* RFC 5859 - TFTP Server Address Option for DHCPv4 */
+#define        TAG_TFTP_SERVER_ADDRESS ((uint8_t) 150)
 /* ftp://ftp.isi.edu/.../assignments/bootp-dhcp-extensions */
 #define        TAG_SLP_NAMING_AUTH     ((uint8_t)  80)
 #define        TAG_CLIENT_FQDN         ((uint8_t)  81)
@@ -500,6 +501,8 @@ static const struct tok tag2str[] = {
 /* RFC 3442 */
        { TAG_CLASSLESS_STATIC_RT, "$Classless-Static-Route" },
        { TAG_CLASSLESS_STA_RT_MS, "$Classless-Static-Route-Microsoft" },
+/* RFC 5859 - TFTP Server Address Option for DHCPv4 */
+       { TAG_TFTP_SERVER_ADDRESS, "iTFTP-Server-Address" },
 /* http://www.iana.org/assignments/bootp-dhcp-extensions/index.htm */
        { TAG_SLP_NAMING_AUTH,  "aSLP-NA" },
        { TAG_CLIENT_FQDN,      "$FQDN" },
@@ -847,7 +850,7 @@ rfc1048_print(netdissect_options *ndo,
 
                        case TAG_CLIENT_ID:
                            {
-                               int type;
+                               int type;
 
                                /* this option should be at least 1 byte long */
                                if (len < 1) {
@@ -903,7 +906,8 @@ rfc1048_print(netdissect_options *ndo,
                                        case AGENT_SUBOPTION_CIRCUIT_ID: /* fall through */
                                        case AGENT_SUBOPTION_REMOTE_ID:
                                        case AGENT_SUBOPTION_SUBSCRIBER_ID:
-                                               fn_printn(ndo, bp, suboptlen, NULL);
+                                               if (fn_printn(ndo, bp, suboptlen, ndo->ndo_snapend))
+                                                       goto trunc;
                                                break;
 
                                        default:
@@ -992,7 +996,7 @@ rfc1048_print(netdissect_options *ndo,
                                                break;
                                        }
                                        if (len < suboptlen) {
-                                               ND_PRINT((ndo, "ERROR: malformed option"));
+                                               ND_PRINT((ndo, "ERROR: invalid option"));
                                                bp += len;
                                                len = 0;
                                                break;