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.

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

    -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
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to