On Fri, Oct 06, 2023 at 11:29:43AM -0500, Nathan Martin wrote: > Hi Rogier, > > You should enable the DHCP log messages in the project's lwipopts.h file by > setting the following defines: > > #define LWIP_DEBUG > #define DHCP_DEBUG LWIP_DBG_ON > > The DHCP debug messages should give you an idea as to what lwIP's DHCP is > doing and hopefully why. > > It is possible that your DHCP server has short term IP address leases > configured.
No, about(*) a day IIRC. And if that were the case, all others on my network would also be "DHCP-ing" a lot. This issue was noticed when my logs had hundreds of my test-project DHCPing repeatedly (with just the normal amount of other devices inbetween). > And as to why multiple times per second, it is normal to initially send out > a few discover packets in case the first packet doesn't arrive to the DHCP > server as everything is exchanged as UDP broadcasts. The acquiring DHCP > lease does involve multiple packets being sent and received. > > The DHCP code is located in lwip-dir/src/core/ipv4/dhcp.c At one point I thought the problem had gone away and decided to leave it at that.... But it hadn't. I debugged it my own way and found that for the DHCP code it seems to start with dhcp_network_changed 1856.940025 being called (1856 is the timestamp (in seconds since boot). That seems to be called from src/core/netif.c (that's the only call I found), and that in turn doesn't seem to be called except when loop or a few other specific devices come up. Ok... Just added a debug message to netif_set_link_up in src/core/netif.c and... Nope: dhcp_network_changed is NOT called from there, at least I'm not seeing the debug message, and I don't see any other place where it gets called. Checked the disassembly of the binary and netif_set_link_up is the only place where dhcp_network_changed is being called. And I see the bl 1000feb4 <debug_calls> that would generate my debug message in the disassembly for netif_set_link_up. (i.e. I didnt put the debug message in some #ifdef part that didn't get compiled.) Further suggestions? Roger. (*) So half a day, a day or two days. Something like that. Not 'about a day" as in "23 hours". > > -Nathan Martin > > > On 10/6/2023 6:51 AM, Rogier Wolff wrote: > > Hi all, > > > > I have a project, and I noticed a while back that it would repeatedly > > repeat its DHCP request. > > > > Yesterday I had intended to solve this and also do some other > > maintenance on the code. I started with the latter and... the DHCP > > problem disappeared. > > > > However, this morning it had started again. > > > > Now you might say: it is supposed to re-validate the DHCP lease every > > now and then. And I'd agree. However multiple times a second is WAY > > too much. > > > > I have now reverted the board to more stock "example" code: Way less > > of my code in there. But it seems that now the problem only > > happens after a while. > > > > This is running on an RP2040 with hardwired ethernet through a > > lan8720 PHY. > > > > Anybody seen such behaviour? What was the problem then? > > > > Why would LWIP restart the DHCP sequence? What could cause this? > > Where would I look to find the code responsible? > > > > Roger. > > > > > _______________________________________________ > lwip-users mailing list > lwip-users@nongnu.org > https://lists.nongnu.org/mailman/listinfo/lwip-users -- ** r.e.wo...@bitwizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** f equals m times a. When your f is steady, and your m is going down your a is going up. -- Chris Hadfield about flying up the space shuttle. _______________________________________________ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users