From: Benjamin Berg <benjamin.berg@xxxxxxxxx> On authenticate and associate, include the NL80211_ATTR_SUPPORTED_SELECTORS attribute to send a list of selectors that are supported by the supplicant. This list currently only contains the SAE_H2E selector as all the other ones are handled by mac80211. However, a new driver parameter is added to allow adding selectors for testing purposes. Signed-off-by: Benjamin Berg <benjamin.berg@xxxxxxxxx> Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski@xxxxxxxxx> --- src/drivers/driver_nl80211.c | 57 ++++++++++++++++++++++++++++++++++++ src/drivers/driver_nl80211.h | 2 ++ 2 files changed, 59 insertions(+) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index c139cfef21..fb537cd8e6 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -4039,6 +4039,28 @@ static enum nl80211_auth_type get_nl_auth_type(int wpa_auth_alg) } +static int nl80211_put_selectors(struct wpa_driver_nl80211_data *drv, + struct nl_msg *msg) +{ + u8 selectors[ARRAY_SIZE(drv->extra_selectors) + 1]; + size_t selectors_len = 0; + + if (!nl80211_attr_supported(drv, NL80211_ATTR_SUPPORTED_SELECTORS)) + return 0; + + for (; drv->extra_selectors[selectors_len]; selectors_len++) { + selectors[selectors_len] = + drv->extra_selectors[selectors_len]; + } + + /* Always add the SAE_H2E selector as it is handled by the supplicant */ + selectors[selectors_len++] = BSS_MEMBERSHIP_SELECTOR_SAE_H2E_ONLY; + + return nla_put(msg, NL80211_ATTR_SUPPORTED_SELECTORS, + selectors_len, selectors); +} + + static int wpa_driver_nl80211_authenticate( struct i802_bss *bss, struct wpa_driver_auth_params *params) { @@ -4140,6 +4162,10 @@ retry: goto fail; } + ret = nl80211_put_selectors(drv, msg); + if (ret) + goto fail; + if (params->mld && params->ap_mld_addr) { wpa_printf(MSG_DEBUG, " * MLD: link_id=%u, MLD addr=" MACSTR, params->mld_link_id, MAC2STR(params->ap_mld_addr)); @@ -7470,6 +7496,10 @@ static int wpa_driver_nl80211_associate( if (ret) goto fail; + ret = nl80211_put_selectors(drv, msg); + if (ret) + goto fail; + if (params->mgmt_frame_protection == MGMT_FRAME_PROTECTION_REQUIRED && nla_put_u32(msg, NL80211_ATTR_USE_MFP, NL80211_MFP_REQUIRED)) goto fail; @@ -10060,6 +10090,7 @@ static int nl80211_set_param(void *priv, const char *param) { struct i802_bss *bss = priv; struct wpa_driver_nl80211_data *drv = bss->drv; + const char *pos; if (param == NULL) return 0; @@ -10128,6 +10159,32 @@ static int nl80211_set_param(void *priv, const char *param) if (os_strstr(param, "rsn_override_in_driver=1")) drv->capa.flags2 |= WPA_DRIVER_FLAGS2_RSN_OVERRIDE_STA; + pos = os_strstr(param, "extra_selectors="); + if (pos) { + int i = 0; + + pos += 16; + + while (*pos) { + char *end; + int sel; + + sel = strtol(pos, &end, 10); + if (pos == end) + return -EINVAL; + + if (sel > 127 || sel < 0) + return -EINVAL; + if (i == ARRAY_SIZE(drv->extra_selectors)) + return -EINVAL; + drv->extra_selectors[i++] = sel; + + pos = end; + while (*pos == ',') + pos = end + 1; + } + } + return 0; } diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h index 971908afc9..35dd8fd4a7 100644 --- a/src/drivers/driver_nl80211.h +++ b/src/drivers/driver_nl80211.h @@ -202,6 +202,8 @@ struct wpa_driver_nl80211_data { unsigned int qca_ap_allowed_freqs:1; unsigned int connect_ext_vendor_cmd_avail:1; + u8 extra_selectors[8]; + u32 ignore_next_local_disconnect; u32 ignore_next_local_deauth; -- 2.47.1 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap