X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/393b47892732e2e4c86e1560713dd8c4144ce0da..refs/pull/482/head:/print-bootp.c diff --git a/print-bootp.c b/print-bootp.c index 7f42492d..83fa0278 100644 --- a/print-bootp.c +++ b/print-bootp.c @@ -21,16 +21,15 @@ * Format and print bootp packets. */ -#define NETDISSECT_REWORKED #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include +#include #include -#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;