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

Add Ipv6MulticastHops as socket option #2234

Merged

Conversation

sgasse
Copy link
Contributor

@sgasse sgasse commented Nov 29, 2023

What does this PR do

This PR adds the socket option Ipv6MulticastHops. With it, we can set the hop limit for all IPv6 multicast packets sent over a socket. It is equivalent to the following libc call:

let ret = unsafe {
    libc::setsockopt(
        socket.as_raw_fd(),
        libc::IPPROTO_IPV6,
        libc::IPV6_MULTICAST_HOPS,
        &[HOP_LIMIT] as *const _ as *const libc::c_void,
        std::mem::size_of::<libc::c_int>() as u32,
    )
};
Errno::result(ret)

If every packet shall have the same hop limit, this is an alternative to adding a control message.

Checklist:

  • I have read CONTRIBUTING.md
  • I have written necessary tests and rustdoc comments
  • A change log has been added if this PR modifies nix's API

sgasse added a commit to sgasse/nix that referenced this pull request Nov 29, 2023
@sgasse sgasse force-pushed the sgasse/feature/sockopt_multicast_hops branch from f8923c7 to 250e971 Compare November 29, 2023 07:28
sgasse added a commit to sgasse/nix that referenced this pull request Nov 29, 2023
@sgasse sgasse force-pushed the sgasse/feature/sockopt_multicast_hops branch from 250e971 to 2b80d78 Compare November 29, 2023 07:39
@sgasse sgasse force-pushed the sgasse/feature/sockopt_multicast_hops branch from 2b80d78 to 424fb36 Compare November 29, 2023 07:48
@SteveLauC SteveLauC added this pull request to the merge queue Dec 4, 2023
Merged via the queue into nix-rust:master with commit 75bddf2 Dec 4, 2023
34 checks passed
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

Successfully merging this pull request may close these issues.

3 participants