[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #47787] DHCP client quits after 256 tries
From: |
Stephen Hersey |
Subject: |
[lwip-devel] [bug #47787] DHCP client quits after 256 tries |
Date: |
Tue, 26 Apr 2016 14:46:55 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 |
URL:
<http://savannah.nongnu.org/bugs/?47787>
Summary: DHCP client quits after 256 tries
Project: lwIP - A Lightweight TCP/IP stack
Submitted by: shersey
Submitted on: Tue 26 Apr 2016 02:46:54 PM GMT
Category: DHCP
Severity: 3 - Normal
Item Group: Faulty Behaviour
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Planned Release:
lwIP version: 1.4.1
_______________________________________________________
Details:
There's a weird corner case in LwIP where, if the DHCP client is unable to get
a response from a DHCP server after 256 tries, the DHCP retry counter (which
is a u8_t) will roll over to zero, and the DHCP timout will stop invoking
dhcp_timeout(). This is in a configuration where DHCP is enabled but AUTOIP is
not.
Now, most users will never see this, because it normally takes a LONG time to
reach 256 tries with the default exponential DHCP backoff. However, I'm using
a modified dhcp.c (attached, search for "S.H." in the text) that reduces the
maximum DHCP retry timeout to 10 seconds, because my DHCP client may come up
several minutes before the DHCP server does, and it's important that the
client get an address quickly once the server finally comes up.
My target hardware is an ARM Cortex-M3 MCU, and the build environment is GCC
(Rowley Crossworks 3.5).
To reproduce the failure, attach the LwIP DHCP client system to a PC that has
no DHCP server, run Wireshark on the PC, and observe the client's DHCP
requests. After 256 tries without a DHCP response, the DHCP client will stop
requesting.
My local fix for this failure is to take each occurrence of "dhcp->tries" in
dhcp.c and wrap it in a conditional, as: "if (dhcp->tries < 255) {
dhcp->tries++; }"
This causes "tries" to saturate at 255 instead of rolling over, and the DHCP
client won't stop requesting.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Tue 26 Apr 2016 02:46:54 PM GMT Name: dhcp.c Size: 65kB By: shersey
<http://savannah.nongnu.org/bugs/download.php?file_id=36997>
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?47787>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
- [lwip-devel] [bug #47787] DHCP client quits after 256 tries,
Stephen Hersey <=