[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-avahi
Subject:    [avahi] getaddrinfo (Avahi) returning unreachable IP address for .local hostname
From:       Jared Albers <jaredaalbers () gmail ! com>
Date:       2015-12-31 18:29:25
Message-ID: CAJc9tdd74fnQTfDOsU88v7ZDY_pbPgz21BeA3CYymXf9cAcDEg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Guys,

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?

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 (http://lists.freedesktop.org/archives/avahi/2009-May/001644.html),
that by design Avahi returns only one IP address when resolving.

As such, I'd like to better understand why 'getaddrinfo' is returning an
unreachable address for a host. Is this a bug in Avahi?

The device in question has three addresses (1 self-assigned IPv4, 1
DHCP-assigned IPv4, and 1 IPv6). If by design Avahi will only return a
single address to 'getaddrinfo', why isn't it returning a reachable address?

If I force binding a self-assigned address via '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.

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).

How do I go about fixing this issue?

-Jared

[Attachment #5 (text/html)]

<div dir="ltr"><div>Hi Guys,</div><div><br></div><div>I&#39;m using \
&#39;getaddrinfo&#39; to resolve .local hostnames in an application. However I&#39;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&#39;t be reached on any interface \
by the host machine. I&#39;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 \
&#39;getaddrinfo&#39; will ultimately use Avahi to resolve .local hostnames as \
defined in the &#39;hosts:&#39; line of the &#39;nsswitch.conf&#39; 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&#39;d \
like to better understand why  </span>&#39;getaddrinfo&#39;<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 \
&#39;getaddrinfo&#39;, why isn&#39;t it returning a reachable \
address?</span></div><div><br></div><div>If I force binding a self-assigned address \
via &#39;<span style="font-size:12.8px">avahi-autoipd --force-bind eth0&#39;, then \
I&#39;m able to communicate with the device. Alternatively, if I force communication \
over IPv6, I&#39;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&#39;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&#39;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>


[Attachment #6 (text/plain)]

_______________________________________________
avahi mailing list
avahi@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/avahi


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic