On Mon, Oct 10, 2022 at 11:32 AM Fotis Panagiotopoulos <f.j.pa...@gmail.com> wrote:
> Hello everyone, > > While I am still tracking down various issues regarding networking with > NuttX, I observed something interesting within the DHCP client code. > > When dhcpc_request is called, the current IP address is set to INADDR_ANY. > This is in file dhcpc.c, line 714. > > This sounds normal for the initial request. But what about when renewing > the lease? > In this case the system already has a perfectly valid IP address. > > Setting the interface back to INADDR_ANY, even temporarily, can cause > problems to other tasks than may be using the same NIC simultaneously. > If another task tries any communication during the DHCP renewal, it fails. > I don't think that there is an actual need for it to fail. > > Also, I believe that setting the address to INADDR_ANY does not benefit > DHCP, as it is not using the current IP address in any way (it broadcasts > only). > > I am very tempted to remove this from the DHCP client. > Unless I am missing something? > Hmm, I have not looked at the code yet, but based on your description, that sounds incorrect. I think that for DHCP renewal, we should keep the IP address which is already being used, unless the DHCP server tells us to change it. Nathan