]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add sae_rejected_groups to hostapd STA control interface command
authorJouni Malinen <jouni@codeaurora.org>
Thu, 12 Dec 2019 20:51:08 +0000 (22:51 +0200)
committerJouni Malinen <jouni@codeaurora.org>
Thu, 12 Dec 2019 21:52:36 +0000 (23:52 +0200)
This is mainly for testing purposes to be able to check which groups
a STA reports as having been rejected when using SAE H2E.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/ap/ctrl_iface_ap.c

index bde61ee2634d9461de6956b9e0544146d2e73a73..a0e4474a0653faa1c7e5d0e08168364d30214e38 100644 (file)
@@ -273,6 +273,36 @@ static int hostapd_ctrl_iface_sta_mib(struct hostapd_data *hapd,
                if (!os_snprintf_error(buflen - len, res))
                        len += res;
        }
+
+       if (sta->sae && sta->sae->tmp) {
+               const u8 *pos;
+               unsigned int i, count;
+               struct wpabuf *groups = sta->sae->tmp->peer_rejected_groups;
+
+               res = os_snprintf(buf + len, buflen - len,
+                                 "sae_rejected_groups=");
+               if (!os_snprintf_error(buflen - len, res))
+                       len += res;
+
+               if (groups) {
+                       pos = wpabuf_head(groups);
+                       count = wpabuf_len(groups) / 2;
+               } else {
+                       pos = NULL;
+                       count = 0;
+               }
+               for (i = 0; pos && i < count; i++) {
+                       res = os_snprintf(buf + len, buflen - len, "%s%d",
+                                         i == 0 ? "" : " ", WPA_GET_LE16(pos));
+                       if (!os_snprintf_error(buflen - len, res))
+                               len += res;
+                       pos += 2;
+               }
+
+               res = os_snprintf(buf + len, buflen - len, "\n");
+               if (!os_snprintf_error(buflen - len, res))
+                       len += res;
+       }
 #endif /* CONFIG_SAE */
 
        if (sta->vlan_id > 0) {