lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Strategy Question for DHCP


From: Robert Deschambault
Subject: Re: [lwip-users] Strategy Question for DHCP
Date: Fri, 19 Jun 2015 15:16:31 -0400

I will have to do a better job of reviewing the suggestions for the updated code.  I disabled too much and the autoip wouldn't increment the IP address at all with multiple targets.  I put it back to the way it was and it works great, but I still see the IP address getting re-assigned when boot jumps to main or main jumps to boot.  But I think you have the right idea, I just have to implement it better.

On Fri, Jun 19, 2015 at 1:28 PM, Robert Deschambault <address@hidden> wrote:
Thanks for reminding me of the automatic increment of the IP address.  I was reviewing the code from v1.4.1 and the master branch and we are using v1.3.2.  I noticed that the newer code base no longer increments the IP address.  I had updated the code in the boot loader not to increment but had forgotten to make the same fix in the main program (I know they should be using the same code base ... ).  So now when I unplug the cable in main, it does not increment the IP address.  All is wonderful for one target.  I will move on to a multiple target situation.

On Fri, Jun 19, 2015 at 12:26 PM, Zach Smith <address@hidden> wrote:

Here is what I can tell you. The targets are auto configuring themselves in the range you define. In the default (RFC compliant) range there are 254*256 possibilities. So it is highly unlikely that 2 nodes will choose the same one. But if so, then yes they discover each other by use of ARP. If a conflict is found, the host increments its address and tries again. I think you are right that there is no lease time concept. Once the host chooses and auto ip address and determines it is available then it keeps it.

 

DHCP will continue to run sending DHCP discover messages periodically. So, if a dhcp server comes on line then eventually the host will get a new IP address assigned by the DHCP server and abandon the autoip self-configured address.

 

Regarding the Ethernet link, every time the Ethernet link changes you should call netif_set_link_down() or up() which I believe restarts the whole thing. I think when the network link comes back up, autoip starts at the next incremented address (It might be more desirable to restart at the original address. This may be a source of a possible improvement that could be made to source code?)

 

Have a look at the struct autoip member tried_llipaddr in source code. This is what increments every time an autoip address is tried. On boot up it will be 0 and therefore the initial address tried should be the same every time. Not sure I get exactly what you are describing in number 2 there but regardless, have a look at netif->autoip->tried_llipaddr throughout the source code and you should be able to figure out what is causing it.

 


--
Bob Deschambault


reply via email to

[Prev in Thread] Current Thread [Next in Thread]