dhcpc abnormal block
The logic changes are as follows: 1、Loop sending the DISCOVER up to CONFIG_NETUTILS_DHCPC_RETRIES times and exit if failure 2、Loop sending the REQUEST up to CONFIG_NETUTILS_DHCPC_RETRIES times and exit if failure Signed-off-by: songlinzhang <songlinzhang@xiaomi.com>
This commit is contained in:
parent
80dcc185f3
commit
98dfaa3eff
@ -579,10 +579,6 @@ int dhcpc_request(FAR void *handle, FAR struct dhcpc_state *presult)
|
||||
oldaddr.s_addr = 0;
|
||||
netlib_get_ipv4addr(pdhcpc->interface, &oldaddr);
|
||||
|
||||
/* Loop until we receive the lease (or an error occurs) */
|
||||
|
||||
do
|
||||
{
|
||||
/* Set the IP address to INADDR_ANY. */
|
||||
|
||||
newaddr.s_addr = INADDR_ANY;
|
||||
@ -748,8 +744,13 @@ int dhcpc_request(FAR void *handle, FAR struct dhcpc_state *presult)
|
||||
}
|
||||
while (state == STATE_HAVE_OFFER &&
|
||||
retries < CONFIG_NETUTILS_DHCPC_RETRIES);
|
||||
|
||||
/* If no DHCPLEASE recveived here, error out */
|
||||
|
||||
if (state != STATE_HAVE_LEASE)
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
while (state != STATE_HAVE_LEASE);
|
||||
|
||||
ninfo("Got IP address %d.%d.%d.%d\n",
|
||||
(int)((presult->ipaddr.s_addr) & 0xff),
|
||||
|
Loading…
Reference in New Issue
Block a user