AutoIP


AutoIP is a mechanism patented by Microsoft that automatically assigns a unique link-local address to the network interface and is compatible with Windows 98 and later and Macintosh OS 8.x and later. Please contact to your legal office about the use of AutoIP regarding U.S. 499 patent  (http://www.ietf.org/ietf/IPR/MICROSOFT-499).

    IPAutoConfig(); // Enable AutoIP
    do {
        IPGetAlias(NULL, addr);
    } while (IP_ADDR_NE(addr, IPAddrAny));

If AutoIP is enabled with IPAutoConfig(), the interface alias address will be configured to one of the link-local 169.254/16 class B address. It will take up to 80 seconds till the link-local address is assigned. Though it is very unlikely, AutoIP can also fail in a congested network. AutoIP and DHCP can be used at the same time (i.e., the network interface can have two IP addresses).

AutoIP can also be used with SOStartup() using the following code:

    #include <private/so.h>

    SOConfig config;

    config.flag |= SO_FLAG_ZEROCONF;
    SOStartup(&config);