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:
parent
27d18cdd96
commit
4b1555c935
32
src/scan.c
32
src/scan.c
@ -259,3 +259,35 @@ void scan_bss_free(struct scan_bss *bss)
|
|||||||
l_free(bss->wpa);
|
l_free(bss->wpa);
|
||||||
l_free(bss);
|
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;
|
||||||
|
}
|
||||||
|
@ -59,3 +59,7 @@ struct scan_bss *scan_parse_result(struct l_genl_msg *msg,
|
|||||||
uint64_t *out_wdev,
|
uint64_t *out_wdev,
|
||||||
const uint8_t **out_ssid,
|
const uint8_t **out_ssid,
|
||||||
uint8_t *out_ssid_len);
|
uint8_t *out_ssid_len);
|
||||||
|
|
||||||
|
void bss_get_supported_ciphers(struct scan_bss *bss,
|
||||||
|
uint16_t *pairwise_ciphers,
|
||||||
|
uint16_t *group_ciphers);
|
||||||
|
Loading…
Reference in New Issue
Block a user