From patchwork Tue Feb 5 09:48:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 10797195 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98D0413B5 for ; Tue, 5 Feb 2019 09:50:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8708B2ABB4 for ; Tue, 5 Feb 2019 09:50:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A78C2ABBE; Tue, 5 Feb 2019 09:50:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCEA02ABB4 for ; Tue, 5 Feb 2019 09:50:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726510AbfBEJuJ (ORCPT ); Tue, 5 Feb 2019 04:50:09 -0500 Received: from mail-eopbgr690086.outbound.protection.outlook.com ([40.107.69.86]:27968 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725893AbfBEJuJ (ORCPT ); Tue, 5 Feb 2019 04:50:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantenna.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RSebRMln27rcS0smQvMdCY2ilGDk2Q1rQL+dfGEZ/00=; b=wCvMiXT5xYaPvL9/jRzWD/9IdQogUb1HYJG0Q6bRtTCECEEW6gK4iA8I3jxa4b1TnmS27bboHD8vb4QJ9N6NFFBuInAvhE74r0ZSWDx+CKYZ0AGSgs/B4RQMX9rD/frWZwyQ3HQjdhcAlEh/Q+gCcfBqIHbTt9slRt0VvPkF9Qs= Received: from DM6PR05MB4620.namprd05.prod.outlook.com (20.176.109.153) by DM6PR05MB4266.namprd05.prod.outlook.com (20.176.78.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.14; Tue, 5 Feb 2019 09:49:17 +0000 Received: from DM6PR05MB4620.namprd05.prod.outlook.com ([fe80::dc24:2038:a5ca:2dab]) by DM6PR05MB4620.namprd05.prod.outlook.com ([fe80::dc24:2038:a5ca:2dab%4]) with mapi id 15.20.1601.016; Tue, 5 Feb 2019 09:49:17 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com (52.135.117.74) by SN6PR05MB5616.namprd05.prod.outlook.com (52.135.111.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.16; Tue, 5 Feb 2019 09:48:55 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::e8c2:9d66:4fd2:b620]) by SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::e8c2:9d66:4fd2:b620%4]) with mapi id 15.20.1601.016; Tue, 5 Feb 2019 09:48:55 +0000 From: Sergey Matyukevich To: "linux-wireless@vger.kernel.org" CC: Igor Mitsyanko , Sergey Matyukevich Subject: [PATCH 1/2] qtnfmac: enable WPA3 OWE support Thread-Topic: [PATCH 1/2] qtnfmac: enable WPA3 OWE support Thread-Index: AQHUvTgCr9cld7okt0uFpuc973ANlg== Date: Tue, 5 Feb 2019 09:48:55 +0000 Message-ID: <20190205094842.31568-2-sergey.matyukevich.os@quantenna.com> References: <20190205094842.31568-1-sergey.matyukevich.os@quantenna.com> In-Reply-To: <20190205094842.31568-1-sergey.matyukevich.os@quantenna.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR07CA0056.namprd07.prod.outlook.com (2603:10b6:a03:60::33) To SN6PR05MB4928.namprd05.prod.outlook.com (2603:10b6:805:9d::10) authentication-results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.11.0 x-originating-ip: [195.182.157.78] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM6PR05MB4266;6:W09NH+k7C6L2rCKli7MB5Erz8+wgVw1mRnwBqt9JzgwPYF4dgSEahSk+Elqkxe5dkZvjcxpRFVNfUP1NMTX3yXO57GVp+ZpTwgRE0i7YmVD9FRU1kXSN8qXMEbMR6CG7oJMls5am7Kns381skRFmqViDdp6apze8n9sGID7Oy1oQ+OzO8Lj5T4ftZljxOjMTW/lYd2JT1cwqM1qUq7qfh/umtnFsOSs/xYm4bljcUEib9zuEABWXJRiJs2IfOuFSgr0cipYIwMcaSkpQ75ThSd2EaBW2NbjWyYgYoTCyrgyWRgIqN/se1oln8E0hrNK5Xjp0cIxjK4WVaI6nxh3cqmtyOUr7grsKMIhfzTgRWNDOlaeE8JWlvLpEt+0mTz9P4g6LeFtV99rG8wIefTOp/lgysGhW4Z25iRCQzmE5mF31WA3CQGM7/0U+9n/OJxc0v5y0Oz+AMPeCtyKe88SdAQ==;5:pibQ9BhuyHysivvQn6+XKMNHfFwHF09BZezcJGFN4IFwlyHYXrqIW3s6pW6LwMh4A/67SaD+DePUIT/gmmbeAugwclUaVHPQxKnNGJqG8QiHPgDdb4oglzn5b8UJogGag7rAp029rk6caouZzGUuhFoml0cpTjI2UEMb9Hjiph9gyPqQi4Pwy1xSJtfMOSIls36Za2kw80t6Yjq7LJxpqQ==;7:ucRK36cha4PJa5wGMW8YLmeBwOKGnrCQk59aAdNx2ggdsTFVz/0AIFACv8R/gQ9SKXkM1VfFWBavWrUuQi1Y/2vYCgs4KDYerAC8kb1nwtNjG0YudJCdSklQI4feD9ruil+LZgTAe0cq3BhxjWKewQ== x-ms-office365-filtering-correlation-id: c19c08eb-0c1e-4805-8aab-08d68b4f246d x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:SN6PR05MB5616; x-ms-traffictypediagnostic: SN6PR05MB5616:|DM6PR05MB4266: x-moderation-data: 2/5/2019 9:49:14 AM x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(346002)(366004)(136003)(39840400004)(376002)(189003)(199004)(7736002)(8936002)(81166006)(68736007)(8676002)(71200400001)(81156014)(14454004)(478600001)(305945005)(6916009)(436003)(50226002)(36756003)(53936002)(6436002)(3846002)(316002)(26005)(486006)(6116002)(386003)(6506007)(11346002)(446003)(102836004)(106356001)(86362001)(2616005)(256004)(2351001)(2906002)(14444005)(105586002)(52116002)(99286004)(76176011)(186003)(25786009)(1076003)(66066001)(103116003)(5640700003)(97736004)(6486002)(6512007)(54906003)(107886003)(71190400001)(2501003)(476003)(4326008);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR05MB4266;H:DM6PR05MB4620.namprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: /P33ZMyYsWDBHGP6IqAUGmQDhkL6C8luH6AivWjvm/g2XP9s6HSIoc9TC/VmGSTAw2gKFSc90LrgkBxltIk+shgnEaJnBQsvl59VLukUMNGeeev/9+cyVfdQu3ZkXURXViq6HYbLKhwoQ/X1f6t4DDgVDif25suymQKbZRJoNBhBrifWI/3A9NVRpq+xXS6nOEitU7etX9KhvZG8PY00bAdkuzL+S+tNZHhhf4iFHk5kWSn7V/ebUDuEtb9+MGp3ISifwMXzW4URTmrPEOPNr6HVJUO6ESBCiOSJRMUQjUYYAFPc2wk75HAQYp+BqEXISAQkyunBmYo+flWqgQh52c9Q070dkDipN0rDuXootfTgYhJHWeDOnggtaN4znn3Jz0WefhgO5dos2Dgh+vj+sEGPYGPudZ/UZSoTpRwzQZk= MIME-Version: 1.0 X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-Network-Message-Id: c19c08eb-0c1e-4805-8aab-08d68b4f246d X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 09:49:17.4751 (UTC) X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR05MB4266 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the case of OWE, STA should be able to pass DH IEs from AP assoc responses to wpa_s for processing. For this purpose DH IEs are received from firmware in BSS_JOIN events and passed to wireless core and then to wpa_s as additional optional rsp_ies parameter for cfg80211_connect_result. Signed-off-by: Sergey Matyukevich --- drivers/net/wireless/quantenna/qtnfmac/event.c | 144 +++++++++++++++++-------- drivers/net/wireless/quantenna/qtnfmac/qlink.h | 1 + 2 files changed, 102 insertions(+), 43 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c index 3fd1a9217737..944729b74f17 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/event.c +++ b/drivers/net/wireless/quantenna/qtnfmac/event.c @@ -150,6 +150,13 @@ qtnf_event_handle_bss_join(struct qtnf_vif *vif, struct cfg80211_chan_def chandef; struct cfg80211_bss *bss = NULL; u8 *ie = NULL; + size_t payload_len; + u16 tlv_type; + u16 tlv_value_len; + size_t tlv_full_len; + const struct qlink_tlv_hdr *tlv; + const u8 *rsp_ies = NULL; + size_t rsp_ies_len = 0; if (unlikely(len < sizeof(*join_info))) { pr_err("VIF%u.%u: payload is too short (%u < %zu)\n", @@ -167,67 +174,118 @@ qtnf_event_handle_bss_join(struct qtnf_vif *vif, pr_debug("VIF%u.%u: BSSID:%pM status:%u\n", vif->mac->macid, vif->vifid, join_info->bssid, status); - if (status == WLAN_STATUS_SUCCESS) { - qlink_chandef_q2cfg(wiphy, &join_info->chan, &chandef); - if (!cfg80211_chandef_valid(&chandef)) { - pr_warn("MAC%u.%u: bad channel freq=%u cf1=%u cf2=%u bw=%u\n", + if (status != WLAN_STATUS_SUCCESS) + goto done; + + qlink_chandef_q2cfg(wiphy, &join_info->chan, &chandef); + if (!cfg80211_chandef_valid(&chandef)) { + pr_warn("MAC%u.%u: bad channel freq=%u cf1=%u cf2=%u bw=%u\n", + vif->mac->macid, vif->vifid, + chandef.chan->center_freq, + chandef.center_freq1, + chandef.center_freq2, + chandef.width); + status = WLAN_STATUS_UNSPECIFIED_FAILURE; + goto done; + } + + bss = cfg80211_get_bss(wiphy, chandef.chan, join_info->bssid, + NULL, 0, IEEE80211_BSS_TYPE_ESS, + IEEE80211_PRIVACY_ANY); + if (!bss) { + pr_warn("VIF%u.%u: add missing BSS:%pM chan:%u\n", + vif->mac->macid, vif->vifid, + join_info->bssid, chandef.chan->hw_value); + + if (!vif->wdev.ssid_len) { + pr_warn("VIF%u.%u: SSID unknown for BSS:%pM\n", + vif->mac->macid, vif->vifid, + join_info->bssid); + status = WLAN_STATUS_UNSPECIFIED_FAILURE; + goto done; + } + + ie = kzalloc(2 + vif->wdev.ssid_len, GFP_KERNEL); + if (!ie) { + pr_warn("VIF%u.%u: IE alloc failed for BSS:%pM\n", vif->mac->macid, vif->vifid, - chandef.chan->center_freq, - chandef.center_freq1, - chandef.center_freq2, - chandef.width); + join_info->bssid); status = WLAN_STATUS_UNSPECIFIED_FAILURE; goto done; } - bss = cfg80211_get_bss(wiphy, chandef.chan, join_info->bssid, - NULL, 0, IEEE80211_BSS_TYPE_ESS, - IEEE80211_PRIVACY_ANY); + ie[0] = WLAN_EID_SSID; + ie[1] = vif->wdev.ssid_len; + memcpy(ie + 2, vif->wdev.ssid, vif->wdev.ssid_len); + + bss = cfg80211_inform_bss(wiphy, chandef.chan, + CFG80211_BSS_FTYPE_UNKNOWN, + join_info->bssid, 0, + WLAN_CAPABILITY_ESS, 100, + ie, 2 + vif->wdev.ssid_len, + 0, GFP_KERNEL); if (!bss) { - pr_warn("VIF%u.%u: add missing BSS:%pM chan:%u\n", + pr_warn("VIF%u.%u: can't connect to unknown BSS: %pM\n", vif->mac->macid, vif->vifid, - join_info->bssid, chandef.chan->hw_value); + join_info->bssid); + status = WLAN_STATUS_UNSPECIFIED_FAILURE; + goto done; + } + } - if (!vif->wdev.ssid_len) { - pr_warn("VIF%u.%u: SSID unknown for BSS:%pM\n", - vif->mac->macid, vif->vifid, - join_info->bssid); - status = WLAN_STATUS_UNSPECIFIED_FAILURE; - goto done; - } + payload_len = len - sizeof(*join_info); + tlv = (struct qlink_tlv_hdr *)join_info->ies; + + while (payload_len >= sizeof(struct qlink_tlv_hdr)) { + tlv_type = le16_to_cpu(tlv->type); + tlv_value_len = le16_to_cpu(tlv->len); + tlv_full_len = tlv_value_len + sizeof(struct qlink_tlv_hdr); - ie = kzalloc(2 + vif->wdev.ssid_len, GFP_KERNEL); - if (!ie) { - pr_warn("VIF%u.%u: IE alloc failed for BSS:%pM\n", - vif->mac->macid, vif->vifid, - join_info->bssid); + if (payload_len < tlv_full_len) { + pr_warn("invalid %u TLV\n", tlv_type); + status = WLAN_STATUS_UNSPECIFIED_FAILURE; + goto done; + } + + if (tlv_type == QTN_TLV_ID_IE_SET) { + const struct qlink_tlv_ie_set *ie_set; + unsigned int ie_len; + + if (payload_len < sizeof(*ie_set)) { + pr_warn("invalid IE_SET TLV\n"); status = WLAN_STATUS_UNSPECIFIED_FAILURE; goto done; } - ie[0] = WLAN_EID_SSID; - ie[1] = vif->wdev.ssid_len; - memcpy(ie + 2, vif->wdev.ssid, vif->wdev.ssid_len); - - bss = cfg80211_inform_bss(wiphy, chandef.chan, - CFG80211_BSS_FTYPE_UNKNOWN, - join_info->bssid, 0, - WLAN_CAPABILITY_ESS, 100, - ie, 2 + vif->wdev.ssid_len, - 0, GFP_KERNEL); - if (!bss) { - pr_warn("VIF%u.%u: can't connect to unknown BSS: %pM\n", - vif->mac->macid, vif->vifid, - join_info->bssid); - status = WLAN_STATUS_UNSPECIFIED_FAILURE; - goto done; + ie_set = (const struct qlink_tlv_ie_set *)tlv; + ie_len = tlv_value_len - + (sizeof(*ie_set) - sizeof(ie_set->hdr)); + + switch (ie_set->type) { + case QLINK_IE_SET_ASSOC_RESP: + if (ie_len) { + rsp_ies = ie_set->ie_data; + rsp_ies_len = ie_len; + } + break; + default: + pr_warn("unexpected IE type: %u\n", + ie_set->type); + break; } } + + payload_len -= tlv_full_len; + tlv = (struct qlink_tlv_hdr *)(tlv->val + tlv_value_len); } + if (payload_len) + pr_warn("VIF%u.%u: unexpected remaining payload: %zu\n", + vif->mac->macid, vif->vifid, payload_len); + done: - cfg80211_connect_result(vif->netdev, join_info->bssid, NULL, 0, NULL, - 0, status, GFP_KERNEL); + cfg80211_connect_result(vif->netdev, join_info->bssid, NULL, 0, rsp_ies, + rsp_ies_len, status, GFP_KERNEL); if (bss) { if (!ether_addr_equal(vif->bssid, join_info->bssid)) ether_addr_copy(vif->bssid, join_info->bssid); diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink.h b/drivers/net/wireless/quantenna/qtnfmac/qlink.h index 27fdb5b01ee3..1f7ced21cb39 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink.h @@ -984,6 +984,7 @@ struct qlink_event_bss_join { struct qlink_chandef chan; u8 bssid[ETH_ALEN]; __le16 status; + u8 ies[0]; } __packed; /** From patchwork Tue Feb 5 09:48:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 10797191 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5206B13B5 for ; Tue, 5 Feb 2019 09:49:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 403432ABAF for ; Tue, 5 Feb 2019 09:49:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 331ED2ABB7; Tue, 5 Feb 2019 09:49:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 641422ABAF for ; Tue, 5 Feb 2019 09:49:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727842AbfBEJtj (ORCPT ); Tue, 5 Feb 2019 04:49:39 -0500 Received: from mail-eopbgr780079.outbound.protection.outlook.com ([40.107.78.79]:10976 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727226AbfBEJtj (ORCPT ); Tue, 5 Feb 2019 04:49:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantenna.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BvrNQwsO5Ed4k2SXqGAQBquIN/q2JIGCD6jEalQUo1g=; b=vUoeADrgCZerEQtors0NxvR6KrRUIrbq5fjnLXhOAO8s+R2+DoQlZfW7uyTotnkmGi87rwZn04vTB10C6OEkq5Aet9+ra0nsgRzzpT9zj4xrerOMXBWKGfRerFjshGiMqf5Hq0pq4TQL42CWaj90Ipi3QSim5DgpJE/w5gU15wo= Received: from DM5PR05MB3162.namprd05.prod.outlook.com (10.173.219.20) by DM5PR05MB3660.namprd05.prod.outlook.com (10.174.190.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.13; Tue, 5 Feb 2019 09:49:22 +0000 Received: from DM5PR05MB3162.namprd05.prod.outlook.com ([fe80::bca0:2f10:431f:3e18]) by DM5PR05MB3162.namprd05.prod.outlook.com ([fe80::bca0:2f10:431f:3e18%9]) with mapi id 15.20.1601.013; Tue, 5 Feb 2019 09:49:22 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com (52.135.117.74) by SN6PR05MB5616.namprd05.prod.outlook.com (52.135.111.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.16; Tue, 5 Feb 2019 09:48:57 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::e8c2:9d66:4fd2:b620]) by SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::e8c2:9d66:4fd2:b620%4]) with mapi id 15.20.1601.016; Tue, 5 Feb 2019 09:48:57 +0000 From: Sergey Matyukevich To: "linux-wireless@vger.kernel.org" CC: Igor Mitsyanko , Sergey Matyukevich Subject: [PATCH 2/2] qtnfmac: enable WPA3 SAE support Thread-Topic: [PATCH 2/2] qtnfmac: enable WPA3 SAE support Thread-Index: AQHUvTgDlzOXScRVvkm/sKbAFqt1ZQ== Date: Tue, 5 Feb 2019 09:48:57 +0000 Message-ID: <20190205094842.31568-3-sergey.matyukevich.os@quantenna.com> References: <20190205094842.31568-1-sergey.matyukevich.os@quantenna.com> In-Reply-To: <20190205094842.31568-1-sergey.matyukevich.os@quantenna.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR07CA0056.namprd07.prod.outlook.com (2603:10b6:a03:60::33) To SN6PR05MB4928.namprd05.prod.outlook.com (2603:10b6:805:9d::10) authentication-results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.11.0 x-originating-ip: [195.182.157.78] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR05MB3660;6:m4blQE4KRSP8k4yL2DVvzH27Hc7ghx0KyGz9P6eAGVWR63zzLfo30aEHYoR+Hl9bf/nqDq0HKoYjwG5ynwrucksWS6kEArHEzN0otbAgEK+jyZrGk9bCkFY6G7b0fVadGoQmOq5QcuorVBY8xv6takjUaKv3VlvBajRY3Lpzxjpli/06SCDZpPkJ1/QwNouLtRuwksRwFsKJ7fhxXb2vjb+FO8brOsi33+i2D7wLWkD7pBhxjnlsmXpP5xR2GL0LnFblU2+7VxXC4/EUOvpbibN5xJPlwiCBzQ8T+yIhSKSir2Gzx26jA0pwSzpnDnvR2pAVM6iCMVLaktvQAerNCYKDMWSQYzoSfAh44l0Q6GoiIsZjixbBJdYz6Ti13UG9VIAJgQP+AkIw2YvEGfoLo06uTtB1Q4IRFzHch0zq59h/ZuVlDaq+9lnn6qZpUJwUf++419hOsN6bKXfh/JII1g==;5:3GFk2lHxak4/rZLdUKQ0INEkDZ16MTFc8F9vPMmX71QOaiD0XkopHK9uGdJYh40IigeV3wQCfwuV7bUy/87yRiVLOrl1oO+MgpfYpFjZjyofN9FnefDnvBSZJ7yF0Oxls83F1yIHabui+a3L7qxL06kFwxipkAFeXT904ftXZHdbsPM3Ory7YwqA2B0Oa6FuGUJ0OHfbsGdRsDHIrkqwjQ==;7:f0K/jmVnHrwQMju6gLKbA+yNCbuXkWTD3aw9VCcnmSGrOxsRodnvvrnA+aft5BthYSFR/+6XHAUN1/qRSaaYGP/W5VkFAkr6PQav0q+USFZGEy7pqq4xfOJmm1EBWf/XbhTBfSs7gx0nWcXrj97t8w== x-ms-office365-filtering-correlation-id: 9bbba190-3ee4-47c5-d3e8-08d68b4f2579 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:SN6PR05MB5616; x-ms-traffictypediagnostic: SN6PR05MB5616:|DM5PR05MB3660: x-moderation-data: 2/5/2019 9:49:20 AM x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(136003)(366004)(396003)(39840400004)(189003)(199004)(99286004)(25786009)(2616005)(2906002)(11346002)(102836004)(186003)(76176011)(14444005)(446003)(106356001)(105586002)(316002)(86362001)(476003)(5640700003)(68736007)(486006)(256004)(52116002)(6436002)(2351001)(26005)(7736002)(6916009)(436003)(6116002)(8676002)(36756003)(6512007)(2501003)(386003)(3846002)(1076003)(53936002)(71190400001)(50226002)(81166006)(478600001)(66066001)(103116003)(4326008)(97736004)(8936002)(6506007)(107886003)(54906003)(81156014)(71200400001)(6486002)(305945005)(14454004);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR05MB3660;H:DM5PR05MB3162.namprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: WZvtzUwCVBBcjnVTUrMUkAo784a4c9wrarWV+4A/N8+e68Y7SO821oZJ3CBo+clC6goQIn7tHCHLgNZ+avEmvLE4onpAHbap8E4PikdF/IahXpysGx5KjjYqSj5TPYNj5N7EfIzftf7Y4Go1E6QKnnat2ASi2lqml1vJnRVwYIFuNNiVNclH/ztany15j8s7n0QPlL5VYnqqqn/EqNQhgYGZFXMfdJYckZX4intzFLWfQVY1vK+uazm7Y/4WyMzTmOEidUoJ7n7RPxkK+Xr8C/udikA+qd20581OT1qDFH3Mc7C3mPiWkiOP8oK8aUz0Fn+HgGrqywcyy4pXH74GZ2dcgcmN6vJKdUQXAzuT58yN9cIo7AV27l3lbz88cnkRi5ioBD/ir+OUWI/x0jiqOmnWSFY3CN8kQggqXMKzYHE= MIME-Version: 1.0 X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9bbba190-3ee4-47c5-d3e8-08d68b4f2579 X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 09:49:22.4600 (UTC) X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR05MB3660 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the case of SAE AP, drivers offload authentication to user-space software, e.g. hostapd. For FullMAC drivers the procedure is as follows. If auth_type is SAE and user space indicates external authentication capability, then driver requests authentication offload to user-space software using cfg80211_external_auth_request call. From that point, auth frame exchange is performed transparently for driver: user-space software sends/receives mgmt frames using mgmt_tx/mgmt_frame_register cfg80211 callbacks. As soon as authenitcation is completed, user-space software notifies driver about its status using external_auth cfg80211 callback. Signed-off-by: Sergey Matyukevich --- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 40 ++++++++++++++++++++-- drivers/net/wireless/quantenna/qtnfmac/commands.c | 29 ++++++++++++++++ drivers/net/wireless/quantenna/qtnfmac/commands.h | 2 ++ drivers/net/wireless/quantenna/qtnfmac/event.c | 41 +++++++++++++++++++++++ drivers/net/wireless/quantenna/qtnfmac/qlink.h | 35 +++++++++++++++++++ 5 files changed, 145 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index 45f4cef7de9c..dcb0991432f4 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -53,9 +53,11 @@ static const u32 qtnf_cipher_suites[] = { static const struct ieee80211_txrx_stypes qtnf_mgmt_stypes[NUM_NL80211_IFTYPES] = { [NL80211_IFTYPE_STATION] = { - .tx = BIT(IEEE80211_STYPE_ACTION >> 4), + .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | + BIT(IEEE80211_STYPE_AUTH >> 4), .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4), + BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | + BIT(IEEE80211_STYPE_AUTH >> 4), }, [NL80211_IFTYPE_AP] = { .tx = BIT(IEEE80211_STYPE_ACTION >> 4), @@ -636,6 +638,12 @@ qtnf_connect(struct wiphy *wiphy, struct net_device *dev, if (vif->wdev.iftype != NL80211_IFTYPE_STATION) return -EOPNOTSUPP; + if (sme->auth_type == NL80211_AUTHTYPE_SAE && + !(sme->flags & CONNECT_REQ_EXTERNAL_AUTH_SUPPORT)) { + pr_err("can not offload authentication to userspace\n"); + return -EOPNOTSUPP; + } + if (sme->bssid) ether_addr_copy(vif->bssid, sme->bssid); else @@ -653,6 +661,30 @@ qtnf_connect(struct wiphy *wiphy, struct net_device *dev, } static int +qtnf_external_auth(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_external_auth_params *auth) +{ + struct qtnf_vif *vif = qtnf_netdev_get_priv(dev); + int ret; + + if (vif->wdev.iftype != NL80211_IFTYPE_STATION) + return -EOPNOTSUPP; + + if (!ether_addr_equal(vif->bssid, auth->bssid)) + pr_warn("unexpected bssid: %pM", auth->bssid); + + ret = qtnf_cmd_send_external_auth(vif, auth); + if (ret) { + pr_err("VIF%u.%u: failed to report external auth\n", + vif->mac->macid, vif->vifid); + goto out; + } + +out: + return ret; +} + +static int qtnf_disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_code) { @@ -946,6 +978,7 @@ static struct cfg80211_ops qtn_cfg80211_ops = { .set_default_mgmt_key = qtnf_set_default_mgmt_key, .scan = qtnf_scan, .connect = qtnf_connect, + .external_auth = qtnf_external_auth, .disconnect = qtnf_disconnect, .dump_survey = qtnf_dump_survey, .get_channel = qtnf_get_channel, @@ -1125,6 +1158,9 @@ int qtnf_wiphy_register(struct qtnf_hw_info *hw_info, struct qtnf_wmac *mac) if (!(hw_info->hw_capab & QLINK_HW_CAPAB_OBSS_SCAN)) wiphy->features |= NL80211_FEATURE_NEED_OBSS_SCAN; + if (hw_info->hw_capab & QLINK_HW_CAPAB_SAE) + wiphy->features |= NL80211_FEATURE_SAE; + #ifdef CONFIG_PM if (macinfo->wowlan) wiphy->wowlan = macinfo->wowlan; diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index 0f48f541de41..85a2a58f4c16 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -2322,6 +2322,35 @@ int qtnf_cmd_send_connect(struct qtnf_vif *vif, return ret; } +int qtnf_cmd_send_external_auth(struct qtnf_vif *vif, + struct cfg80211_external_auth_params *auth) +{ + struct sk_buff *cmd_skb; + struct qlink_cmd_external_auth *cmd; + int ret; + + cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, + QLINK_CMD_EXTERNAL_AUTH, + sizeof(*cmd)); + if (!cmd_skb) + return -ENOMEM; + + cmd = (struct qlink_cmd_external_auth *)cmd_skb->data; + + ether_addr_copy(cmd->bssid, auth->bssid); + cmd->status = cpu_to_le16(auth->status); + + qtnf_bus_lock(vif->mac->bus); + ret = qtnf_cmd_send(vif->mac->bus, cmd_skb); + if (ret) + goto out; + +out: + qtnf_bus_unlock(vif->mac->bus); + + return ret; +} + int qtnf_cmd_send_disconnect(struct qtnf_vif *vif, u16 reason_code) { struct sk_buff *cmd_skb; diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.h b/drivers/net/wireless/quantenna/qtnfmac/commands.h index 96dff643bbc4..64f0b9dc8a14 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.h +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.h @@ -51,6 +51,8 @@ int qtnf_cmd_send_del_sta(struct qtnf_vif *vif, int qtnf_cmd_send_scan(struct qtnf_wmac *mac); int qtnf_cmd_send_connect(struct qtnf_vif *vif, struct cfg80211_connect_params *sme); +int qtnf_cmd_send_external_auth(struct qtnf_vif *vif, + struct cfg80211_external_auth_params *auth); int qtnf_cmd_send_disconnect(struct qtnf_vif *vif, u16 reason_code); int qtnf_cmd_send_updown_intf(struct qtnf_vif *vif, diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c index 944729b74f17..6c1b886339ac 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/event.c +++ b/drivers/net/wireless/quantenna/qtnfmac/event.c @@ -574,6 +574,43 @@ static int qtnf_event_handle_radar(struct qtnf_vif *vif, return 0; } +static int +qtnf_event_handle_external_auth(struct qtnf_vif *vif, + const struct qlink_event_external_auth *ev, + u16 len) +{ + struct cfg80211_external_auth_params auth = {0}; + struct wiphy *wiphy = priv_to_wiphy(vif->mac); + int ret; + + if (len < sizeof(*ev)) { + pr_err("MAC%u: payload is too short\n", vif->mac->macid); + return -EINVAL; + } + + if (!wiphy->registered || !vif->netdev) + return 0; + + if (ev->ssid_len) { + memcpy(auth.ssid.ssid, ev->ssid, ev->ssid_len); + auth.ssid.ssid_len = ev->ssid_len; + } + + auth.key_mgmt_suite = le32_to_cpu(ev->akm_suite); + ether_addr_copy(auth.bssid, ev->bssid); + auth.action = ev->action; + + pr_info("%s: external auth bss=%pM action=%u akm=%u\n", + vif->netdev->name, auth.bssid, auth.action, + auth.key_mgmt_suite); + + ret = cfg80211_external_auth_request(vif->netdev, &auth, GFP_KERNEL); + if (ret) + pr_warn("failed to offload external auth request\n"); + + return ret; +} + static int qtnf_event_parse(struct qtnf_wmac *mac, const struct sk_buff *event_skb) { @@ -632,6 +669,10 @@ static int qtnf_event_parse(struct qtnf_wmac *mac, ret = qtnf_event_handle_radar(vif, (const void *)event, event_len); break; + case QLINK_EVENT_EXTERNAL_AUTH: + ret = qtnf_event_handle_external_auth(vif, (const void *)event, + event_len); + break; default: pr_warn("unknown event type: %x\n", event_id); break; diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink.h b/drivers/net/wireless/quantenna/qtnfmac/qlink.h index 1f7ced21cb39..7798edcf7980 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink.h @@ -68,6 +68,7 @@ enum qlink_hw_capab { QLINK_HW_CAPAB_PWR_MGMT = BIT(4), QLINK_HW_CAPAB_OBSS_SCAN = BIT(5), QLINK_HW_CAPAB_SCAN_DWELL = BIT(6), + QLINK_HW_CAPAB_SAE = BIT(8), }; enum qlink_iface_type { @@ -250,6 +251,7 @@ enum qlink_cmd_type { QLINK_CMD_DISCONNECT = 0x0061, QLINK_CMD_PM_SET = 0x0062, QLINK_CMD_WOWLAN_SET = 0x0063, + QLINK_CMD_EXTERNAL_AUTH = 0x0066, }; /** @@ -481,6 +483,20 @@ struct qlink_cmd_connect { } __packed; /** + * struct qlink_cmd_external_auth - data for QLINK_CMD_EXTERNAL_AUTH command + * + * @bssid: BSSID of the BSS to connect to + * @status: authentication status code + * @payload: variable portion of connection request. + */ +struct qlink_cmd_external_auth { + struct qlink_cmd chdr; + u8 bssid[ETH_ALEN]; + __le16 status; + u8 payload[0]; +} __packed; + +/** * struct qlink_cmd_disconnect - data for QLINK_CMD_DISCONNECT command * * @reason: code of the reason of disconnect, see &enum ieee80211_reasoncode. @@ -925,6 +941,7 @@ enum qlink_event_type { QLINK_EVENT_BSS_LEAVE = 0x0027, QLINK_EVENT_FREQ_CHANGE = 0x0028, QLINK_EVENT_RADAR = 0x0029, + QLINK_EVENT_EXTERNAL_AUTH = 0x0030, }; /** @@ -1100,6 +1117,24 @@ struct qlink_event_radar { u8 rsvd[3]; } __packed; +/** + * struct qlink_event_external_auth - data for QLINK_EVENT_EXTERNAL_AUTH event + * + * @ssid: SSID announced by BSS + * @ssid_len: SSID length + * @bssid: BSSID of the BSS to connect to + * @akm_suite: AKM suite for external authentication + * @action: action type/trigger for external authentication + */ +struct qlink_event_external_auth { + struct qlink_event ehdr; + u8 ssid[IEEE80211_MAX_SSID_LEN]; + u8 ssid_len; + u8 bssid[ETH_ALEN]; + __le32 akm_suite; + u8 action; +} __packed; + /* QLINK TLVs (Type-Length Values) definitions */