]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
net: Fix potential empty DHCP Parameter Request List
authorJason Liu <r64343@freescale.com>
Sun, 14 Nov 2010 04:23:09 +0000 (12:23 +0800)
committerWolfgang Denk <wd@denx.de>
Sun, 14 Nov 2010 22:29:29 +0000 (23:29 +0100)
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>
net/bootp.c

index e679f8b7f876e236bd7ec84b7218299c3bb82f57..1a717867d48885b479050909b43d1cba0b372fe7 100644 (file)
@@ -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 */