[avahi] Avahi and new Apple Airports
Daniel Barkalow
barkalow at iabervon.org
Wed Sep 5 12:22:12 PDT 2012
This weekend I was trying to get my laptop to print to a printer attached
to an Apple Airport I got this summer. After a bunch of investigation,
this is what I found:
The Airport is acting as a bridge, so it gets an address from my DHCP
server for its special functions and otherwise just routes everything
through. It also assigns itself an IPv6 link-local address and an IPv4
link-local address.
My laptop gets an address from my DHCP server, and uses that for the
wireless interface. It assigns itself a link-local IPv4 address for the
wired interface (with nothing plugged in). It routes the IPv4 link-local
block to the wired interface.
The airport advertizes all of its addresses, in the order: DHCP-supplied
IPv4, link-local IPv4, link-local IPv6.
Avahi receives this message, stores the DHCP-supplied address, but
immediately discards it in favor of the link-local IPv4 address. It then
supplies the link-local IPv4 address to applications. Any application that
tries to use the link-local address for the airport fails, because their
traffic gets routed out the wired interface connected to nothing (and the
laptop isn't even listening with any link-local address on the wireless
interface, so it wouldn't be able to get responses even if it sent packets
the right way).
I hacked around the problem by having avahi discard all link-local IPv4
addresses, which verified the analysis and got the printer to work for me,
but it's obviously not the right solution.
I think the right solution is to discard an address on a private or
link-local address if the interface we heard about it on doesn't have an
address with that subnet. Sure, the remote device has a couple of
different sorts of addresses, but we're only interested in ones we can
actually use, and not ones that are only available to devices with
addresses of other sorts.
I looked into implementing this for a bit, but there doesn't seem to be a
function that simultaneously deals with the potential for an interface to
have multiple addresses and the need to figure out how to extract the
address from a message.
Of course, it might still be worth having avahi provide multiple addresses
for devices that advertize them, so programs can try each of them if
there's a non-obvious reason for one of them to be unusable.
-Daniel
*This .sig left intentionally blank*
More information about the avahi
mailing list