Hi Lennart,<br>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.)<br>
<br>Reading through your plan for this I recall removing the code for filtering the interfaces.<br>And I also recall having problems using the loopback interface to do the multicast.<br>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.<br>
Frankly I haven't confirmed this myself, but definitely couldn't get it to work.<br><br>Another thought just came to my mind. The loopback interface is actually addressable with index 1. <br>I'm not sure whether this is is always the case, but at least on my testing index 1 was always the loopback.<br>
<br>So if the loopback can be used (and I'm wrong about the kernel) and the loopback is always addressable with index 1 then the avahi-core can use it if nothing else is available or if explicitly requested. This shouldn't be hard to code, right?<br>
<br>--Yavor<br><br><br><div class="gmail_quote">On Feb 13, 2008 2:57 AM, Lennart Poettering <<a href="mailto:lennart@poettering.net" target="_blank">lennart@poettering.net</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>On Tue, 12.02.08 12:07, Yavor Goulishev (<a href="mailto:ygoulishev@gmail.com" target="_blank">ygoulishev@gmail.com</a>) wrote:<br><br>> Great!<br>> I really need this feature.<br>> BTW I tried implementing something, but I'm not that much familiar with the<br>
> avahi internals.<br>> I'm attaching my patch. Basically I was able to transfer registered local<br>> services into the cache without receiving a messages on the network.<br>> Of course that is just one step. The cache needs to be kept up to date.<br>
> I used the following call to test:<br>> avahi_server_add_service(server, group, 1, AVAHI_PROTO_UNSPEC,<br>> AVAHI_PUBLISH_NO_ANNOUNCE, "My Service Name", "_daap._tcp", NULL, NULL,<br>> 7777, "foo", NULL);<br>
><br>> I used avahi-0.6.21 source.<br><br></div>Uh. This doesn't look right to me. I think the better way to handle<br>this is to change the way Avahi currently deals with interfaces. Right<br>now, Avahi ignores all interfaces that are POINTOPOINT, LOOPBACK or<br>
lack MULTICAST. I think it would be better to not ignore LOOPBACK<br>unconditionally. Instead we should deal with it like any other<br>interface, howver with the special excpetion, that AVAHI_IF_UNSPEC<br>does not match it, unless there it is the only interface available.<br>
<br>I would suggest a solution like this: We add a new definition<br>AVAHI_IF_LOOPBACK = -2. Then, if a RR is registered, and a positive<br>ifindex is passed, we just do our work as usual on the specified<br>interface. If -1 is passed as ifindex (i.e. AVAHI_IF_UNSPEC), we use<br>
the loopback interface if no real interfaces are known, or the real<br>interfaces if they are available but in that case we don't use the<br>loopback to avoid duplicate instanes. If -2 is passed this is treated<br>like a positive ifindex for the loopack device.<br>
<br>The difficulty of course comes when we have to move a service between<br>the loopback device and a real device everytime the network is<br>configured/unconfigured.<br><br>This scheme would not only fix your problem but also #92. Also, it<br>
doesn't require any ugly shortcuts etween the zone and the cache.<br><br>Patches welcome! Unless they introduce those 36h days I don't think I<br>will have the time to implement something like this anytime soon.<br>
<div><div></div><div><br>Lennart<br><br>--<br>Lennart Poettering Red Hat, Inc.<br>lennart [at] poettering [dot] net ICQ# 11060553<br><a href="http://0pointer.net/lennart/" target="_blank">http://0pointer.net/lennart/</a> GnuPG 0x1A015CC4<br>
_______________________________________________<br>avahi mailing list<br><a href="mailto:avahi@lists.freedesktop.org" target="_blank">avahi@lists.freedesktop.org</a><br><a href="http://lists.freedesktop.org/mailman/listinfo/avahi" target="_blank">http://lists.freedesktop.org/mailman/listinfo/avahi</a><br>
</div></div></blockquote></div><br>