Skip to content

Commit

Permalink
Various adjustments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Frostie314159 committed Aug 9, 2024
1 parent 8861440 commit 12c49e4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions examples/match_frames.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use ieee80211::{
data_frame::DataFrame,
match_frames,
mgmt_frame::{BeaconFrame, DeauthenticationFrame},
};
Expand All @@ -11,6 +12,7 @@ fn main() {
println!("SSID: {}", beacon_frame.body.ssid().unwrap());
}
_ = DeauthenticationFrame => {}
_ = DataFrame => {}
}
.unwrap();
}
2 changes: 1 addition & 1 deletion src/elements/rsn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ impl<'a> RSNElement<'a> {
.with_mfp_required(true),
),
pmkid_list: Some([]),
group_management_cipher_suite: Some(IEEE80211CipherSuiteSelector::Ccmp128),
group_management_cipher_suite: Some(IEEE80211CipherSuiteSelector::BipCmac128),
_phantom: PhantomData,
};
/// An [RSNElement] equivalent to OWE.
Expand Down
15 changes: 10 additions & 5 deletions src/frames/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,22 @@ macro_rules! match_frames {
) => {
{
use ieee80211::scroll::Pread;
use ieee80211::{common::FrameControlField, IEEE80211Frame};
use ieee80211::{common::{FrameControlField, FrameType}, IEEE80211Frame};
use core::mem::discriminant;

let fcf = $bytes.pread(0).map(FrameControlField::from_bits);
if let Ok(fcf) = fcf {
'matched: {
$(
if
(<$frame_type as IEEE80211Frame>::TYPE == fcf.frame_type()) ||
(<$frame_type as IEEE80211Frame>::MATCH_ONLY_TYPE && <$frame_type as IEEE80211Frame>::TYPE.type_matches(fcf.frame_type()))
{
'matched_inner: {
match (<$frame_type as IEEE80211Frame>::TYPE, fcf.frame_type()) {
(FrameType::Management(lhs), FrameType::Management(rhs)) if lhs == rhs => {}
(FrameType::Control(_), FrameType::Control(_)) => {}
(FrameType::Data(_), FrameType::Data(_)) => {}
_ => {
break 'matched_inner;
}
}
break 'matched $bytes.pread::<$frame_type>(0).map(|$binding| $block);
}
)*
Expand Down

0 comments on commit 12c49e4

Please sign in to comment.