| Crates.io | nftnl-rs |
| lib.rs | nftnl-rs |
| version | 0.5.1 |
| created_at | 2024-03-18 00:01:57.86097+00 |
| updated_at | 2025-09-28 22:44:11.677635+00 |
| description | A Rust crate for Linux Netlink Nftables client for direct control on the netfilter via netlink socket. |
| homepage | |
| repository | https://codeberg.org/4neko/nftnl-rs |
| max_upload_size | |
| id | 1176903 |
| size | 177,974 |
This is a crate (currently in development) which implements a netlink protocol to communicate with
the Linux Nftables firewall.
This crate was developed only for the tables/sets manipulations i.e add/del/get!!!
At the moment this crate allows to:
The pull requests are now supported because the repository was moved to Codeberg. The alternative way is to send patches over the email to patch[at]4neko.org.
In case if you would like to contribute the code, please use pull request. Your pull request should include:
Description of changes and why it is needed.
Test the pull request.
In case of you prefer email and patch files please consider the following:
For each feature or fix, please send patches separatly.
Please write what your patch is implementing or fixing.
I can read the code and I am able to understand it, so don't write a poem or essay in the description to the patches.
Please test your patch.
Yes, MPL- and Apache-licensed code can be used with an MIT codebase (so in that sense, they are "compatible"). However, the MPL- / Apache-licensed code remains under its original license. (So although compatible, you cannot relicense someone else's MPL or Apache code into the MIT license.) This means that your final codebase will contain a mix of MPL, Apache, and MIT licensed code. As an example, MPL has weak copyleft, so if you modified an MPL file, that file (including your changes) must remain under the MPL license.
-I want to distribute (outside my organization) executable programs or libraries that I have compiled from someone else's unchanged MPL-licensed source code, either standalone or part of a larger work. What do I have to do?
You must inform the recipients where they can get the source for the MPLed code in the executable program or library you are distributing (i.e., you must comply with Section 3.2). You may distribute any executables you create under a license of your choosing, as long as that license does not interfere with the recipients' rights to the source under the terms of the MPL.
v 0.5.1-development, Rust edition 2024
Sources are available under: MPL-2.0
The project has moved to Codeberg.
For examples, see /examples/ directory.
Get IP from the table's set. i.e performing the following command:
$ sudo nft list set ip table-test table-set
use std::{net::IpAddr, str::FromStr};
use nftnl_rs::Nfprot
fn main()
{
let hosts = [IpAddr::from_str("127.0.1.3").unwrap(), IpAddr::from_str("127.0.1.4").unwrap()];
let res = nftnl_rs::add_hosts_to_table(hosts.as_slice(), "table-test", "table-set");
}