[avahi] Advertizing a service only on the local machine

jbagg jbagg at lenbrook.com
Wed Dec 14 20:23:42 UTC 2016

On 2016-12-13 05:34 PM, Till Kamppeter wrote:
> On 12/13/2016 08:22 PM, jbagg wrote:
>> I suspect you need to pass the ID of the local loopback network
>> interface instead of AVAHI_IF_UNSPEC.  From the avahi api
>> doc..."interface: The interface this service shall be announced on. We
>> recommend to pass AVAHI_IF_UNSPEC here, to announce on all interfaces."
> And what is the ID of the local loopback network interface? This 
> parameter must be given as an integer number.
>    Till
Good question.  I would experiment with *getifaddrs()*.  Maybe if "lo" 
is the 2nd in the list, you pass integer 1, I don't know.


uint32_t n = 0;
for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next)
     if (!(strcmp(ifa->ifa_name, "lo")))

Jonathan Bagg
Embedded Systems Developer
NAD Electronics | Lenbrook Industries Limited
633 Granite Court, Pickering, Ontario, Canada L1W 3K1 | 905-831-0799 ext 4478 | http://www.nadelectronics.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/avahi/attachments/20161214/feb82c84/attachment.html>

More information about the avahi mailing list