-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Description
Hello.
I tried to get the IP and MAC addresses from a Neighbour object and print them, similar to the ip neigh show command. However, I noticed that the match attr arm didn’t auto-complete.
This happens because NeighbourAttribute comes from the netlink_packet_route crate, and it’s not re-exported by rtnetlink.
Here’s my code:
let (conn, handle, _) = rtnetlink::new_connection()?;
tokio::spawn(conn);
let mut neigh_entries = handle
.neighbours()
.get()
.set_family(rtnetlink::IpVersion::V4)
.execute();
// extract ip & mac addresses for each neighbor entry
while let Some(neigh) = neigh_entries.try_next().await? {
neigh.attributes.iter().for_each(|attr| {
// ✅ this point
match attr {
}
}
}It’s not usable even though it’s necessary for extracting IP and MAC addresses.
To match them, I have to explicitly add the netlink_packet_route crate and ensure the versions align.
I just want to understand the reasoning behind this. If it’s an intended design, why does it work this way?
I’m not arguing, I’m just a newbie who wants to understand the thoughts and philosophy of experts.
Thank you.
Metadata
Metadata
Assignees
Labels
No labels