[avahi] Per-interface fds

Zachary Loafman zml+avahi at zml.net
Mon Aug 27 10:42:06 PDT 2007


On 8/27/07, Lennart Poettering <lennart at poettering.net> wrote:
> On Mon, 27.08.07 09:17, Zachary Loafman (zml+avahi at zml.net) wrote:
>
> > However, after digging into it, and glancing at mDNSResponder for
> > curiousity, I think I like your way better. Looks like mDNSResponder
> > uses IP_MULTICAST_IF and per-interface fds, but doesn't solve the bind
> > issue (uses INADDR_ANY). That seems like a poor idea.
> >
> > I'll keep digging on a better way for the BSDs. I submitted the simple
> > patch on the bug, its only real flaw is performance (2 syscalls per
> > send), and a lack of thread atomicity (two threads trying to send out
> > the same fd may stomp on each other). I'm more worried about the
> > latter, but it doesn't look like a big deal right now.
>
> For Avahi perfomance difference between one or two syscalls doesn't
> really matter I would say. It's not that we are hacking a low-latency
> rt audio server here...
>
> Avahi doesn't use threads, so the thread atomicity issue doesn't count
> ;-)

Yup, agreed on both counts. I've dug in further, even glanced at the
kernel code. It looked like the MSG_DONTROUTE option might actually do
what we want in conjunction with SENDSRCADDR, but the !@# kernel code
doesn't pay attention to the src addr when DONTROUTE is set, just the
dest addr (I find this dumb, it seems like DONTROUTE should trust the
caller a bit more). As such, I think the patch I submitted may be the
only way without a bigger, unnecessary overhaul.

...Zach


More information about the avahi mailing list