[avahi] Local only services

Lennart Poettering lennart at poettering.net
Wed Feb 13 12:10:44 PST 2008


On Wed, 13.02.08 11:28, Yavor Goulishev (ygoulishev at gmail.com) wrote:

> Hi Lennart,
> It is not that ugly shortcut ;-), but yeah this is a hack.(BTW Bonjour is
> doing it in similar way. Nothing goes on the network for local services.
> Everything is in memory. I don't know their reasons, but I sure do know
> mine.)

Hehe, I am not sure if "Bonjour does it this way" is a good excuse ;-)

> Reading through  your  plan for  this  I recall removing the code for
> filtering the interfaces.
> And I also recall having problems using the loopback interface to do the
> multicast.
> It might be just me, but I couldn't get this working and I've seen comments
> that the kernel doesn't route multicast messages on the loopback interface.
> Frankly I haven't confirmed this myself, but definitely couldn't get it to
> work.

Yes, I was expecting something like this. But based on the interface
flags we can easily determine if an interface is loopback (IFF_LOOPBACK)
and if so, we can just shortcut the traffic by handing the packets
directly from the send to receive function.

Loopback interfaces are not necessarily known as "lo" and also don't
necessarily have index 1. The right way to detect them is using
IFF_LOOPBACK (on BSD and Linux at least I think).

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net         ICQ# 11060553
http://0pointer.net/lennart/           GnuPG 0x1A015CC4


More information about the avahi mailing list