From patchwork Thu Dec 4 02:18:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masashi Honma X-Patchwork-Id: 417602 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) by ozlabs.org (Postfix) with ESMTP id 0AE031400E2 for ; Thu, 4 Dec 2014 13:19:44 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 9A3E29D2A7; Wed, 3 Dec 2014 21:19:41 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1cIRi9tlEK4L; Wed, 3 Dec 2014 21:19:41 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 8D3F19C1C2; Wed, 3 Dec 2014 21:19:34 -0500 (EST) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 24DFC9C1C2 for ; Wed, 3 Dec 2014 21:19:33 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MUZoTFEK4X+W for ; Wed, 3 Dec 2014 21:19:26 -0500 (EST) Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 120209C1A3 for ; Wed, 3 Dec 2014 21:19:26 -0500 (EST) Received: by mail-pa0-f42.google.com with SMTP id et14so17034294pad.1 for ; Wed, 03 Dec 2014 18:19:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=23LhDOKeYxx1sLRZ5xGemjLPIHFkzCHyIyq4YoyjSko=; b=ibOls6kOQxGtFtNHjeC1zFy/XyH2q5y9jBjUgI4qBj0i9exYqdI6tB+Rx0tP587UHf 4mgpkxMNyT6adOEKIOkYLiD+WthY6Q+0ACfEVyKpEZDL2G+Og6Tq26IGWr50Jq4LrTR8 DLKFb9iHXLbia+SaBdnmLSvQUhZ+C8pCPd3J5itC7f5z3jFApLvc8JNhvA+G/Zlfs1ye Vt+4wC/kuaRAi6TJww8W1t70GtEHyr2782vZQby3kZuCP0pZUoqwG2WJDVfSC7ikWuz3 fRtBwb+xBr8+nkUX+85XBCcxP21Mi5eOXDEInSvNXmDVaP0Pk/+RMpf2+wFfiAmPoolq YN8w== X-Received: by 10.66.235.225 with SMTP id up1mr13803202pac.137.1417659565342; Wed, 03 Dec 2014 18:19:25 -0800 (PST) Received: from localhost.localdomain (pda6ea88e.kngwnt01.ap.so-net.ne.jp. [218.110.168.142]) by mx.google.com with ESMTPSA id m5sm24346943pdp.53.2014.12.03.18.19.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Dec 2014 18:19:24 -0800 (PST) From: Masashi Honma To: hostap@lists.shmoo.com Subject: [PATCH v3] mesh: Display sae_group to result of status command Date: Thu, 4 Dec 2014 11:18:54 +0900 Message-Id: <1417659534-6759-1-git-send-email-masashi.honma@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Signed-off-by: Masashi Honma --- 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 &&