From patchwork Fri Apr 21 21:01:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend van Spriel X-Patchwork-Id: 9693739 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EEB12601D4 for ; Fri, 21 Apr 2017 21:02:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFE1A28609 for ; Fri, 21 Apr 2017 21:02:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D368A28662; Fri, 21 Apr 2017 21:02:29 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 6AE8428609 for ; Fri, 21 Apr 2017 21:02:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1040722AbdDUVC0 (ORCPT ); Fri, 21 Apr 2017 17:02:26 -0400 Received: from lpdvrndsmtp01.broadcom.com ([192.19.229.170]:43741 "EHLO rnd-relay.smtp.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1040602AbdDUVCY (ORCPT ); Fri, 21 Apr 2017 17:02:24 -0400 Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.224.233]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 7659830C06B; Fri, 21 Apr 2017 14:02:22 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 7659830C06B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1492808542; bh=rsbaI73vCtyBuNLaMYFvUq+RGdFollAdWoHU1gAOQRc=; h=From:To:Cc:Subject:Date:From; b=n3gqYPh5hAOA/dvWA5q1cIQKMxvBDuR1Cb+7EIgEyZTTYleIdIDVe7//ZxrIqzs4N 23xakLDqyrwv0t2R4pESUyKUZiwwC+gnM6+f7Jct+Uy2JmdZdLCuqKjzxpKmhVNQQF +U3MTuEuJqoflmAePEPse9eFQQS1mv5fOG78no+U= Received: from jenkins-cam-14.cam.broadcom.com (jenkins-cam-14.cam.broadcom.com [10.177.128.77]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 0B79E81EA4; Fri, 21 Apr 2017 14:02:22 -0700 (PDT) Received: by jenkins-cam-14.cam.broadcom.com (Postfix, from userid 25152) id 33C85B89616; Fri, 21 Apr 2017 22:02:21 +0100 (BST) From: Arend van Spriel To: Johannes Berg , Jouni Malinen Cc: linux-wireless , Arend van Spriel Subject: [RFC] cfg80211: add control port state to struct cfg80211_connect_resp_params Date: Fri, 21 Apr 2017 22:01:47 +0100 Message-Id: <1492808507-31224-1-git-send-email-arend.vanspriel@broadcom.com> X-Mailer: git-send-email 1.9.1 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 When the driver supports offloading of the PTK/GTK handshakes completion of that during connect changes the layer 2 control port state to authorized. This patch allows the driver to pass that state in cfg80211_connect_done() resulting in adding the new flag NL80211_ATTR_PORT_AUTHORIZED in the NL80211_CMD_CONNECT notification. Signed-off-by: Arend van Spriel --- Hi Johannes, Jouni, et al I have been working on 4-way handshake offloading and one of the things discussed was the addition of PORT_AUTHORIZED flag. So this is what I came up with, but I suppose wpa_supplicant wants to know whether it can expect this attribute or not. One option is to have PORT_UNAUTHORIZED flag instead. Another option would be introducing it as nl80211 protocol feature although not sure if it could be considered as such. What do you guys think? Regards, Arend --- include/net/cfg80211.h | 9 +++++++++ include/uapi/linux/nl80211.h | 3 +++ net/wireless/nl80211.c | 2 ++ net/wireless/sme.c | 1 + 4 files changed, 15 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index bdc4424..f416d55 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -5236,6 +5236,12 @@ static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) #define CFG80211_TESTMODE_DUMP(cmd) #endif +enum cfg80211_control_port_state { + CONTROL_PORT_STATE_UNSPECIFIED, + CONTROL_PORT_STATE_UNAUTHORIZED, + CONTROL_PORT_STATE_AUTHORIZED +}; + /** * struct cfg80211_connect_resp_params - Connection response params * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use @@ -5271,6 +5277,8 @@ static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) * not known. This value is used only if @status < 0 to indicate that the * failure is due to a timeout and not due to explicit rejection by the AP. * This value is ignored in other cases (@status >= 0). + * @port_state: Indicates whether the connection is ready to transport + * data packets (see &enum cfg80211_control_port_state). */ struct cfg80211_connect_resp_params { int status; @@ -5288,6 +5296,7 @@ struct cfg80211_connect_resp_params { size_t pmk_len; const u8 *pmkid; enum nl80211_timeout_reason timeout_reason; + enum cfg80211_control_port_state port_state; }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 087493d..34738df 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -2106,6 +2106,8 @@ enum nl80211_commands { * in %NL80211_CMD_CONNECT to indicate that for 802.1X authentication it * wants to use the supported offload. * @NL80211_ATTR_PMKR0_NAME: PMK-R0 Name for offloaded FT. + * @NL80211_ATTR_PORT_AUTHORIZED: flag attribute used in %NL80211_CMD_CONNECT + * notification indicating 4-way handshake offload finished successfully. * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined @@ -2531,6 +2533,7 @@ enum nl80211_attrs { NL80211_ATTR_WANT_1X_OFFLOAD, NL80211_ATTR_PMKR0_NAME, + NL80211_ATTR_PORT_AUTHORIZED, /* add attributes here, update the policy in nl80211.c */ diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index e08c0d3..7fff668 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -13745,6 +13745,8 @@ void nl80211_send_connect_result(struct cfg80211_registered_device *rdev, (nla_put_flag(msg, NL80211_ATTR_TIMED_OUT) || nla_put_u32(msg, NL80211_ATTR_TIMEOUT_REASON, cr->timeout_reason))) || + (cr->port_state != CONTROL_PORT_STATE_UNAUTHORIZED && + nla_put_flag(msg, NL80211_ATTR_PORT_AUTHORIZED)) || (cr->req_ie && nla_put(msg, NL80211_ATTR_REQ_IE, cr->req_ie_len, cr->req_ie)) || (cr->resp_ie && diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 6459bb7..a0d4010 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c @@ -860,6 +860,7 @@ void cfg80211_connect_done(struct net_device *dev, ev->cr.bss = params->bss; ev->cr.status = params->status; ev->cr.timeout_reason = params->timeout_reason; + ev->cr.port_state = params->port_state; spin_lock_irqsave(&wdev->event_lock, flags); list_add_tail(&ev->list, &wdev->event_list);