net: Handle an empty bootp extension section
Avoid generating this section if there is nothing in it.
Signed-off-by: Andre Renaud <andre@designa-electronics.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
diff --git a/net/bootp.c b/net/bootp.c
index aa6cdf0..42e14ed 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -673,6 +673,15 @@
*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