#firewall #nftables #iptables #netfilter #api-bindings #nft

macro rustables-macros

Internal macros for generation netlink structures for the rustables project

4 releases

new 0.1.2 Oct 10, 2024
0.1.1 Mar 18, 2023
0.1.1-alpha1 Feb 26, 2023
0.1.0 Jan 9, 2023

#8 in #iptables

Download history 1/week @ 2024-06-26 2/week @ 2024-07-03 4/week @ 2024-07-10 3/week @ 2024-07-17 22/week @ 2024-07-24 56/week @ 2024-07-31 62/week @ 2024-08-07 56/week @ 2024-08-14 55/week @ 2024-08-21 52/week @ 2024-08-28 51/week @ 2024-09-04 85/week @ 2024-09-11 93/week @ 2024-09-18 91/week @ 2024-09-25 86/week @ 2024-10-02 211/week @ 2024-10-09

494 downloads per month
Used in rustables

GPL-3.0-or-later

26KB
526 lines

rustables

Crates.io Documentation CI pipeline status License

Safe abstraction for userspace access to the in-kernel nf_tables subsystem. Can be used to create and remove tables, chains, sets and rules from the nftables firewall, the successor to iptables.

This library is a fork of the nftnl-rs crate. Let us thank here the original project team for their great work without which this library would probably not exist today.

This library currently has quite rough edges and does not make adding and removing netfilter entries super easy and elegant. That is partly because the library needs more work, but also partly because nftables is super low level and extremely customizable, making it hard, and probably wrong, to try and create a too simple/limited wrapper. See examples for inspiration.

Understanding how to use the netlink subsystem and implementing this crate has mostly been done by reading the source code for the nftables userspace program and its corresponding kernel code, as well as attaching debuggers to the nft binary. Since the implementation is mostly based on trial and error, there might of course be a number of places where the forged netlink messages are used in an invalid or not intended way. Contributions are welcome!

Licensing

License: GNU GPLv3

Original work licensed by Amagicom AB under MIT/Apache-2.0.

Dependencies

~295–760KB
~17K SLoC