-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 netfilter/nftables fields #926
Conversation
Was able to move some of them up one level so they are valid on more platforms with less duplication
(rust_highfive has picked a reviewer for you, use r? to override) |
@@ -148,6 +148,9 @@ cfg_if! { | |||
pub enum FILE {} | |||
pub enum fpos_t {} // TODO: fill this out with a struct | |||
|
|||
pub const INT_MIN: c_int = -2147483648; | |||
pub const INT_MAX: c_int = 2147483647; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are only two of the limits from limits.h
. Needed since I need to reach the min and max integers for other constants within libc
. I could not use c_int:min_value()
since that does not work as a constant function on Rust 1.0. And I could not use core::i32::MIN
because I could not use core
on some platforms. Is the latter expected or did I do something wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah yeah redefining these here are fine, but we can probably relax CI in the future!
@bors: r+ Thanks! |
📌 Commit b89d662 has been approved by |
Add netfilter/nftables fields Adding a few missing `NF_` constants to more complete the story around that header. Then most importantly add a lot of `NFT_` constants needed in my nftables library. Some were added back in #911, but as the library grew I realized I needed more constants.
☀️ Test successful - status-appveyor, status-travis |
Make netfilter constants available for musl Linux targets The netfilter constants added in #911 and #926 are currently only available for Linux targets using glibc because they weren't available in the musl-sanitized kernel headers at the time these PRs were made. With current versions of the sanitized headers, these constants are available, and this PR moves them to `unix/linux_like/linux/mod.rs` so that they can be used on targets using musl libc. The kernel header version currently set in `ci/install_musl.sh` already supports these constants, but has different values for e.g. `NFT_TABLE_MAXNAMELEN` than the ones that were already defined for glibc. It seems like the maximum name length for various netfilter objects has been changed in the kernel (the respective commits are [1](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux/netfilter/nf_tables.h?id=e46abbcc05aa8a16b0e7f5c94e86d11af9aa2770) [2](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux/netfilter/nf_tables.h?id=b7263e071aba736cea9e71cdf2e76dfa7aebd039) [3](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux/netfilter/nf_tables.h?id=387454901bd62022ac1b04e15bd8d4fcc60bbed4) and [4](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux/netfilter/nf_tables.h?id=615095752100748e221028fc96163c2b78185ae4)). To match these values with the ones that were already defined, this PR also updates the used kernel header version in `ci/install_musl.sh`.
Adding a few missing
NF_
constants to more complete the story around that header. Then most importantly add a lot ofNFT_
constants needed in my nftables library. Some were added back in #911, but as the library grew I realized I needed more constants.