Use IPV6_HDRINCL in set_header_included_v6() on Linux#563
Merged
Conversation
f26a032 to
ba422c8
Compare
…INCL. This patch adds a configuration that alters the value to set in set_header_included_v6()
Thomasdezeeuw
approved these changes
Mar 16, 2025
Thomasdezeeuw
left a comment
Collaborator
There was a problem hiding this comment.
I can't find any mentions of this in the manual or on kernel.org, only in the source: https://github.com/torvalds/linux/blob/cb82ca153949c6204af793de24b18a04236e79fd/net/ipv6/raw.c#L1001
But, I think the patch is correct.
Contributor
Author
|
Thank you @Thomasdezeeuw for reviewing and approving! Yeah, I didn't find it anywhere either and it took time for me to find out why it didn't work as expected. I found it finally when I greped Linux header files. I'm glad no one else will have to dig into it again in the future! |
Hasan6979
pushed a commit
to NordSecurity/socket2
that referenced
this pull request
May 15, 2025
Instead of IP_HDRINCL in Socket:: set_header_included_v6.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a platform-specific configuration to use IPV6_HDRINCL in set_header_included_v6() on Linux.
Background: Linux has defined IPv6 specific constant IPV6_HDRINCL (36) that needs to be used when setting HDRINCL socket option instead of IP_HDRINCL (2). Without it, set_header_included_v6() function does not work as expected and a kernel provided header is added to packets sent even if
set_header_included_v6(true)is called on a raw socket.src/socket.rs: Added conditional compilation forIPV6_HDRINCLon Linux andIP_HDRINCLon non-Linux systems to thesetsockoptfunction.src/sys/unix.rs: Added conditional use oflibc::IPV6_HDRINCLfor Linux systems.