This project aims at providing building blocks for netlink (see
man 7 netlink
).
- The
netlink_sys
crate provides netlink sockets. Integration withmio
andtokio
is optional. - Each netlink protocol has a
netlink-packet-<protocol_name>
crate that provides the packets for this protocol:netlink-packet-route
provides messages for the route protocolnetlink-packet-audit
provides messages for the audit protocolnetlink-packet-sock-diag
provides messages for the sock-diag protocolnetlink-packet-generic
provides message for the generic netlink protocolnetlink-packet-netfilter
provides message for theNETLINK_NETFILTER
protocolnetlink-packet-xfrm
provides message for IPsec
- The
netlink-packet-core
is the glue for all the othernetlink-packet-*
crates. It provides aNetlinkMessage<T>
type that represent any netlink message for any sub-protocol. - The
netlink-proto
crate is an asynchronous implementation of the netlink protocol. It only depends onnetlink-packet-core
for theNetlinkMessage
type andnetlink-sys
for the socket. - The
rtnetlink
crate provides higher level abstraction for the route protocol - The
audit
crate provides higher level abstractions for the audit protocol. - The
genetlink
crate provides higher level abstraction for the generic netlink protocol - The
ethtool
crate provides higher level abstraction for ethtool netlink protocol - The
netlink-packet-wireguard
crate provide netlink message for wireguard. - The
mptcp-pm
crate provides MPTCP path manager netlink protocol - The
wl-nl80211
crate provides wireless nl80211 netlink protocol - If you want to add more netlink related crates into this organization, please open pull request to rust-netlink/new-crate-review.
- https://github.com/jbaublitz/neli: the main alternative to these crates, as it is actively developed.
- Other but less actively developed alternatives:
The architecture desion records are stored in https://github.com/rust-netlink/.github/tree/main/architecture_decisions
My main resource so far has been the source code of pyroute2
(python) and netlink
(golang) a lot. These two projects are
great, and very nicely written. As someone who does not read C fluently, and
that does not know much about netlink, they have been invaluable.
I'd also like to praise libnl
for its documentation. It helped me a
lot in understanding the protocol basics.
The whole packet parsing logic is inspired by @whitequark excellent blog posts (part 1, part 2 and part 3, although I've only really used the concepts described in the first blog post).
Thanks also to the people behind tokio for the amazing tool they are building, and the support they provide.