[U-Boot,v2,1/1] net:Fix potential empty DHCP Parameter Request List

Submitted by Liu Hui-R64343 on Nov. 14, 2010, 4:23 a.m.

Details

Message ID 1289708589-12221-1-git-send-email-r64343@freescale.com
State Accepted
Commit 258ccd68170b7279ec7d4805c7b914c90374e711
Headers show

Commit Message

Liu Hui-R64343 Nov. 14, 2010, 4:23 a.m.
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>

---
Changes for v2:
  - address the comments from Mike and re-order the code
---
 net/bootp.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Comments

Wolfgang Denk Nov. 14, 2010, 10:29 p.m.
Dear Jason Liu,

In message <1289708589-12221-1-git-send-email-r64343@freescale.com> 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.
> 
> Signed-off-by: Jason Liu <r64343@freescale.com>
> Signed-off-by: Gray Remlin <g_remlin@rocketmail.com>
> 
> ---
> 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

Patch hide | download patch | download mbox

diff --git a/net/bootp.c b/net/bootp.c
index e679f8b..1a71786 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 */