From: Roy Marples Date: Sun, 16 Mar 2008 08:22:01 +0000 (+0000) Subject: Work with zerolength options again. X-Git-Tag: v4.0.2~543 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74befdac5d0d3c0803cd15c3db85c3ba81064bc8;p=thirdparty%2Fdhcpcd.git Work with zerolength options again. --- diff --git a/dhcp.c b/dhcp.c index 8ed66da9..14b40d83 100644 --- a/dhcp.c +++ b/dhcp.c @@ -669,9 +669,9 @@ parse_start: length = *p++; if (option != DHCP_PAD && length == 0) { - logger (LOG_ERR, "option %d has zero length", option); - retval = -1; - goto eexit; + logger (LOG_ERR, "option %d has zero length, skipping", + option); + continue; } if (p + length >= end) { @@ -680,21 +680,6 @@ parse_start: goto eexit; } - switch (option) { - case DHCP_MESSAGETYPE: - retval = (int) *p; - p += length; - continue; - - default: - if (length == 0) { - logger (LOG_DEBUG, - "option %d has zero length, skipping", - option); - continue; - } - } - #define LENGTH(_length) \ if (length != _length) \ LEN_ERR; @@ -721,6 +706,9 @@ parse_start: _val = ntohl (_val); switch (option) { + case DHCP_MESSAGETYPE: + retval = (int) *p; + break; case DHCP_ADDRESS: GET_UINT32 (dhcp->address.s_addr); break;