From patchwork Tue Sep 12 06:54:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinayak Yadawad X-Patchwork-Id: 723096 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 18FF3CA0ECA for ; Tue, 12 Sep 2023 06:55:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230366AbjILGzE (ORCPT ); Tue, 12 Sep 2023 02:55:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230356AbjILGzD (ORCPT ); Tue, 12 Sep 2023 02:55:03 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0222AF for ; Mon, 11 Sep 2023 23:54:59 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1c0d5b16aacso43058285ad.1 for ; Mon, 11 Sep 2023 23:54:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1694501699; x=1695106499; darn=vger.kernel.org; h=mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=b7AkImIHixbtmcaetHj8tokk3Hud/22bJx+86LBAUB4=; b=aAsEPfPUewhmYPluLozoy5psP8j5yU7UecfXtJE4ipg2G2l8uPo1x/1ElO47OKgY4B u4h2ntdCMjwAAwgnyx6vt9S2R4lHQSioxhiZ0/Q3n2/88i8ie10ALDC4gacgj06LgTPr MR7UD5k4Fj1moQL6V0aeRVWQk92kje2+fubTw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694501699; x=1695106499; h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=b7AkImIHixbtmcaetHj8tokk3Hud/22bJx+86LBAUB4=; b=GP80rCLWHSbxGxwIjBPbkAwXm9kZKzFp/VBqmP47P4X2vHbk0fO8ClXNWtgu8XvHjw TlM5iUyP7ZTJCb3/Tv7ClZlM2xq0V3csyAnkfX6etbdeq7ifOGS4+fkqypQh0el1C0pj mLHwbdJn1IiTEewHSfxlEw9cGEX8hA6ohqFuMBa+grwYHFWSO3AP5PFjSIJNydfXc0hl db8Lb4cDGSe8CGSio09b9Q1GXjWCPNYtmmht3c9oC6M9zSl+hK4zxSJ0XxfkbrgBVl4u Pq087YrZ01BSl0Di6I8mJJ6aOzvubveUGlmu17nWpIUZbG/rw6vzbUsCd0ZluUWgtczf /TuQ== X-Gm-Message-State: AOJu0Ywu6q/aacUlWWgnXPOAOyzzbTwQ4jV43+MXClJRJCinf7ClxiqM PZaN3EXh6/0ChnD5IhZFifnNK22qzhZd8hO3aEk= X-Google-Smtp-Source: AGHT+IGv8faQv8Sae8Lv7hRIgSaNWAMNay48VgzvXRm2nqwF1/BoqlGU9dNtQbYqxO1En1quZ3XMzA== X-Received: by 2002:a17:903:124f:b0:1bc:6861:d746 with SMTP id u15-20020a170903124f00b001bc6861d746mr12479781plh.58.1694501699252; Mon, 11 Sep 2023 23:54:59 -0700 (PDT) Received: from ibnvda0196.ibn.broadcom.net ([192.19.252.250]) by smtp.gmail.com with ESMTPSA id t14-20020a170902e84e00b001b9e9edbf43sm7664223plg.171.2023.09.11.23.54.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Sep 2023 23:54:58 -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: Tue, 12 Sep 2023 12:24:51 +0530 Message-Id: <85614ee38fd3f68ade1810c2be0863c45c22fef1.1694499025.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 | 18 +++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 3a4b684f89bf..0ce46d0fd5ac 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -7967,7 +7967,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 * @td_bitmap: transition disable policy * @td_bitmap_len: Length of transition disable policy * @gfp: allocation flags @@ -7978,8 +7979,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, const u8* td_bitmap, u8 td_bitmap_len, gfp_t gfp); /** diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 9bba233b5a6e..f4384e0cce7d 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c @@ -1294,24 +1294,28 @@ 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, const u8 *td_bitmap, u8 td_bitmap_len) { ASSERT_WDEV_LOCK(wdev); if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION && - wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)) + wdev->iftype != NL80211_IFTYPE_P2P_CLIENT && + wdev->iftype != NL80211_IFTYPE_AP && + wdev->iftype != NL80211_IFTYPE_P2P_GO)) return; if (WARN_ON(!wdev->connected) || - WARN_ON(!ether_addr_equal(wdev->u.client.connected_addr, bssid))) + WARN_ON((!ether_addr_equal(wdev->u.client.connected_addr, peer_mac) && + (wdev->iftype == NL80211_IFTYPE_STATION || + wdev->iftype == NL80211_IFTYPE_P2P_CLIENT)))) return; nl80211_send_port_authorized(wiphy_to_rdev(wdev->wiphy), wdev->netdev, - bssid, td_bitmap, td_bitmap_len); + peer_mac, td_bitmap, td_bitmap_len); } -void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid, +void cfg80211_port_authorized(struct net_device *dev, const u8 *peer_mac, const u8 *td_bitmap, u8 td_bitmap_len, gfp_t gfp) { struct wireless_dev *wdev = dev->ieee80211_ptr; @@ -1319,7 +1323,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) + td_bitmap_len, gfp); @@ -1327,7 +1331,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); ev->pa.td_bitmap = ((u8 *)ev) + sizeof(*ev); ev->pa.td_bitmap_len = td_bitmap_len; memcpy((void *)ev->pa.td_bitmap, td_bitmap, td_bitmap_len);