Skip to content

Conversation

@Sh3Rm4n
Copy link
Collaborator

@Sh3Rm4n Sh3Rm4n commented May 7, 2025

While trying to convert the parsed payload of information elements into the binary format, I've noticed inconsistencies regarding some emit implementations.

I've fixed some of them (which I needed) mostly based on the assumption, that the Parsable implementation is correct.
On exception is the Nl80211RateAndSelector implementation, where the comments from this type and Nl80211Element::SupportedRatesAndSelectors where already inconsistent.

Also I've added some roudtrip test, using macros to reduce the repetition. I thought about adding more tests, but I wanted to propose this as a starting point for now.

@cathay4t
Copy link
Member

cathay4t commented May 19, 2025

Thanks for the patch! I think it is time to add unit test by parsing and emitting captured iw netlink packets, otherwise it is just your talk vs my talk.

@cathay4t
Copy link
Member

https://github.com/rust-netlink/netlink-packet-route/?tab=readme-ov-file#development has steps to capture netlink packet. And that project also has unit test example on parsing and emitting packet.

@Sh3Rm4n Sh3Rm4n force-pushed the fix/emit-inconsistencies branch 3 times, most recently from c5518da to 4ce8f54 Compare July 18, 2025 15:03
@Sh3Rm4n
Copy link
Collaborator Author

Sh3Rm4n commented Oct 23, 2025

If I'd split out the testing, we could at least merge the emit fixes. WDYT @cathay4t?

@Sh3Rm4n Sh3Rm4n requested a review from cathay4t October 23, 2025 14:45
@Sh3Rm4n Sh3Rm4n force-pushed the fix/emit-inconsistencies branch from 4ce8f54 to 258e00c Compare October 24, 2025 08:12
@cathay4t
Copy link
Member

In general, it looks good. Just two cents:

  1. helper.rs is to generic which will be bloated in the future like utils.rs. Maybe change it to emit_helper.rs.
  2. For the buffer parsing part, could you take a look on https://github.com/nispor/mozim/blob/main/src/buffer.rs . I intend to replace buffer!() macros used in rust-netlink crates. Could you check whether that design also works in this nl80211 buffer parsing?

None of them is blocking the merge. Feel free to merge this PR if I am not responding.

@cathay4t cathay4t force-pushed the fix/emit-inconsistencies branch from 258e00c to f1ee1e3 Compare November 11, 2025 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants