[PATCH v3] mesh: Display sae_group to result of status command
Masashi Honma
masashi.honma
Wed Dec 3 18:18:54 PST 2014
Signed-off-by: Masashi Honma <masashi.honma at gmail.com>
---
wpa_supplicant/ap.c | 31 +++++++++++++++++++++++++++++++
wpa_supplicant/ap.h | 2 ++
wpa_supplicant/ctrl_iface.c | 11 ++++++++++-
3 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index f3acbc1..dd4ff57 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -1064,6 +1064,37 @@ int ap_ctrl_iface_wpa_get_status(struct wpa_supplicant *wpa_s, char *buf,
return pos - buf;
}
+
+#ifdef CONFIG_SAE
+int ap_ctrl_iface_wpa_get_sae_status(struct wpa_supplicant *wpa_s, char *buf,
+ size_t buflen, int verbose)
+{
+ char *pos = buf, *end = buf + buflen;
+ int ret;
+ struct hostapd_data *hapd;
+ struct sta_info *sta;
+
+ if (wpa_s->ifmsh == NULL)
+ return 0;
+
+ hapd = wpa_s->ifmsh->bss[0];
+ sta = hapd->sta_list;
+
+ while (sta) {
+ if (sta->sae != NULL && sta->sae->state == SAE_ACCEPTED) {
+ ret = os_snprintf(pos, end - pos, "sae_group=%d\n",
+ sta->sae->group);
+ if (ret < 0 || ret >= end - pos)
+ return pos - buf;
+ pos += ret;
+ break;
+ }
+ sta = sta->next;
+ }
+ return pos - buf;
+}
+#endif /* CONFIG_SAE */
+
#endif /* CONFIG_CTRL_IFACE */
diff --git a/wpa_supplicant/ap.h b/wpa_supplicant/ap.h
index 4d80c7a..554ff54 100644
--- a/wpa_supplicant/ap.h
+++ b/wpa_supplicant/ap.h
@@ -38,6 +38,8 @@ int ap_ctrl_iface_sta_disassociate(struct wpa_supplicant *wpa_s,
const char *txtaddr);
int ap_ctrl_iface_wpa_get_status(struct wpa_supplicant *wpa_s, char *buf,
size_t buflen, int verbose);
+int ap_ctrl_iface_wpa_get_sae_status(struct wpa_supplicant *wpa_s, char *buf,
+ size_t buflen, int verbose);
void ap_tx_status(void *ctx, const u8 *addr,
const u8 *buf, size_t len, int ack);
void ap_eapol_tx_status(void *ctx, const u8 *dst,
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 961a79a..bb174aa 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -1701,12 +1701,21 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s,
if (ret < 0 || ret >= end - pos)
return pos - buf;
pos += ret;
- }
+ } else {
+ ret = ap_ctrl_iface_wpa_get_sae_status(wpa_s, pos, end - pos,
+ verbose);
+ if (ret < 0 || ret >= end - pos)
+ return pos - buf;
+ if (ret == 0) {
#endif /* CONFIG_SAE */
ret = os_snprintf(pos, end - pos, "wpa_state=%s\n",
wpa_supplicant_state_txt(wpa_s->wpa_state));
if (ret < 0 || ret >= end - pos)
return pos - buf;
+#ifdef CONFIG_SAE
+ }
+ }
+#endif /* CONFIG_SAE */
pos += ret;
if (wpa_s->l2 &&
--
1.9.1
More information about the Hostap
mailing list