Skip to content

support PKTINFO cmsgs for Linux/macOS/iOS - #891

Closed
mcginty wants to merge 1 commit into
nix-rust:masterfrom
mcginty:ipv6-pktinfo
Closed

mcginty wants to merge 1 commit into
nix-rust:masterfrom
mcginty:ipv6-pktinfo

Conversation

@mcginty

@mcginty mcginty commented Apr 25, 2018

Copy link
Copy Markdown

The libc changes have been merged (rust-lang/libc#980) now, so looks like it's finally time to submit a PR for this :).

@asomers asomers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please enable IPV6_PKTINFO on FreeBSD, and check the other BSDs to see if any of them support it. Also, can you write a test for this? The cmsg code is devilishly difficult; it would be great to have some test coverage for every supported message type.

Comment thread src/sys/socket/mod.rs
&*(cmsg_data.as_ptr() as *const _)))
},
#[cfg(any(target_os = "linux", target_os = "android", target_os = "macos", target_os = "ios"))]
(libc::IPPROTO_IPV6, libc::IPV6_PKTINFO) => unsafe {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FreeBSD also defines IPV6_PKTINFO. I haven't checked on any of the other BSDs.

@mcginty

mcginty commented Apr 28, 2018 via email •

Copy link
Copy Markdown
Author

@asomers

asomers commented Apr 28, 2018

Copy link
Copy Markdown
Member

I'll wait for the libc PR. libc usually merges stuff quickly.

@mcginty

mcginty commented May 1, 2018

Copy link
Copy Markdown
Author

new libc PR submitted: rust-lang/libc#983

@sjtakada

sjtakada commented Nov 4, 2018

Copy link
Copy Markdown

I'm curious if this is still in progress, because I also need PKTINFO.

Comment thread src/sys/socket/mod.rs
Some(ControlMessage::ScmTimestamp(
&*(cmsg_data.as_ptr() as *const _)))
},
#[cfg(any(target_os = "linux", target_os = "android", target_os = "macos", target_os = "ios"))]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lists should be alphabetized (android, ios, linux, macos). This applies to all of your #[cfg attributes.

Comment thread CHANGELOG.md
([#857](https://github.com/nix-rust/nix/pull/857))
- Added `request_code_write_int!` on FreeBSD/DragonFlyBSD
([#833](https://github.com/nix-rust/nix/pull/833))
- Added PKTINFO cmsg support on Linux/macOS/iOS.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to "Added `PKTINFO` support for `cmsg` on ... platforms" (note the backticks)

@pusateri

Copy link
Copy Markdown
Contributor

I've updated @mcginty original changes to work with the lastest master in my ipv6_pktinfo branch. How do I contribute them to this pull request? I only see options for creating a new pull request.

@mcginty

mcginty commented Nov 23, 2018

Copy link
Copy Markdown
Author

@pusateri sorry I've been MIA on this PR. I'm happy to close this pull request in favor of a new one you open. You have my blessing to either include my commits in that PR or squash them so it's simply under your name 🙂

@pusateri

Copy link
Copy Markdown
Contributor

Thanks @mcinty but I don't need credit. Just would like to use this feature. I can push my changes back to your branch if you give me permission. I'm just not familiar with how to update someone else's pull request.

@pusateri

pusateri commented Dec 4, 2018

Copy link
Copy Markdown
Contributor

I submitted a new pull request that updates the changes, adds tests without using pre-configured loopback addresses, adds IPv6_PKTINFO for FreeBSD, and sorts the cfg options. See #990.

@mcginty

mcginty commented Dec 4, 2018

Copy link
Copy Markdown
Author

Sorry for the delay @pusateri. Closing in favor of #990.

@mcginty mcginty closed this Dec 4, 2018
bors Bot added a commit that referenced this pull request Dec 17, 2018
990: Add cmsg PKTINFO for IPv4 and IPv6. r=asomers a=pusateri

Replaces #891 and attempts to address all previous concerns.

Co-authored-by: Tom Pusateri <[email protected]>
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.

5 participants