Questions on Implementing Auto-IP
Posted: Tue Sep 13, 2011 6:32 pm
I'm working on implementing Auto-IP (i.e. random 169.254.x.x IP selection). So far I haven't found reference to anyone else doing this.
In a nutshell, if DHCP fails then I want to generate an Auto-IP address. Once you pick a random address you do an ARP Probe to make sure no one else is using that IP already by sending an ARP Request with the configured IP as the source address. You have to be able to detect collisions and listen for matching ARP reply/requests/probes for the chosen IP.
Other than the ShowArp() which just prints the ARP table, I haven't found anything else documented on sending/processing ARP's. I've waded through ARP.cpp but am not quite certain which calls are appropriate for me to access to accomplish this.
SendGratuitousArp() ? or SendArp()? What is the best way to detect if there is a collision or determine if my IP is already in use other than just traversing the Arp table again?
Thanks.
Scott
In a nutshell, if DHCP fails then I want to generate an Auto-IP address. Once you pick a random address you do an ARP Probe to make sure no one else is using that IP already by sending an ARP Request with the configured IP as the source address. You have to be able to detect collisions and listen for matching ARP reply/requests/probes for the chosen IP.
Other than the ShowArp() which just prints the ARP table, I haven't found anything else documented on sending/processing ARP's. I've waded through ARP.cpp but am not quite certain which calls are appropriate for me to access to accomplish this.
SendGratuitousArp() ? or SendArp()? What is the best way to detect if there is a collision or determine if my IP is already in use other than just traversing the Arp table again?
Thanks.
Scott