| Crates.io | nlrs |
| lib.rs | nlrs |
| version | 0.2.0 |
| created_at | 2025-11-13 16:19:58.624977+00 |
| updated_at | 2025-11-13 16:19:58.624977+00 |
| description | A minimal rust crate for simple and efficient Netlink requests |
| homepage | |
| repository | https://github.com/CleverCloud/nlrs |
| max_upload_size | |
| id | 1931470 |
| size | 315,184 |
A minimal rust crate for simple and efficient Netlink requests
nlrs is a Rust library made to communicate with the Linux kernel's netlink protocol. It provides a straightforward API for constructing and handling netlink requests, making it easier to interact with various kernel networking features from Rust. Designed for transparency and flexibility, nlrs exposes every part of its implementation, giving you complete control, with nothing hidden behind opaque abstractions.
Netlink is a powerful protocol in Linux, commonly used for tasks such as managing network interfaces, addresses, routes, and more.
They are other crate to send netlink request:
nlrs differs from other implementations by:
Add nlrs to your Cargo.toml:
[dependencies]
nlrs = "0.1"
Here's a minimal example of how to use nlrs to get all ip addresses on a system :
use nlrs::{
netlink::socket::NlSocketType,
rtnetlink::addr::GetAllAddressMsgBuilder,
socket::{NetlinkSocket, RequestBuilder},
};
fn main() {
let mut socket = NetlinkSocket::new_vectored(NlSocketType::NETLINK_ROUTE).unwrap();
let message_builder: GetAllAddressMsgBuilder<_> = socket.message_builder(());
let res = message_builder.call();
println!("{res:#?}");
}
For more detailed examples and API documentation, see the documentation.
This project is licensed under the MIT License. See the LICENSE file for details.