]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
FT: Support addition of RIC elements into Reassociation Request frame
authorJouni Malinen <j@w1.fi>
Sat, 18 Feb 2017 19:14:10 +0000 (21:14 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 18 Feb 2017 19:39:01 +0000 (21:39 +0200)
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>
wpa_supplicant/ctrl_iface.c
wpa_supplicant/sme.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index f9163169665557c76bba05b2b864d0582ace7a10..761d9175896e7e89b05f3e8024bf7b06e17d42f9 100644 (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;
 }
 
 
index e438dbedeada5884d0c93c9882371e6bcc4151d5..beb9d6e21502a5ce6bcc9d76b85dc0669df52cce 100644 (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="
index a3392efd37b42c2be25442d2b4a41310f88fdc1c..926b80752dbca58c95aef79fbb3058dcd818cbcb 100644 (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;
 }
 
 
index 95f4d9b2553d4cca457091582f5efcaac13c0690..83bfbd5431aaf544122a35a049ac9330946c605a 100644 (file)
@@ -1146,6 +1146,9 @@ struct wpa_supplicant {
                 */
                int relative_adjust_rssi;
        } srp;
+
+       /* RIC elements for FT protocol */
+       struct wpabuf *ric_ies;
 };