From: Andre Renaud Date: Thu, 5 May 2016 13:28:08 +0000 (-0600) Subject: net: Handle an empty bootp extension section X-Git-Tag: v2016.07-rc2~41^2~16 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=166c409bc42627d9e19517f6ce121c39d0f52b65;p=oweals%2Fu-boot.git net: Handle an empty bootp extension section Avoid generating this section if there is nothing in it. Signed-off-by: Andre Renaud Signed-off-by: Simon Glass Acked-by: Joe Hershberger --- diff --git a/net/bootp.c b/net/bootp.c index aa6cdf0a47..42e14eda41 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -673,6 +673,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