diff mbox

[U-Boot,04/18] net: Handle an empty bootp extension section

Message ID 1462257612-28746-5-git-send-email-sjg@chromium.org
State Accepted
Commit 166c409bc42627d9e19517f6ce121c39d0f52b65
Delegated to: Andreas Bießmann
Headers show

Commit Message

Simon Glass May 3, 2016, 6:39 a.m. UTC
Avoid generating this section if there is nothing in it.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 net/bootp.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Joe Hershberger May 3, 2016, 7:36 p.m. UTC | #1
On Tue, May 3, 2016 at 1:39 AM, Simon Glass <sjg@chromium.org> wrote:
> Avoid generating this section if there is nothing in it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
diff mbox

Patch

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