Add netfilter constants to Linux#911
Conversation
|
Thanks! Looksl ike CI may be failing though? |
87591a5 to
5739364
Compare
|
Yup. Was trying to figure out why. |
29db4bc to
7a8a5ec
Compare
|
Hm I wonder if it's a missing header file? I'm not too familiar with netlink unfortunately :( In any case it should be fine to only define the constants on glibc (but still linux) if necessary! |
907219e to
b4d6885
Compare
|
Yes, it seems Now there is a lot of duplication between Linux and Android. But I don't find any other place where you share values between them, so I guess this is the preferred method. |
|
@bors: r+ |
|
📌 Commit 4d5ed47 has been approved by |
Add netfilter constants to Linux Constants and enums from [`netfilter.h`] and [`nf_tables.h`]. I was not really sure what to do with the enums, for example `nf_tables_msg_types`. But since I could not find a C enum mapped into a Rust enum in this crate I assumed you wanted them as constants instead. I also wanted to get the `nf_inet_addr` union in here. But I did not find any unions in this crate so I was not sure how you would prefer it represented. There are of course a billion more netfilter constants and types to map. But this is a good start. [`netfilter.h`]: https://github.com/torvalds/linux/blob/ead751507de86d90fa250431e9990a8b881f713c/include/uapi/linux/netfilter.h [`nf_tables.h`]: https://github.com/torvalds/linux/blob/ead751507de86d90fa250431e9990a8b881f713c/include/uapi/linux/netfilter/nf_tables.h
|
☀️ Test successful - status-appveyor, status-travis |
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.
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`.
Constants and enums from
netfilter.handnf_tables.h.I was not really sure what to do with the enums, for example
nf_tables_msg_types. But since I could not find a C enum mapped into a Rust enum in this crate I assumed you wanted them as constants instead.I also wanted to get the
nf_inet_addrunion in here. But I did not find any unions in this crate so I was not sure how you would prefer it represented.There are of course a billion more netfilter constants and types to map. But this is a good start.