#nftables #netfilter #firewall #iptables #nft

sys no-std nftnl-sys

Low level FFI bindings to libnftnl. Provides low-level userspace access to the in-kernel nf_tables subsystem

7 releases (breaking)

0.6.1 Feb 11, 2022
0.6.0 Nov 23, 2020
0.5.0 Jun 4, 2020
0.4.0 May 27, 2020
0.1.0 Sep 19, 2018

#738 in Unix APIs

Download history 4799/week @ 2024-03-14 7061/week @ 2024-03-21 3311/week @ 2024-03-28 4406/week @ 2024-04-04 5039/week @ 2024-04-11 3501/week @ 2024-04-18 3915/week @ 2024-04-25 4108/week @ 2024-05-02 3894/week @ 2024-05-09 5642/week @ 2024-05-16 4484/week @ 2024-05-23 3626/week @ 2024-05-30 3286/week @ 2024-06-06 4210/week @ 2024-06-13 4251/week @ 2024-06-20 2273/week @ 2024-06-27

14,729 downloads per month
Used in nftnl


6.5K SLoC


Low level FFI bindings to libnftnl, a userspace library providing a low-level netlink programming interface (API) to the in-kernel nf_tables subsystem.

See nftnl for a higher level safe abstraction.

Linking to libmnl and libnftnl

By default this crate uses pkg-config to find and link to its C dependencies, libmnl and libnftnl. To manually configure where to look for these libraries, set the environment variables LIBMNL_LIB_DIR and LIBNFTNL_LIB_DIR to point to the directories where libmnl.so (or libmnl.a) and libnftnl.so (or libnftnl.a) reside.

Selecting version of libnftnl

This crate has bindings for most versions of libnftnl. All bindings are generated by bindgen via the generate_bindings.sh script in this repository.

Only one version of libnftnl can be exposed via this crate. By default the crate exports the bindings for the oldest supported version (libnftnl-1.0.6). To get newer versions activate the corresponding features. See Cargo.toml for available features/versions.

So for example, to get bindings to libnftnl-1.0.9 depend on this crate like this:

nftnl-sys = { version = "0.1", features = ["nftnl-1-0-9"] }

License: MIT/Apache-2.0