<div dir="ltr"><div>Hi Guys,</div><div><br></div><div>I'm using 'getaddrinfo' to resolve .local hostnames in an application. However I've encountered a scenario in which the address being returned for a device is a self-assigned IPv4 address (169.254.X.X) that can't be reached on any interface by the host machine. I'm assuming this because the host machine has received an IPv4 address via the DHCP server and therefore there is no reason to also have a self-assigned address?</div><div><br></div><div>It is my understanding that 'getaddrinfo' will ultimately use Avahi to resolve .local hostnames as defined in the 'hosts:' line of the 'nsswitch.conf' file. It is also my understanding according to this old thread (<a href="http://lists.freedesktop.org/archives/avahi/2009-May/001644.html">http://lists.freedesktop.org/archives/avahi/2009-May/001644.html</a>), that by design Avahi returns only one IP address when resolving.</div><div><br></div><div><span style="font-size:12.8px">As such, I'd like to better understand why </span>'getaddrinfo'<span style="font-size:12.8px"> is returning an unreachable address for a host. Is this a bug in Avahi?</span><br></div><div><br></div><div>The device in question has three addresses (1 self-assigned IPv4, 1 DHCP-assigned IPv4, and 1 IPv6). <span style="font-size:12.8px">If by design Avahi will only return a single address to 'getaddrinfo', why isn't it returning a reachable address?</span></div><div><br></div><div>If I force binding a self-assigned address via '<span style="font-size:12.8px">avahi-autoipd --force-bind eth0', then I'm able to communicate with the device. Alternatively, if I force communication over IPv6, I'm also able to communicate with the device.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">However, both of the above mentioned techniques aren't really suitable solutions. It seems inappropriate and potentially problematic for an application to bind a self-assigned IP address to an interface, and relying solely on IPv6 to communicate won't work if the user has disabled IPv6 addressing (perhaps for compatibility reasons).</span></div><div><br></div><div>How do I go about fixing this issue?</div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">-Jared</span></div><div><br></div><br></div>