commit 27bf997545aacb61b214802e7eb9ff064126e748
parent d38b7f240696b6f9c2e2ee4ddef65248dd45e041
Author: James Prestwood <prestwoj@gmail.com>
Date: Thu, 24 Feb 2022 09:04:54 -0800
scan: add scan_bss_get_security
This was already implemented in station but with no dependency on
that module at all. AP will need this for a scanning API so its
being moved into scan.c.
Diffstat:
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/scan.c b/src/scan.c
@@ -1680,6 +1680,23 @@ int scan_bss_get_rsn_info(const struct scan_bss *bss, struct ie_rsn_info *info)
return 0;
}
+int scan_bss_get_security(const struct scan_bss *bss, enum security *security)
+{
+ int ret;
+ struct ie_rsn_info info;
+
+ ret = scan_bss_get_rsn_info(bss, &info);
+ if (ret < 0) {
+ if (ret != -ENOENT)
+ return ret;
+
+ *security = security_determine(bss->capability, NULL);
+ } else
+ *security = security_determine(bss->capability, &info);
+
+ return 0;
+}
+
int scan_bss_rank_compare(const void *a, const void *b, void *user_data)
{
const struct scan_bss *new_bss = a, *bss = b;
diff --git a/src/scan.h b/src/scan.h
@@ -28,6 +28,7 @@ struct p2p_probe_req;
struct p2p_beacon;
struct mmpdu_header;
struct wiphy;
+enum security;
enum scan_state {
SCAN_STATE_NOT_RUNNING,
@@ -161,6 +162,7 @@ void scan_bss_free(struct scan_bss *bss);
int scan_bss_rank_compare(const void *a, const void *b, void *user);
int scan_bss_get_rsn_info(const struct scan_bss *bss, struct ie_rsn_info *info);
+int scan_bss_get_security(const struct scan_bss *bss, enum security *security);
struct scan_bss *scan_bss_new_from_probe_req(const struct mmpdu_header *mpdu,
const uint8_t *body,