nftnl-sys

Crates.ionftnl-sys
lib.rsnftnl-sys
version0.6.4
created_at2018-09-19 19:28:42.393633+00
updated_at2025-11-26 12:35:12.97046+00
descriptionLow level FFI bindings to libnftnl. Provides low-level userspace access to the in-kernel nf_tables subsystem
homepage
repositoryhttps://github.com/mullvad/nftnl-rs
max_upload_size
id85545
size1,470,418
appteam-crates.io (github:mullvad:appteam-crates-io)

documentation

README

nftnl-sys

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

pkg-config

By default this crate uses pkg-config to find and link to its C dependencies, libmnl and libnftnl.

Manually

To manually configure where to look for these libraries, either 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, or override the build script to manually set the linker directives for both nftnl and mnl:

# .cargo/config.toml
[target.x86_64-unknown-linux-gnu.nftnl]
rustc-link-lib = ["nftnl", "mnl"]
rustc-link-search = ["<type>=<path-to-libnftnl>", "<type>=<path-to-libmnl>"]

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:

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

License: MIT/Apache-2.0

Commit count: 195

cargo fmt