Skip to content

Set Socket interface using interface index #458

Description

@jorritolthuis

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.

Activity

  1. Thomasdezeeuw commented on Jul 25, 2023

    @Thomasdezeeuw
    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

  2. added this to the v0.6 milestone on Jan 25, 2025
  3. removed this from the v0.6 milestone on Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions