3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

scan: Utility to find AP supported ciphers

Extracts the supported ciphers masks from the beacon data.  If RSN IE
was present, the WPA IE is ignored.
This commit is contained in:
Andrew Zaborowski 2015-05-18 13:31:38 +02:00 committed by Denis Kenzior
parent 27d18cdd96
commit 4b1555c935
2 changed files with 36 additions and 0 deletions

View File

@ -259,3 +259,35 @@ void scan_bss_free(struct scan_bss *bss)
l_free(bss->wpa);
l_free(bss);
}
void bss_get_supported_ciphers(struct scan_bss *bss,
uint16_t *pairwise_ciphers,
uint16_t *group_ciphers)
{
struct ie_rsn_info ie;
*pairwise_ciphers = 0;
*group_ciphers = 0;
if (bss->rsne) {
int res = ie_parse_rsne_from_data(bss->rsne, bss->rsne[1] + 2,
&ie);
if (res < 0) {
l_debug("Cannot parse RSN field (%d, %s)",
res, strerror(-res));
return;
}
} else if (bss->wpa) {
int res = ie_parse_wpa_from_data(bss->wpa, bss->wpa[1] + 2,
&ie);
if (res < 0) {
l_debug("Cannot parse WPA IE (%d, %s)",
res, strerror(-res));
return;
}
} else
return;
*pairwise_ciphers = ie.pairwise_ciphers;
*group_ciphers = ie.group_cipher;
}

View File

@ -59,3 +59,7 @@ struct scan_bss *scan_parse_result(struct l_genl_msg *msg,
uint64_t *out_wdev,
const uint8_t **out_ssid,
uint8_t *out_ssid_len);
void bss_get_supported_ciphers(struct scan_bss *bss,
uint16_t *pairwise_ciphers,
uint16_t *group_ciphers);