25 releases (breaking)
|new 0.18.1||Dec 5, 2023|
|0.17.1||Aug 30, 2023|
|0.17.0||Jul 10, 2023|
|0.15.0||Jan 28, 2023|
|0.1.0||Dec 20, 2019|
#55 in Unix APIs
338,488 downloads per month
Used in 292 crates (22 directly)
Rust crate for Netlink Route Protocol
netlink-packet-route crate is designed to abstract Netlink route
rtnetlink) packet into Rust data types. The goal of
this crate is saving netlink user from reading Kernel Netlink codes.
This crate grouped Netlink route protocol into these modules:
link: NIC interface, similar to to
address: IP address, similar to
route: Route, similar to
rule: Route rule, similar to
tc: Traffic control, similar to
neighbour: Neighbour, similar to
neighbour_table: Neighbour table, similar to
nsid: Namespace, similar to
Normally, you should use
rtnetlink instead of using this
git commit --signoffto append Signed-off-by trailer to commit message.
For new source file, please append
// SPDX-License-Identifier: MITat the beginning with content of license new code to MIT license.
No panic is allowed, please use
cargo clippybefore creating pull request.
All struct/enum should be decorated by
#[non_exhaustive]to preserve API backwards compatibility unless explicit approval from maintainer.
Unknown netlink attribute should be stored into
Other(DefaultNla)instead of breaking decoding.
Please use unit test case to cover the serialize and deserialize of the changed netlink attribute. To capture the netlink raw bytes, you may use tcpdump/wireshark again the
nlmoninterface. For example:
modprobe nlmon ip link add nl0 type nlmon ip link set nl0 up tcpdump -i nl0 -w netlink_capture_file.cap # Then use wireshark to open this `netlink_capture_file.cap` # Find out the packet you are interested, # right click -> "Copy" -> "...as Hex Dump". # You may use https://github.com/cathay4t/hex_to_rust to convert this # hexdump to rust u8 array
The integration test(play with linux kernel netlink interface) should be placed into
rtnetlinkcrate. Current(netlink-packet-route) crate should only unit test case only.
For certain netlink message which cannot captured by nlmon, please use Rust Debug and explain every bits in comment.
Optionally, please run
tools/test_cross_build.shto make sure your code is compilable on other platforms.