From 0ce1545dcb8d08ad40c32b5919f1f25c67115534 Mon Sep 17 00:00:00 2001 From: Veerendranath Jakkam Date: Sun, 20 Feb 2022 07:21:56 +0530 Subject: [PATCH] nl80211: Determine maximum number of supported AKMs Use the recently added attribute to determine whether the kernel supports a larger number of AKM suites in various commands. Signed-off-by: Veerendranath Jakkam --- src/drivers/driver.h | 3 +++ src/drivers/driver_nl80211_capa.c | 7 +++++++ wpa_supplicant/wpa_supplicant.c | 1 + wpa_supplicant/wpa_supplicant_i.h | 1 + 4 files changed, 12 insertions(+) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index dfb433773..48b4bb4a1 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -2182,6 +2182,9 @@ struct wpa_driver_capa { /* Maximum number of supported CSA counters */ u16 max_csa_counters; + + /* Maximum number of supported AKM suites in commands */ + unsigned int max_num_akms; }; diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c index 7ede0d030..f5b62705a 100644 --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c @@ -1087,6 +1087,10 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg) if (tb[NL80211_ATTR_WIPHY_SELF_MANAGED_REG]) capa->flags |= WPA_DRIVER_FLAGS_SELF_MANAGED_REGULATORY; + if (tb[NL80211_ATTR_MAX_NUM_AKM_SUITES]) + capa->max_num_akms = + nla_get_u16(tb[NL80211_ATTR_MAX_NUM_AKM_SUITES]); + return NL_SKIP; } @@ -1165,6 +1169,9 @@ static int wpa_driver_nl80211_get_info(struct wpa_driver_nl80211_data *drv, if (info->update_ft_ies_supported) drv->capa.flags |= WPA_DRIVER_FLAGS_UPDATE_FT_IES; + if (!drv->capa.max_num_akms) + drv->capa.max_num_akms = NL80211_MAX_NR_AKM_SUITES; + return 0; } diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 2dd3d8c7d..096e2ad27 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -6771,6 +6771,7 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s, wpa_s->num_multichan_concurrent = capa.num_multichan_concurrent; wpa_s->wmm_ac_supported = capa.wmm_ac_supported; + wpa_s->max_num_akms = capa.max_num_akms; if (capa.mac_addr_rand_scan_supported) wpa_s->mac_addr_rand_supported |= MAC_ADDR_RAND_SCAN; diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 4790410d5..eb9855c23 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -932,6 +932,7 @@ struct wpa_supplicant { unsigned int max_match_sets; unsigned int max_remain_on_chan; unsigned int max_stations; + unsigned int max_num_akms; int pending_mic_error_report; int pending_mic_error_pairwise;