summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2015-12-29 18:53:08 +0800
committerPeng Fan <Peng.Fan@freescale.com>2015-12-29 19:00:16 +0800
commitd0c650df58b592509685a4bd1575e0bebd81932c (patch)
treea4b2635cfc5ae0a568846319e3d290f35fc61849
parent49b633b1e52ea4b9092ffcc0086807abe1f4529e (diff)
downloadu-boot-imx-d0c650df58b592509685a4bd1575e0bebd81932c.zip
u-boot-imx-d0c650df58b592509685a4bd1575e0bebd81932c.tar.gz
u-boot-imx-d0c650df58b592509685a4bd1575e0bebd81932c.tar.bz2
MLK-12101: net: bootp: fix dhcp when there is a bad dhcp serverimx_v2015.04
There is a bad dhcp server which always gives board ipaddr 0.0.0.0, and board can not get ipaddr from correct dhcp server, since the bad dhcp server always reply the board's dhcp packet with bad address. We can ignore the bad dhcp server by checking the assigned ipaddr, checking whether it is 0 or not. Signed-off-by: Peng Fan <peng.fan@nxp.com>
-rw-r--r--net/bootp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/bootp.c b/net/bootp.c
index 8106601..5331727 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -6,6 +6,7 @@
* Copyright 2000 Roland Borde
* Copyright 2000 Paolo Scaffardi
* Copyright 2000-2004 Wolfgang Denk, wd@denx.de
+ * Copyright (C) 2015 Freescale Semiconductor, Inc.
*/
#include <common.h>
@@ -949,6 +950,10 @@ DhcpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
if (BootpCheckPkt(pkt, dest, src, len))
return;
+ /* Ignore pkts with ip address which is 0 */
+ if (NetReadIP(&bp->bp_yiaddr) == 0)
+ return;
+
debug("DHCPHandler: got DHCP packet: (src=%d, dst=%d, len=%d) state:"
" %d\n", src, dest, len, dhcp_state);