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.

From: [email protected] 
[mailto:[email protected]] On Behalf Of 
Robert Deschambault
Sent: Friday, June 19, 2015 9:52 AM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] Strategy Question for DHCP

Ok, now that I have autoip working, I need some advice on how to use this 
feature properly.  Right now, I can see my target self assign a local link 
address.  I tried some experiments to see how autoip behaves.

1. I tried unplugging my Ethernet cable from the switch and I see the target 
self assign a new IP address.  I assume that is the expected response as there 
doesn't seem to be any concept of lease time like DHCP.  Is this expected 
behavior?  Is there any interaction with my Windows Ethernet connection?  I see 
ARP requests in my wireshark record between the target and the Windows host 
which essentially tells the target that the IP address has already been 
assigned for that IP address.

2. I have two programs in my flash, a boot loader and a main application.  The 
way we update is to send a command in the main application, which restarts the 
target and runs the boot loader.  So the Ethernet link is dropped when we jump 
to boot.  I saw that when the software jumped to boot it still acquired the 
same IP, but when the main restarted it renegotiated and came up with a new IP. 
 On the first jump it is imperative that we jump to the same IP address from 
main to boot, otherwise the load will fail.  Right now I only have one target 
connected, but in a real system there are up to 12 targets.  We only update one 
target at a time.  Will our approach work or will we have to do something 
drastic with the Ethernet links and reset them or recycle power?

Any comments or tips would be greatly appreciated.

Thanks.

--
Bob Deschambault
________________________________
Confidentiality Notice: This e-mail may contain confidential and privileged 
material for the sole use of the intended recipient(s). Any review, use, 
distribution or disclosure by others is strictly prohibited. If you are not the 
intended recipient (or authorized to receive from the recipient), please 
contact the sender by reply e-mail and delete all copies of the message.
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to