rust-netlink / wl-nl80211

Other
5 stars 10 forks source link

Implement enums and structs from nl80211.h #5

Open AbuShawarib opened 1 year ago

AbuShawarib commented 1 year ago

Implement the following enums in rust enums with appropriate implementation:

Implement the following structures in rust structs with appropriate implementation:

AbuShawarib commented 1 year ago

Hello @cathay4t, I would like to implement some of these, though I'm not sure what attributes to implement for these enums and their dependencies. In the current repository, I can see Nla, Parseable<NlaBuffer<&'a T>> From<u32> for X, From<X> for u32.

cathay4t commented 1 year ago

In stead of tackle down in the way of C header, I prefer do it through mimicking iw command. For example, currently I am trying to mimic iw phy command via https://github.com/cathay4t/wl-nl80211/tree/iw_phy with that we add struct and enum with purpose.

cathay4t commented 1 year ago

If you want to help, try to mimic iw dev wlan0 station dump command for NL80211_CMD_GET_STATION.

AbuShawarib commented 1 year ago

Well, yes. My original goal was to do iw dev wlan0 scan dump. I wanted to implement the required struct/enums, then move on to the command. I'll look into the branch and try to imitate it.

cathay4t commented 1 month ago

@AbuShawarib I have done the iw dev wlan0 scan dump support at https://github.com/rust-netlink/wl-nl80211/pull/17.

This crate is not targeted to replace nl802.11.h , I intend to close this issue and accepting feature request instead of C data type listing.

AbuShawarib commented 3 weeks ago

It's Ok to restructure features based on commands instead.

I have an unrelated question: There are many IEEE-802.11 info that require having a frame parser based on the spec to display in a meaningful way. It seems too big and broad of a parser to be a sub module inside this crate. Would you make use of something like ieee80211 or create our own?

cathay4t commented 2 weeks ago

I create from scratch by reading IEEE specification because I would like to minimize the dependency chain. I am aware this would be duplication effort, but considering IEEE 802.11 is ABI stable, this parsing work is one-time works, it is better no depending external crates on this.

For simple bit structs, I use bitflags, for complex ones, I create struct to provide emit() and parse() function using helper function like get_bit and get_bits_as_u8(). Please check https://github.com/rust-netlink/wl-nl80211/pull/18 as example.

cathay4t commented 2 days ago

I have finished the work on iw dev wlan0 scan trigger and iw dev wlan0 scan sched_start by #21

Next thing is iw dev wlan0 auth and iw dev wlan0 connect. I might focus on WPA2+ authentication, no WEP stuff.