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 <[email protected]> on behalf of "Shilliday, Peter" <[email protected]> Reply to: Avahi ML <[email protected]> Date: Tuesday, 28 April 2020 at 16:34 To: "[email protected]" <[email protected]> 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
_______________________________________________ avahi mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/avahi
