From: Simon Glass Date: Thu, 5 May 2016 07:28:08 -0600 Subject: [U-Boot] [PATCH v2 04/18] net: Handle an empty bootp extension section In-Reply-To: <1462454902-6093-1-git-send-email-sjg@chromium.org> References: <1462454902-6093-1-git-send-email-sjg@chromium.org> Message-ID: <1462454902-6093-5-git-send-email-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Andre Renaud Avoid generating this section if there is nothing in it. Signed-off-by: Andre Renaud Signed-off-by: Simon Glass Acked-by: Joe Hershberger --- Changes in v2: None net/bootp.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/net/bootp.c b/net/bootp.c index d7852db..71f09bd 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -655,6 +655,15 @@ static int bootp_extended(u8 *e) *e++ = 255; /* End of the list */ + /* + * If nothing in list, remove it altogether. Some DHCP servers get + * upset by this minor faux pas and do not respond at all. + */ + if (e == start + 3) { + printf("*** Warning: no DHCP options requested\n"); + e -= 3; + } + return e - start; } #endif -- 2.8.0.rc3.226.g39d4020