Commit 44c42dd4 authored by Peng Fan's avatar Peng Fan Committed by Joe Hershberger

net: bootp: Ignore packets whose yiaddr is 0

When doing `dhcp`, there is a bad dhcp server in my network
which always reply dhcp request with yiaddr 0, which cause
uboot can not successfully get ipaddr from the good dhcp server.
But the Linux PC can get the ip address even if there is a bad
dhcp server. This patch is to fix that even if there is a bad
dhcp server, uboot can still get ipaddr and tftp work ok.

The way is to ignore the packets from the bad dhcp server by filtering
out the yiaddr whose value is 0.
Signed-off-by: default avatarPeng Fan <>
Cc: Joe Hershberger <>
Reviewed-by: default avatarWolfgang Denk <>
Acked-by: default avatarJoe Hershberger <>
parent aae0e689
......@@ -995,6 +995,9 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
debug("DHCPHandler: got DHCP packet: (src=%d, dst=%d, len=%d) state: "
"%d\n", src, dest, len, dhcp_state);
if (net_read_ip(&bp->bp_yiaddr).s_addr == 0)
switch (dhcp_state) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment