mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-02-01 22:34:07 +01:00
ie: Add ie_rsnxe_capable
Add convenience method for checking whether a given capability exists in an RSN Extension element.
This commit is contained in:
parent
f22c958b79
commit
3f42e4df25
20
src/ie.c
20
src/ie.c
@ -2083,3 +2083,23 @@ int ie_build_hs20_indication(uint8_t version, uint8_t *to)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ie_rsnxe_capable(const uint8_t *rsnxe, unsigned int bit)
|
||||
{
|
||||
unsigned int field_len;
|
||||
|
||||
if (!rsnxe)
|
||||
return false;
|
||||
|
||||
if (rsnxe[1] == 0)
|
||||
return false;
|
||||
|
||||
field_len = bit_field(rsnxe[2], 0, 4);
|
||||
if (field_len + 1 != rsnxe[1])
|
||||
return false;
|
||||
|
||||
if ((bit / 8) > field_len)
|
||||
return false;
|
||||
|
||||
return test_bit(rsnxe + 2, bit);
|
||||
}
|
||||
|
7
src/ie.h
7
src/ie.h
@ -567,3 +567,10 @@ int ie_parse_hs20_indication_from_data(const uint8_t *data, size_t len,
|
||||
uint8_t *version, uint16_t *pps_mo_id,
|
||||
uint8_t *domain_id);
|
||||
int ie_build_hs20_indication(uint8_t version, uint8_t *to);
|
||||
|
||||
enum ie_rsnx_capability {
|
||||
IE_RSNX_PROTECTED_TWT = 4,
|
||||
IE_RSNX_SAE_H2E = 5,
|
||||
};
|
||||
|
||||
bool ie_rsnxe_capable(const uint8_t *rsnxe, unsigned int bit);
|
||||
|
Loading…
Reference in New Issue
Block a user