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 <r64343@freescale.com>
Signed-off-by: Gray Remlin <g_remlin@rocketmail.com>
This commit is contained in:
Jason Liu 2010-11-14 12:23:09 +08:00 committed by Wolfgang Denk
parent 6d1d51b32b
commit 258ccd6817
1 changed files with 4 additions and 0 deletions

View File

@ -456,6 +456,10 @@ static int DhcpExtended (u8 * e, int message_type, IPaddr_t ServerID, IPaddr_t R
*e++ = 42; *e++ = 42;
*cnt += 1; *cnt += 1;
#endif #endif
/* no options, so back up to avoid sending an empty request list */
if (*cnt == 0)
e -= 2;
*e++ = 255; /* End of the list */ *e++ = 255; /* End of the list */
/* Pad to minimal length */ /* Pad to minimal length */