From 6b08a701f595a9c153ab33510bdd5c30aa5a8b4b Mon Sep 17 00:00:00 2001 From: umgefahren <55623006+umgefahren@users.noreply.github.com> Date: Thu, 14 Dec 2023 19:48:36 +0100 Subject: [PATCH] Remove broken security field --- cyw43/src/structs.rs | 47 -------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/cyw43/src/structs.rs b/cyw43/src/structs.rs index 749970f1..820fbdc8 100644 --- a/cyw43/src/structs.rs +++ b/cyw43/src/structs.rs @@ -518,7 +518,6 @@ pub struct BssInfo { pub capability: u16, pub ssid: heapless::Vec, pub rssi: i16, - pub security: BssSecurity, } impl BssInfo { @@ -527,52 +526,7 @@ impl BssInfo { return None; } - const DOT11_CAP_PRIVACY: u16 = 0x0010; - const DOT11_IE_ID_RSN: u8 = 48; - const DOT11_IE_ID_VENDOR_SPECIFIC: u8 = 221; - const WPA_OUI_TYPE1: &[u8] = b"\x00\x50\xF2\x01"; - let bss_info = *BssInfoInternal::from_bytes_mut(packet[..BssInfoInternal::SIZE].as_mut().try_into().unwrap()); - let mut ie_ptr = bss_info.ie_offset as usize; - let ie_top = ie_ptr + bss_info.ie_length as usize; - let mut ie_rsn = None; - let mut ie_wpa = None; - while ie_ptr < ie_top { - let ie_type = packet[ie_ptr]; - let ie_len = packet[ie_ptr + 1] as usize; - if ie_ptr + 2 + ie_len <= ie_top { - match ie_type { - DOT11_IE_ID_RSN => { - ie_rsn = Some(ie_ptr); - } - DOT11_IE_ID_VENDOR_SPECIFIC => { - if &packet[ie_ptr + 2..ie_ptr + 6] == WPA_OUI_TYPE1 { - ie_wpa = Some(ie_ptr); - } - } - _ => {} - } - } - ie_ptr += 2 + ie_len; - } - - let mut security_field = 0; - if ie_rsn.is_some() { - security_field |= 4; - } - if ie_wpa.is_some() { - security_field |= 2; - } - if bss_info.capability & DOT11_CAP_PRIVACY > 0 { - security_field |= 1; - } - let security = match security_field { - 4 => BssSecurity::Wpa2, - 2 => BssSecurity::Wpa, - 1 => BssSecurity::WepPsk, - 0 => BssSecurity::Open, - _ => BssSecurity::None, - }; let ssid = heapless::Vec::from_slice(&bss_info.ssid[..bss_info.ssid_len as usize]).unwrap(); let BssInfoInternal { version, @@ -591,7 +545,6 @@ impl BssInfo { capability, ssid, rssi, - security, }) } }