rust-netlink / netlink-packet-sock-diag Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
I am puzzled by the fact that there is a 0.4.0
release of netlink-packet-sock-diag
on crates.io, but I can't seem to find the source for that release. Both here and https://github.com/little-dude/netlink only seem to have sources for 0.3.1
.
I tried writing some code using the netlink-packet-sock-diag
crate, using docs.rs to understand the Nla
enum. According to those docs, the TcpInfo
variant contains a Vec<u8>
, which I took to mean that decoding isn't available for this data structure.
I was surprised when I looked at the source code and discovered that decoding was present but required a feature flag. Perhaps the docs for this enum should contain a note that decoding requires a feature flag to be enabled?
I also notice that enabling the feature flag makes incompatible changes to the enum contents, making code no longer compile. This is a non-additive feature; it would be better to follow Cargo's guidance and ensure that enabling features doesn't break the existing public API.
Sorry, trying to run the example "cargo run --example dump_ipv4"
das@t:~/Downloads$ mkdir test_netlink
das@t:~/Downloads$ cd test_netlink/
das@t:~/Downloads/test_netlink$ git clone https://github.com/rust-netlink/netlink-packet-sock-diag.git
Cloning into 'netlink-packet-sock-diag'...
remote: Enumerating objects: 306, done.
remote: Counting objects: 100% (306/306), done.
remote: Compressing objects: 100% (142/142), done.
remote: Total 306 (delta 169), reused 274 (delta 147), pack-reused 0
Receiving objects: 100% (306/306), 66.00 KiB | 1.22 MiB/s, done.
Resolving deltas: 100% (169/169), done.
das@t:~/Downloads/test_netlink$ cd netlink-packet-sock-diag/
das@t:~/Downloads/test_netlink/netlink-packet-sock-diag$ cargo run --example dump_ipv4
Updating crates.io index
Downloaded thiserror-impl v1.0.47
Downloaded quote v1.0.33
Downloaded thiserror v1.0.47
Downloaded anyhow v1.0.75
Downloaded syn v2.0.29
Downloaded 5 crates (347.5 KB) in 0.44s
Compiling proc-macro2 v1.0.66
Compiling unicode-ident v1.0.11
Compiling anyhow v1.0.75
Compiling paste v1.0.14
Compiling thiserror v1.0.47
Compiling libc v0.2.147
Compiling byteorder v1.4.3
Compiling log v0.4.20
Compiling smallvec v1.11.0
Compiling bytes v1.4.0
Compiling bitflags v1.3.2
Compiling lazy_static v1.4.0
Compiling quote v1.0.33
Compiling netlink-sys v0.8.5
Compiling syn v2.0.29
Compiling thiserror-impl v1.0.47
Compiling netlink-packet-utils v0.5.2
Compiling netlink-packet-core v0.7.0
Compiling netlink-packet-sock-diag v0.4.2 (/home/das/Downloads/test_netlink/netlink-packet-sock-diag)
error[E0532]: expected unit struct, unit variant or constant, found tuple variant `NetlinkPayload::Done`
--> examples/dump_ipv4.rs:65:17
|
65 | NetlinkPayload::Done => {
| ^^^^^^^^^^^^^^^^^^^^
|
::: /home/das/.cargo/registry/src/index.crates.io-6f17d22bba15001f/netlink-packet-core-0.7.0/src/payload.rs:21:5
|
21 | Done(DoneMessage),
| ---- `NetlinkPayload::Done` defined here
|
help: use the tuple variant pattern syntax instead
|
65 | NetlinkPayload::Done(_) => {
| ~~~~~~~~~~~~~~~~~~~~~~~
help: consider importing one of these items instead
|
3 + use core::str::pattern::SearchStep::Done;
|
3 + use std::str::pattern::SearchStep::Done;
|
help: if you import `Done`, refer to it directly
|
65 - NetlinkPayload::Done => {
65 + Done => {
|
error[E0599]: no variant or associated item named `Ack` found for enum `NetlinkPayload` in the current scope
--> examples/dump_ipv4.rs:59:56
|
59 | NetlinkPayload::Noop | NetlinkPayload::Ack(_) => {}
| ^^^ variant or associated item not found in `NetlinkPayload<_>`
Some errors have detailed explanations: E0532, E0599.
For more information about an error, try `rustc --explain E0532`.
error: could not compile `netlink-packet-sock-diag` (example "dump_ipv4") due to 2 previous errors
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.