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 netfilter/nftables fields #926

Merged
merged 3 commits into from
Feb 26, 2018
Merged

Conversation

faern
Copy link
Contributor

@faern faern commented Feb 25, 2018

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.

Was able to move some of them up one level so they are valid on more
platforms with less duplication
@rust-highfive
Copy link

r? @alexcrichton

(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;
Copy link
Contributor Author

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?

Copy link
Member

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!

@alexcrichton
Copy link
Member

@bors: r+

Thanks!

@bors
Copy link
Contributor

bors commented Feb 26, 2018

📌 Commit b89d662 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Feb 26, 2018

⌛ Testing commit b89d662 with merge 8650afb...

bors added a commit that referenced this pull request Feb 26, 2018
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.
@bors
Copy link
Contributor

bors commented Feb 26, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 8650afb to master...

@bors bors merged commit b89d662 into rust-lang:master Feb 26, 2018
@faern faern deleted the add-netfilter-fields branch February 26, 2018 11:36
bors added a commit that referenced this pull request Apr 30, 2021
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`.
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.

4 participants