Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Socket interface using interface index #458

Open
jorritolthuis opened this issue Jul 25, 2023 · 1 comment
Open

Set Socket interface using interface index #458

jorritolthuis opened this issue Jul 25, 2023 · 1 comment

Comments

@jorritolthuis
Copy link

In C, one can set a socket's interface using setsockopt(socket, SOL_IP, IP_MULTICAST_IF, &mreqn, sizeof(mreqn)) where mreqn is

struct ip_mreqn {
    struct in_addr imr_multiaddr; /* IP multicast group address */
    struct in_addr imr_address;   /* IP address of local interface */
    int            imr_ifindex;   /* interface index */
};

sockets2 offers the set_multicast_if_v4 function, but only accepts an address as parameter. I would like to set the interface using sockets2 based on an interface index.

@Thomasdezeeuw
Copy link
Collaborator

A pr for this would be welcome. We'll have to look at how the ip_mreqn type would look as it needs to be cross platform(-ish). Another point is the migration of the API as we can't have breaking changing, but in future version we'll want a single function for IP_MULTICAST_IF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants