[avahi] Publishing Services on Specific Interfaces
Callum wilson
calwilson at live.co.uk
Tue Apr 28 15:43:28 UTC 2020
Hi Peter,
You can use if_nameto_index() to do this, see man page here: http://man7.org/linux/man-pages/man3/if_nametoindex.3.html
That will give you the index from the interfaces name (e.g. eth0, eno1, etc.).
Is that what you’re looking for?
Thanks,
Callum
From: avahi <avahi-bounces at lists.freedesktop.org> on behalf of "Shilliday, Peter" <Peter.Shilliday at garmin.com>
Reply to: Avahi ML <avahi at lists.freedesktop.org>
Date: Tuesday, 28 April 2020 at 16:34
To: "avahi at lists.freedesktop.org" <avahi at lists.freedesktop.org>
Subject: [avahi] Publishing Services on Specific Interfaces
I am integrating avahi-client in a Linux application to publish a TCP-based service on two separate local networks, each on their own interface. Since the service uses the ephemeral TCP port range, the listening port on network #1 and network #2 will almost always be different, so I want to add the service on each network/interface individually as to publish the right port number. It appears avahi_entry_group_add_service() can take an interface index argument for this purpose; how can I look up the index for a given interface/network on my system?
Thanks,
Peter Shilliday
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/avahi/attachments/20200428/95be0c21/attachment.htm>
More information about the avahi
mailing list