From patchwork Thu Dec 15 20:10:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Badrish Adiga H R X-Patchwork-Id: 706241 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tfl2d1D8Rz9t0H for ; Fri, 16 Dec 2016 07:11:37 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="IQdDr8Kc"; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cHcN6-0003EC-CL; Thu, 15 Dec 2016 20:11:20 +0000 Received: from mail-yw0-x244.google.com ([2607:f8b0:4002:c05::244]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cHcN2-0003Ce-O1 for hostap@lists.infradead.org; Thu, 15 Dec 2016 20:11:17 +0000 Received: by mail-yw0-x244.google.com with SMTP id b66so2387781ywh.2 for ; Thu, 15 Dec 2016 12:10:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=bzR/ovoAPWRqXhTX2+XCZeLFejDHRYNI+Au8oqwhLak=; b=IQdDr8KcyPrFB027hfh6SdAjYM9HmS9/PP9a6yDTkSuMBriRb2fevb0M+Yw7+NxYDs lL4/EeNIoTGyH68gSiANjt0j5m3/azbWyq7+YAi1uWVQVNZ7uYmGKCTSCCRzikiTpmOh BFp13k1mB/NaZ17SQbs3lEJ1zsxfabV6XhLXzhcOpSjlzz2BJrGKkYFX4256jqepnTDn A2+pYNFFOKxO6c0tgp+5ctr3yudeSd+Bc08uESjRXT2w+YDp/ZIUKbMKF8GAMQwTdEfD UBKLZLFyQcGRcexq2dI8Ers4KYzBgSGEpb8h5VnYyAvZD78BtbrXaF60NzoBo2CXhDBZ hmWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=bzR/ovoAPWRqXhTX2+XCZeLFejDHRYNI+Au8oqwhLak=; b=aBtTh93UsKr5FxAxZndNtt3GRjNDFHgAnpFRmJVYYNpJJHHL7c5Ciqrae0YhV+8ERy CaT/CxnpNQ7k4asDYKY1ogXqOMO0j/GipARSoQfZ6PaP/54MYFLF6OKm3YN+4DGtL19Y ZvuTD0FHer7H6W2+Y5OWbs5Z21KBJjgLNNznh4T0OSjPG75rNqFtmvMQq+mUTZNKiWiC dGofF0bNgxxWMTKReyVV9JTKkX+u0lEa3a3gHU/2ZKVb86F7daHf6vZTTZDhdsJrJQrM MKjeJwsvMmlWGzodl3JAj3/p4PE8IwxAHHeWTUXLnfyfoLlWbihpWOEpPVJDmQzfFb0x HUVQ== X-Gm-Message-State: AKaTC03xJF7djITW5mjaA4kuU5+0M3DzK62UKHno+SG1TlD89Bz8L4zzekQn3oLzownvGiQmREhWnjTVC0v4pg== X-Received: by 10.129.160.212 with SMTP id x203mr2519494ywg.193.1481832654731; Thu, 15 Dec 2016 12:10:54 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.82.193 with HTTP; Thu, 15 Dec 2016 12:10:53 -0800 (PST) From: Badrish Adiga H R Date: Fri, 16 Dec 2016 01:40:53 +0530 Message-ID: Subject: [PATCH] Changes to print KAY specific details via ctrl_iface To: hostap@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161215_121116_923363_8624DD72 X-CRM114-Status: GOOD ( 10.73 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:4002:c05:0:0:0:244 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (badrish.adigahr[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: badrishadighar Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Below are changes to print KAY specific details via ctrl_iface... Signed-off-by: Badrish Adiga H R --- src/pae/ieee802_1x_kay.c | 47 +++++++++++++++++++++++++++++++++++++++++++++ src/pae/ieee802_1x_kay.h | 3 +++ wpa_supplicant/ctrl_iface.c | 6 ++++++ 3 files changed, 56 insertions(+) char *start = pos; -- 2.6.1.133.gf5b6079 diff --git a/src/pae/ieee802_1x_kay.c b/src/pae/ieee802_1x_kay.c index 1d6d9a9..818b3bc 100644 --- a/src/pae/ieee802_1x_kay.c +++ b/src/pae/ieee802_1x_kay.c @@ -1641,6 +1641,7 @@ ieee802_1x_mka_decode_dist_sak_body( ieee802_1x_cp_signal_newsak(kay->cp); ieee802_1x_cp_sm_step(kay->cp); + kay->rcvd_keys++; participant->to_use_sak = TRUE; return 0; @@ -3519,3 +3520,49 @@ ieee802_1x_kay_change_cipher_suite(struct ieee802_1x_kay *kay, return 0; } + +#ifdef CONFIG_CTRL_IFACE +/** + * ieee802_1x_kay_get_status - Get IEEE 802.1X KAY status details + * @sm: Pointer to KAY allocated with ieee802_1x_kay_init + * @buf: Buffer for status information + * @buflen: Maximum buffer length + * @verbose: Whether to include verbose status information + * Returns: Number of bytes written to buf. + * + * Query KAY status information. This function fills in a text area with current + * status information. If the buffer (buf) is not large enough, status + * information will be truncated to fit the buffer. + */ +int ieee802_1x_kay_get_status(struct ieee802_1x_kay *kay, char *buf, + size_t buflen) +{ + int len; + if (kay == NULL) + return 0; + + len = os_snprintf(buf, buflen, + "PAE KAY status=%s\n" + "Authenticated=%s\n" + "Secured=%s\n" + "Failed=%s\n" + "Actor Priority=%u\n" + "Key Server Priority=%u\n" + "Is Key Server=%s\n" + "Number of Keys Distributed=%u\n" + "Number of Keys Received=%u\n", + (kay->active)?"Active":"Not-Active", + (kay->authenticated)?"Yes":"No", + (kay->secured)?"Yes":"No", + (kay->failed)?"Yes":"No", + kay->actor_priority, + kay->key_server_priority, + (kay->is_key_server)?"Yes":"No", + (kay->dist_kn - 1), + kay->rcvd_keys); + if (os_snprintf_error(buflen, len)) + return 0; + + return len; +} +#endif /* CONFIG_CTRL_IFACE */ diff --git a/src/pae/ieee802_1x_kay.h b/src/pae/ieee802_1x_kay.h index 9a92d1c..0f54057 100644 --- a/src/pae/ieee802_1x_kay.h +++ b/src/pae/ieee802_1x_kay.h @@ -208,6 +208,7 @@ struct ieee802_1x_kay { int mka_algindex; /* MKA alg table index */ u32 dist_kn; + u32 rcvd_keys; u8 dist_an; time_t dist_time; @@ -267,5 +268,7 @@ int ieee802_1x_kay_enable_tx_sas(struct ieee802_1x_kay *kay, int ieee802_1x_kay_enable_rx_sas(struct ieee802_1x_kay *kay, struct ieee802_1x_mka_ki *lki); int ieee802_1x_kay_enable_new_info(struct ieee802_1x_kay *kay); +int ieee802_1x_kay_get_status(struct ieee802_1x_kay *kay, char *buf, + size_t buflen); #endif /* IEEE802_1X_KAY_H */ diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 4439efb..b5b1380 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -2050,6 +2050,12 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s, pos += res; } +#ifdef CONFIG_MACSEC + ieee802_1x_kay_get_status(wpa_s->kay, pos, end - pos); + if (res >= 0) + pos += res; +#endif /* CONFIG_MACSEC */ + sess_id = eapol_sm_get_session_id(wpa_s->eapol, &sess_id_len); if (sess_id) {