Skip to contentSkip to conversation

net:Fix potential empty DHCP Parameter Request List

PATCH New Jason Liu 2 participants 2 messages Nov 14, 2010 Networking

lore
Share & tools
lore

Jason Liu

author
#0 lore raw

PATCH v2 1/1 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.

---
Changes for v2:
- address the comments from Mike and re-order the code

---
 net/bootp.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
net/bootp.c +4 -0
index e679f8b..1a71786 100644
@@ -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 */
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v2 1/1 net:Fix potential empty DHCP Parameter Request List

Dear Jason Liu,

Quoted 8 lines · In message <[email protected]> you wrote:

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.

Quoted 6 lines

---
Changes for v2:
- address the comments from Mike and re-order the code

---
 net/bootp.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The biggest difference between time and space is that you can't reuse
time.                                                 - Merrick Furst