FT: Support addition of RIC elements into Reassociation Request frame

The new "SET ric_ies <hexdump>" control interface command can now be
used to request wpa_supplicant to add the specified RIC elements into
Reassociation Request frame when using FT protocol. This is mainly for
testing purposes.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2017-02-18 21:14:10 +02:00
parent ecbdc1a1fc
commit c6c41f6ea6
4 changed files with 42 additions and 1 deletions

View File

@ -386,6 +386,28 @@ static int wpas_ctrl_set_relative_band_adjust(struct wpa_supplicant *wpa_s,
}
static int wpas_ctrl_iface_set_ric_ies(struct wpa_supplicant *wpa_s,
const char *cmd)
{
struct wpabuf *ric_ies;
if (*cmd == '\0' || os_strcmp(cmd, "\"\"") == 0) {
wpabuf_free(wpa_s->ric_ies);
wpa_s->ric_ies = NULL;
return 0;
}
ric_ies = wpabuf_parse_bin(cmd);
if (!ric_ies)
return -1;
wpabuf_free(wpa_s->ric_ies);
wpa_s->ric_ies = ric_ies;
return 0;
}
static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
char *cmd)
{
@ -608,6 +630,8 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
ret = wpas_ctrl_set_relative_rssi(wpa_s, value);
} else if (os_strcasecmp(cmd, "relative_band_adjust") == 0) {
ret = wpas_ctrl_set_relative_band_adjust(wpa_s, value);
} else if (os_strcasecmp(cmd, "ric_ies") == 0) {
ret = wpas_ctrl_iface_set_ric_ies(wpa_s, value);
} else {
value[-1] = '=';
ret = wpa_config_process_global(wpa_s->conf, cmd, -1);
@ -7594,6 +7618,9 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s)
#ifdef CONFIG_SME
wpa_s->sme.last_unprot_disconnect.sec = 0;
#endif /* CONFIG_SME */
wpabuf_free(wpa_s->ric_ies);
wpa_s->ric_ies = NULL;
}

View File

@ -933,9 +933,17 @@ void sme_event_auth(struct wpa_supplicant *wpa_s, union wpa_event_data *data)
#ifdef CONFIG_IEEE80211R
if (data->auth.auth_type == WLAN_AUTH_FT) {
const u8 *ric_ies = NULL;
size_t ric_ies_len = 0;
if (wpa_s->ric_ies) {
ric_ies = wpabuf_head(wpa_s->ric_ies);
ric_ies_len = wpabuf_len(wpa_s->ric_ies);
}
if (wpa_ft_process_response(wpa_s->wpa, data->auth.ies,
data->auth.ies_len, 0,
data->auth.peer, NULL, 0) < 0) {
data->auth.peer,
ric_ies, ric_ies_len) < 0) {
wpa_dbg(wpa_s, MSG_DEBUG,
"SME: FT Authentication response processing failed");
wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_DISCONNECTED "bssid="

View File

@ -619,6 +619,9 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s)
#endif /* CONFIG_PMKSA_CACHE_EXTERNAL */
wpas_flush_fils_hlp_req(wpa_s);
wpabuf_free(wpa_s->ric_ies);
wpa_s->ric_ies = NULL;
}

View File

@ -1146,6 +1146,9 @@ struct wpa_supplicant {
*/
int relative_adjust_rssi;
} srp;
/* RIC elements for FT protocol */
struct wpabuf *ric_ies;
};