Ticket #198 (new enhancement)

Opened 9 months ago

Last modified 7 months ago

Local only services

Reported by: yavor Assigned to: lennart
Priority: major Milestone:
Component: avahi-core Version:
Keywords: Cc:

Description

This is a feature that is implemented in Bonjour, but it is missing from Avahi. When using Bonjour, one can call DNSServiceRegister with parameter kDNSServiceInterfaceIndexLocalOnly (defined as -1). This registration will result in local only service.

This feature is really powerful on the Desktop. For example you can publishing DAAP services, which can be picked up by music players like Rhythmbox, Banshee, Amarok etc. Anyone that knows DAAP. Only processes on same machine can see those services.

I made a patch attempting to implement the feature.

Basically I was able to transfer registered local services into the cache without receiving messages on the network. Of course that is just one step. The cache needs to be kept up to date. I used the following call to test:

avahi_server_add_service(server, group, 1, AVAHI_PROTO_UNSPEC,

AVAHI_PUBLISH_NO_ANNOUNCE, "My Service Name", "_daap._tcp", NULL, NULL, 7777, "foo", NULL);

I used avahi-0.6.21 source.

Attachments

patch.txt (2.1 kB) - added by yavor on 02/12/08 23:13:00.
patch
avahi-core.patch (1.8 kB) - added by Arthur_van_Hoff@Dell.com on 04/23/08 19:59:20.
Patch to enable LOOPBACK interface.
avahi-utils.patch (9.4 kB) - added by Arthur_van_Hoff@Dell.com on 04/23/08 20:00:32.
Patch to add -i option to specify an interface to avahi command line tools.
avahi-man.patch (1.7 kB) - added by Arthur_van_Hoff@Dell.com on 04/23/08 20:01:11.
Patch to document -i option in for avahi tools.

Change History

02/12/08 23:13:00 changed by yavor

  • attachment patch.txt added.

patch

04/16/08 06:11:24 changed by Arthur_van_Hoff@Dell.com

This is a feature that we would love to see in the general distribution. I applied the suggested patch and verified that it worked on svn revision 1746.

It would be nice to add a AVAHI_IF_LOCALONLY constant with value 1.

Specifying an invalid interface index currently does not result in an error, but it really should. You can check if an interface is valid using if_indextoname from net/if.h.

The avahi-publish command should have an optional -i argument to specify the interface index on which to publish.

04/19/08 23:17:40 changed by Arthur_van_Hoff@Dell.com

There are some problems with this patch. After a while (presumably when the service is reregistered) duplicates start showing up. I'm looking for an alternative solution.

04/23/08 19:59:20 changed by Arthur_van_Hoff@Dell.com

  • attachment avahi-core.patch added.

Patch to enable LOOPBACK interface.

04/23/08 20:00:32 changed by Arthur_van_Hoff@Dell.com

  • attachment avahi-utils.patch added.

Patch to add -i option to specify an interface to avahi command line tools.

04/23/08 20:01:11 changed by Arthur_van_Hoff@Dell.com

  • attachment avahi-man.patch added.

Patch to document -i option in for avahi tools.

04/23/08 23:21:01 changed by Arthur_van_Hoff@Dell.com

I've attached a patch to enable the LOOPBACK interface. This allows for the registration of services that are only locally accessible.

I've also attached a patch for avahi-publish, avahi-browse, and avahi-resolve which adds a -i argument to each command to specify an interface. This is useful for testing this change.