|
From: | Robert Deschambault |
Subject: | Re: [lwip-users] Strategy Question for DHCP |
Date: | Fri, 19 Jun 2015 13:28:36 -0400 |
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.
[Prev in Thread] | Current Thread | [Next in Thread] |