Skip to content

Commit

Permalink
Add support of parsing netlink message reply of iw phy
Browse files Browse the repository at this point in the history
Expanding `Nl80211Attr` to support parsing reply of `iw phy` on linux
kernel 6.10.10.

Tested on archlinux by command:

```bash
cargo run --example dump_nl80211_wiphy
```

Signed-off-by: Gris Ge <[email protected]>
  • Loading branch information
cathay4t committed Sep 18, 2024
1 parent 19d03a5 commit 2a4dbe1
Show file tree
Hide file tree
Showing 31 changed files with 6,537 additions and 234 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name = "wl-nl80211"
version = "0.1.2"
authors = ["Gris Ge <[email protected]>"]
license = "MIT"
edition = "2018"
edition = "2021"
description = "Linux kernel wireless(802.11) netlink Library"
homepage = "https://github.com/rust-netlink/wl-nl80211"
repository = "https://github.com/rust-netlink/wl-nl80211"
Expand All @@ -25,6 +25,7 @@ smol_socket = ["netlink-proto/smol_socket", "async-std"]
[dependencies]
anyhow = "1.0.44"
async-std = { version = "1.9.0", optional = true}
bitflags = "2"
byteorder = "1.4.3"
futures = "0.3.17"
log = "0.4.14"
Expand Down
27 changes: 27 additions & 0 deletions examples/dump_nl80211_wiphy.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// SPDX-License-Identifier: MIT

use futures::stream::TryStreamExt;

fn main() {
let rt = tokio::runtime::Builder::new_current_thread()
.enable_io()
.build()
.unwrap();
rt.block_on(get_wireless_physics());
}

async fn get_wireless_physics() {
let (connection, handle, _) = wl_nl80211::new_connection().unwrap();
tokio::spawn(connection);

let mut phy_handle = handle.wireless_physic().get().execute().await;

let mut msgs = Vec::new();
while let Some(msg) = phy_handle.try_next().await.unwrap() {
msgs.push(msg);
}
assert!(!msgs.is_empty());
for msg in msgs {
println!("{:?}", msg);
}
}
Loading

0 comments on commit 2a4dbe1

Please sign in to comment.