Remove broken security field
This commit is contained in:
parent
5fa1b8bc26
commit
6b08a701f5
@ -518,7 +518,6 @@ pub struct BssInfo {
|
|||||||
pub capability: u16,
|
pub capability: u16,
|
||||||
pub ssid: heapless::Vec<u8, 32>,
|
pub ssid: heapless::Vec<u8, 32>,
|
||||||
pub rssi: i16,
|
pub rssi: i16,
|
||||||
pub security: BssSecurity,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BssInfo {
|
impl BssInfo {
|
||||||
@ -527,52 +526,7 @@ impl BssInfo {
|
|||||||
return None;
|
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 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 ssid = heapless::Vec::from_slice(&bss_info.ssid[..bss_info.ssid_len as usize]).unwrap();
|
||||||
let BssInfoInternal {
|
let BssInfoInternal {
|
||||||
version,
|
version,
|
||||||
@ -591,7 +545,6 @@ impl BssInfo {
|
|||||||
capability,
|
capability,
|
||||||
ssid,
|
ssid,
|
||||||
rssi,
|
rssi,
|
||||||
security,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user