nftnl-rs

Crates.ionftnl-rs
lib.rsnftnl-rs
version0.5.0
created_at2024-03-18 00:01:57.86097+00
updated_at2025-06-21 17:10:35.524791+00
descriptionA Rust crate for Linux Netlink Nftables client for direct control on the netfilter via netlink socket.
homepage
repositoryhttps://repo.4neko.org/4NEKO/nftnl-rs
max_upload_size
id1176903
size173,314
Aleksandr Morozov (eesekaj)

documentation

README

nftnl-rs (A Nftables manipulation library) 600 logo

This is a crate (currently in development) which implements a netlink protocol to communicate with the Linux Nftables firewall.

This crate is not activly developed because there was a requirment to control the content of the set of the table.

Due to the complexity of the protocol, there are no plans to activly maintain or develop this crate.

This crate is in its early development state. It is not planned to extend its functionality! Use at your own risk.

This crate was developed only for the tables/sets manipulations i.e add/del/get!!!

At the moment this crate allows to:

  • perform operations on the sets i.e add IP, remove IP, get IP from the list.

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");
}

Commit count: 0

cargo fmt