]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
SAE H2E: Testing option to report extra rejected groups
authorJouni Malinen <jouni@codeaurora.org>
Fri, 6 Dec 2019 22:26:13 +0000 (00:26 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 6 Dec 2019 22:26:13 +0000 (00:26 +0200)
"SET extra_sae_rejected_groups <groups>" can now be used to enable test
mode in which wpa_supplicant will report additional groups (configured
as space separated integers) when using SAE H2E.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wpa_supplicant/ctrl_iface.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index f0ea9d12bef39a7914b4f05b6aa0c6d3c2c6f9c0..3bd988142df4040c0ce6cb1c93e8302668d5f38a 100644 (file)
@@ -665,6 +665,28 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
                                              wpa_s->ignore_assoc_disallow);
        } else if (os_strcasecmp(cmd, "ignore_sae_h2e_only") == 0) {
                wpa_s->ignore_sae_h2e_only = !!atoi(value);
+       } else if (os_strcasecmp(cmd, "extra_sae_rejected_groups") == 0) {
+               char *pos;
+
+               os_free(wpa_s->extra_sae_rejected_groups);
+               wpa_s->extra_sae_rejected_groups = NULL;
+               pos = value;
+               while (pos && pos[0]) {
+                       int group;
+
+                       group = atoi(pos);
+                       wpa_printf(MSG_DEBUG,
+                                  "TESTING: Extra rejection of SAE group %d",
+                                  group);
+                       if (group)
+                               int_array_add_unique(
+                                       &wpa_s->extra_sae_rejected_groups,
+                                       group);
+                       pos = os_strchr(pos, ' ');
+                       if (!pos)
+                               break;
+                       pos++;
+               }
        } else if (os_strcasecmp(cmd, "reject_btm_req_reason") == 0) {
                wpa_s->reject_btm_req_reason = atoi(value);
        } else if (os_strcasecmp(cmd, "get_pref_freq_list_override") == 0) {
@@ -8054,6 +8076,8 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s)
        wpa_s->get_pref_freq_list_override = NULL;
        wpabuf_free(wpa_s->sae_commit_override);
        wpa_s->sae_commit_override = NULL;
+       os_free(wpa_s->extra_sae_rejected_groups);
+       wpa_s->extra_sae_rejected_groups = NULL;
 #ifdef CONFIG_DPP
        os_free(wpa_s->dpp_config_obj_override);
        wpa_s->dpp_config_obj_override = NULL;
index 6688d71af9544e2e3b9bc5dd6c647f62afc72148..e093d2df1a41991801db58c5906a3a6a3ce5d48e 100644 (file)
@@ -499,6 +499,8 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s)
        wpa_s->get_pref_freq_list_override = NULL;
        wpabuf_free(wpa_s->last_assoc_req_wpa_ie);
        wpa_s->last_assoc_req_wpa_ie = NULL;
+       os_free(wpa_s->extra_sae_rejected_groups);
+       wpa_s->extra_sae_rejected_groups = NULL;
 #endif /* CONFIG_TESTING_OPTIONS */
 
        if (wpa_s->conf != NULL) {
@@ -1972,6 +1974,28 @@ static void wpa_s_setup_sae_pt(struct wpa_config *conf, struct wpa_ssid *ssid)
 }
 
 
+static void wpa_s_clear_sae_rejected(struct wpa_supplicant *wpa_s)
+{
+#if defined(CONFIG_SAE) && defined(CONFIG_SME)
+       os_free(wpa_s->sme.sae_rejected_groups);
+       wpa_s->sme.sae_rejected_groups = NULL;
+#ifdef CONFIG_TESTING_OPTIONS
+       if (wpa_s->extra_sae_rejected_groups) {
+               int i, *groups = wpa_s->extra_sae_rejected_groups;
+
+               for (i = 0; groups[i]; i++) {
+                       wpa_printf(MSG_DEBUG,
+                                  "TESTING: Indicate rejection of an extra SAE group %d",
+                                  groups[i]);
+                       int_array_add_unique(&wpa_s->sme.sae_rejected_groups,
+                                            groups[i]);
+               }
+       }
+#endif /* CONFIG_TESTING_OPTIONS */
+#endif /* CONFIG_SAE && CONFIG_SME */
+}
+
+
 static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit);
 
 /**
@@ -2020,10 +2044,7 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
                }
        } else {
 #ifdef CONFIG_SAE
-#ifdef CONFIG_SME
-               os_free(wpa_s->sme.sae_rejected_groups);
-               wpa_s->sme.sae_rejected_groups = NULL;
-#endif /* CONFIG_SME */
+               wpa_s_clear_sae_rejected(wpa_s);
                wpa_s_setup_sae_pt(wpa_s->conf, ssid);
 #endif /* CONFIG_SAE */
        }
@@ -4039,10 +4060,7 @@ void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
 
        wpa_s->disconnected = 0;
        wpa_s->reassociate = 1;
-#if defined(CONFIG_SAE) && defined(CONFIG_SME)
-       os_free(wpa_s->sme.sae_rejected_groups);
-       wpa_s->sme.sae_rejected_groups = NULL;
-#endif /* CONFIG_SAE && CONFIG_SME */
+       wpa_s_clear_sae_rejected(wpa_s);
        wpa_s->last_owe_group = 0;
        if (ssid) {
                ssid->owe_transition_bss_select_count = 0;
index c34bd28525995fb932e90f534612a3cca7a80977..e274fe33cb88ae3f7865741e8b842638eddf8005 100644 (file)
@@ -1125,6 +1125,7 @@ struct wpa_supplicant {
        u8 last_tk[WPA_TK_MAX_LEN];
        size_t last_tk_len;
        struct wpabuf *last_assoc_req_wpa_ie;
+       int *extra_sae_rejected_groups;
 #endif /* CONFIG_TESTING_OPTIONS */
 
        struct wmm_ac_assoc_data *wmm_ac_assoc_info;