From patchwork Thu Jul 14 05:30:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinayak Yadawad X-Patchwork-Id: 591649 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBE5FC43334 for ; Thu, 14 Jul 2022 05:30:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234088AbiGNFai (ORCPT ); Thu, 14 Jul 2022 01:30:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231150AbiGNFah (ORCPT ); Thu, 14 Jul 2022 01:30:37 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB9D720BD5 for ; Wed, 13 Jul 2022 22:30:36 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id q82so582017pgq.6 for ; Wed, 13 Jul 2022 22:30:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:mime-version; bh=1ZaLsdcvPz1wJGvRoTuSH4lmx5HZECnVXsxr3LwD1WI=; b=COq3OYQXlFB3XaQWsdS9bGf6ggvQSflZGZWH9yANA3Ps6cdigb/9bX9V/9EmD6gdt0 Ku4awpbLzyaXOcnhOjBVcU4ShVNCDClEXEqLWVSvUZPGZss+l3vYw3CpkRp5KpZQsP+8 ux3phc7KC0NiHdnTZwHP5NSw/FiuMOhX8HYsU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version; bh=1ZaLsdcvPz1wJGvRoTuSH4lmx5HZECnVXsxr3LwD1WI=; b=aZay/8bm2Lh9ht48RvMHQhalJBQr9AhSjXrmd7yspXw/JEOz8Y8sbaLYkB7z4c7/R+ qLyqcC5bn+XhyOnLU/8ReZzHymkrFwXFO1UoriANG/q2uq0qlQainWNHI+lzjouIZT/K X6NfxYHEzdBP27sEgIiYMryiLrTaw0gP9DLX4tOQHgJgy2GrLOeJgFwp40IShNs7i8Yk imA/wpxQmMYHpaiYbQ1tkGPwCA2EpHalrmOCPZAx8xayg3JrEpJham9mYKF6kWWHFRle dNirNJA7f1mzBdOem8ePJWg2moVi22julvA+fh8NHlKSayJ9liM7FzpLPJ0XXNRxEqDa KYEQ== X-Gm-Message-State: AJIora8MCnMeuLCusb22qYbssfPdyuTrhwb/yYbZ8EY3I1+sbBEXfO1x 0b0aiSj1WZlFlD6l79o0JOfN9g== X-Google-Smtp-Source: AGRyM1sV+tW+eV/inWbVjzsW+EUa2/jW44kKajk+Ic97KtKGoIF7W2ArLg07Tt3pXn2pGWeD59gzfg== X-Received: by 2002:a65:5a42:0:b0:411:bf36:eeec with SMTP id z2-20020a655a42000000b00411bf36eeecmr6029316pgs.522.1657776635898; Wed, 13 Jul 2022 22:30:35 -0700 (PDT) Received: from ibnvda0196.ibn.broadcom.net ([192.19.252.250]) by smtp.gmail.com with ESMTPSA id c190-20020a621cc7000000b005289fbef7c4sm548684pfc.140.2022.07.13.22.30.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jul 2022 22:30:35 -0700 (PDT) From: Vinayak Yadawad To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, jithu.jance@broadcom.com, Vinayak Yadawad Subject: [PATCH 1/1] cfg80211: Allow AP/P2PGO to indicate port authorization to peer STA/P2PClient Date: Thu, 14 Jul 2022 11:00:28 +0530 Message-Id: <5ee2d7c8f809c3d7f773ad4231cb894af850e1a2.1657720730.git.vinayak.yadawad@broadcom.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org In 4way handshake offload, cfg80211_port_authorized enables driver to indicate successful 4way handshake to cfg80211 layer. Currently this path of port authorization is restricted to interface type NL80211_IFTYPE_STATION and NL80211_IFTYPE_P2P_CLIENT. This patch extends the support for NL80211_IFTYPE_AP and NL80211_IFTYPE_P2P_GO interfaces to authorize peer STA/P2P_CLIENT, whenever authentication is offloaded on the AP/P2P_GO interface. Signed-off-by: Vinayak Yadawad --- include/net/cfg80211.h | 8 ++++++-- net/wireless/sme.c | 21 +++++++++++++-------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 6d02e12e4702..bdb560c52ade 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -7391,7 +7391,8 @@ void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info, * cfg80211_port_authorized - notify cfg80211 of successful security association * * @dev: network device - * @bssid: the BSSID of the AP + * @peer_mac: BSSID of the AP/P2P GO in case of STA/GC or STA/GC macaddress in + * case of AP/P2P GO * @gfp: allocation flags * * This function should be called by a driver that supports 4 way handshake @@ -7400,8 +7401,11 @@ void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info, * should be preceded with a call to cfg80211_connect_result(), * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to * indicate the 802.11 association. + * This function can also be called by AP/P2P GO driver that supports + * authentication offload. In this case the peer_mac passed is that of + * associated STA/GC. */ -void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid, +void cfg80211_port_authorized(struct net_device *dev, const u8 *peer_mac, gfp_t gfp); /** diff --git a/net/wireless/sme.c b/net/wireless/sme.c index ff4d48fcbfb2..063898377190 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c @@ -1027,22 +1027,27 @@ void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info, } EXPORT_SYMBOL(cfg80211_roamed); -void __cfg80211_port_authorized(struct wireless_dev *wdev, const u8 *bssid) +void __cfg80211_port_authorized(struct wireless_dev *wdev, const u8 *peer_mac) { ASSERT_WDEV_LOCK(wdev); - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) + if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION && + wdev->iftype != NL80211_IFTYPE_P2P_CLIENT && + wdev->iftype != NL80211_IFTYPE_AP && + wdev->iftype != NL80211_IFTYPE_P2P_GO)) return; - if (WARN_ON(!wdev->current_bss) || - WARN_ON(!ether_addr_equal(wdev->current_bss->pub.bssid, bssid))) + if ((wdev->iftype == NL80211_IFTYPE_STATION || + wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) && + (WARN_ON(!wdev->current_bss) || + WARN_ON((!ether_addr_equal(wdev->current_bss->pub.bssid, peer_mac))))) return; nl80211_send_port_authorized(wiphy_to_rdev(wdev->wiphy), wdev->netdev, - bssid); + peer_mac); } -void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid, +void cfg80211_port_authorized(struct net_device *dev, const u8 *peer_mac, gfp_t gfp) { struct wireless_dev *wdev = dev->ieee80211_ptr; @@ -1050,7 +1055,7 @@ void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid, struct cfg80211_event *ev; unsigned long flags; - if (WARN_ON(!bssid)) + if (WARN_ON(!peer_mac)) return; ev = kzalloc(sizeof(*ev), gfp); @@ -1058,7 +1063,7 @@ void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid, return; ev->type = EVENT_PORT_AUTHORIZED; - memcpy(ev->pa.bssid, bssid, ETH_ALEN); + memcpy(ev->pa.bssid, peer_mac, ETH_ALEN); /* * Use the wdev event list so that if there are pending