diff --git a/src/scan.c b/src/scan.c index 1ab6420b..7c510df8 100644 --- 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 index 81cb9e46..2c401df6 100644 --- 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,