From 258ccd68170b7279ec7d4805c7b914c90374e711 Mon Sep 17 00:00:00 2001 From: Jason Liu Date: Sun, 14 Nov 2010 12:23:09 +0800 Subject: [PATCH] net: Fix potential empty DHCP Parameter Request List Can't get IP address with dhcp due to the dhcp server not allow the empty param list request under some network env This patch is based on Gray Remlin's initial patch. Signed-off-by: Jason Liu Signed-off-by: Gray Remlin --- net/bootp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/bootp.c b/net/bootp.c index e679f8b7f..1a717867d 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -456,6 +456,10 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R *e++ = 42; *cnt += 1; #endif + /* no options, so back up to avoid sending an empty request list */ + if (*cnt == 0) + e -= 2; + *e++ = 255; /* End of the list */ /* Pad to minimal length */