From: Jouni Malinen Date: Thu, 12 Dec 2019 20:51:08 +0000 (+0200) Subject: Add sae_rejected_groups to hostapd STA control interface command X-Git-Tag: hostap_2_10~2166 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fde39fb1a9e110e273971a613d2375cec350afb;p=thirdparty%2Fhostap.git Add sae_rejected_groups to hostapd STA control interface command 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 --- diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c index bde61ee26..a0e4474a0 100644 --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c @@ -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) {