rust-netlink / netlink-packet-route

Rust crate for the netlink route protocol
https://docs.rs/netlink-packet-route/
Other
24 stars 48 forks source link

trace/git commit moving from 0.13 to 0.20 -- search engine fodder #123

Open mcr opened 3 months ago

mcr commented 3 months ago

I unstuck my Cargo.lock while trying something else out, and wound up with the upgrade to rtnetlink 0.14.1, and netlink-packet-route 0.20. So, actually rtnetlink 0.14.1 wants netlink-packet-route 0.19, which I discovered, at which point I moved to github rtnetlink.

While there were a few deprecation notices (and I don't actually understand xfrmtun_link's third argument yet), in many cases, I just had to grep. Yes, Bridge "MASTER" now becomes Controller, but I didn't actually figure out what happens to the slave device attributes. Please, maybe a few more comments in the code, like "// this used to be SlaveKind" or something would really help.

Anyway, I gathered it all together as: https://github.com/AnimaGUS-minerva/connect/commit/9279594b8f7da221d39cb3d77f27566f01084115

and at least, at this point it compiles. It does not pass tests, because my tests involve constructing netlink messages to feed into the loop that processes them, and the non_exhaustive attribute breaks that. I hope all the right ::new() methods exist.

As for Kernels that change the structure: I would suggest that rather than attempt to match every structure, that the structures maybe should just be dated or KernelVersionNumbered, with new structures created. Maybe. It's really a tuscle.

BTW: in many cases, I print any netlink message I don't understand, because sometimes they are important to process, and sometimes they are just noise. So for some things, if I don't know how to translate to new naming, I just comment out the ignore, and {:?} will print it out for me, and I'll put back the right ignores. (This is an RFC8994 daemon, btw. It creates and lives in three network namespaces)

mcr commented 3 months ago

Updating my test cases to construct the objects I wanted "manually" rather than with a struct was much easier than I thought.

https://github.com/AnimaGUS-minerva/connect/commit/d4753ba98c590f2042a122915205ef49359fcdf6

cathay4t commented 3 months ago

We have https://github.com/rust-netlink/netlink-packet-route/blob/main/CHANGELOG which might help you understand the changes.

For include kernel version in struct, my quick answer is no. These crates are supposed to work on old kernels. It is a bug if we failed so.

Frankly speaking, I don't understand your expectation from this issue.