[avahi] AXIS Cameras, Again

Mark Gollahon mgollahon at exacq.com
Thu Jun 28 14:40:55 PDT 2007


 > On Tue, 26.06.07 08:58, Mark Gollahon (mgollahon at exacq.com) wrote:

 > > Hello,
 > >
 > > I've read the AXIS camera thread posted on this forum from over a year
 > > ago and I would like some help on getting my code working with Avahi.
 > >
 > > Some background - I've written my own AXIS camera "finder" utility 
using
 > > Apple's daemon since I needed it on Windows first (no Avahi on Windows
 > > yet).  I've subsequently ported it to Linux.  Now I need it to work 
with
 > > Avahi since the newer distros are including Avahi by default.
 > >
 > > Furthermore, this utility sends the resulting list of cameras and IP
 > > addresses to a recipient that is *not* link-local, so the routeable IP
 > > addresses are really what I am after.  However, I can't figure out how
 > > to get Avahi to report all addresses it has so that I can do the
 > > filtering - I've already got the filtering in place.
 > >
 > > I've noticed that PING can get the routeable addresses through NSS, 
but
 > > my utility cannot (it uses getaddrinfo() to get all addresses 
instead of
 > > gethostbyname() like PING does).
 > >
 > > Can someone tell me what parameters I need to use with 
getaddrinfo() to
 > > get the routeable addresses through Avahi?
 >
 > Internally there is no difference between the implementation of
 > getaddrinfo() and gethostbyname() when it comes to nss-mdns. If there
 > are multiple IP adresses defined for a single host name the IP address
 > that is returned by either of these functions depends on the order
 > the the ip addresses were send to us. Only a single IP address is
 > returned at max.
 >
 > When Avahi is used on the machine that registered the host name we
 > currently make sure only to publish the public IP address if there are
 > multiple defined, and fall back to IPv4ll addresses only if no public
 > address is defined. Also, avahi registers only a single IP addres per
 > interface at max. This behaviour is the right thing to do, btw,
 > because that way we guarantee best interoperability with clients that
 > do not set up IPv4ll-routes when a public address is configured.
 >
 > In short, what you try to do doesn't work with Avahi. Sorry for that.
 >
 > Lennart

Hi, Lennart - thank you for responding!

Unfortunately I am *not* using Avahi on a machine that is _registering_ 
a name; I am using it on a machine that is _resolving_ a name.  Now, I 
understand that multiple addresses is a "corner case" for this kind of 
application (usually there will only be one address per name), but 
restricting Avahi to *only* returning one address for a name seems 
counterproductive to me - especially in light of 
DNS/NSS/getaddrinfo()/etc. being able to return multiple addresses.

Even if you didn't want to change to returning multiple addresses,  A 
possible remedy (at least one that would work in my situation) would be 
to apply the same rules as registering a name to resolving a name (i.e. 
return a public address if one is available, otherwise fall back to a 
link-local address).  This would be better than making the address 
returned dependent on the order that Avahi received the addresses in.  
Is this possible?

Regards,
-Mark Gollahon


More information about the avahi mailing list