#netlink #libmnl #api-bindings

mnl

Safe abstraction for libmnl, a minimalistic user-space library oriented to Netlink developers

4 releases

0.2.2 Feb 11, 2022
0.2.1 Feb 11, 2022
0.2.0 Sep 23, 2019
0.1.0 Aug 29, 2018

#458 in Unix APIs

Download history 1851/week @ 2023-11-19 1922/week @ 2023-11-26 4048/week @ 2023-12-03 3652/week @ 2023-12-10 2114/week @ 2023-12-17 1393/week @ 2023-12-24 2186/week @ 2023-12-31 2598/week @ 2024-01-07 2330/week @ 2024-01-14 2107/week @ 2024-01-21 2455/week @ 2024-01-28 3506/week @ 2024-02-04 3361/week @ 2024-02-11 1977/week @ 2024-02-18 3075/week @ 2024-02-25 4439/week @ 2024-03-03

13,061 downloads per month
Used in nftnl

MIT/Apache

29KB
463 lines

mnl

Safe abstraction for libmnl, a minimalistic user-space library oriented to Netlink developers. See mnl-sys for the low level FFI bindings to the C library.

This is work in progress and does not implement all of libmnl yet. Feel free to submit PRs to support the parts you need!

The initial focus here was to support sockets and the parsing of responses. So far, the parts that are covered the best are mnl_socket_* and mnl_cb_run. However the netlink messages are just treated as raw byte buffers. It might make sense to add some abstraction struct at some point.

Selecting version of libmnl

See the documentation for the corresponding sys crate for details: mnl-sys. This crate has the same features as the sys crate, so the same features applies here.

Prior/related work

The crslmnl crate is another wrapper around libmnl. At this stage it is a far more complete abstraction of the library than this is. There are a few reasons I decided to start a new wrapper crate. I'm not going to go into details on why, but basically it did not support part of my use-case and I was no fan of the design choices made. Instead of having local definitions of all the Linux header constants I made sure to get everything needed for netlink merged into libc. I also want a separate mnl-sys crate that is pure FFI bindings without logic or abstractions.

License: MIT/Apache-2.0

Dependencies

~135KB