From patchwork Mon Feb 13 21:05:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Bornand X-Patchwork-Id: 653450 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 54699C6379F for ; Mon, 13 Feb 2023 21:06:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229806AbjBMVGT (ORCPT ); Mon, 13 Feb 2023 16:06:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229828AbjBMVGR (ORCPT ); Mon, 13 Feb 2023 16:06:17 -0500 Received: from mail-4323.proton.ch (mail-4323.proton.ch [185.70.43.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E27D41E9F0; Mon, 13 Feb 2023 13:06:05 -0800 (PST) Date: Mon, 13 Feb 2023 21:05:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=systemb.ch; s=protonmail; t=1676322356; x=1676581556; bh=vNl8muu2zut514XDhaSVpRfwNoz1vy088PrrWi2ZfbM=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=aQHLisANKfKW84wW5vil1FfFh7d+lduBBQIpSZXJ44V7qOa/zQXaOQqfZ138AVAMN zBem9xE+mX67WwimkwcQIMeiaBCAs2cmCq27Hxoa18XuOMX66DPt3R4qoJcPPWSIUa 3gffxU9ILyO0SUndvsjCGkB0CBNKMvsNd61aLLAZ0GZwtKj/FLCkjRcLXokRpTgYV6 DJesDsBwpPRyZsvVhIWec2DS8/A43yFRRXnapLwXhrrlvgmvQLsFKPcsoZL6hU3i4C cnknkrfYaELOA3OYdjKyJhfCukTROwN406rjcKSd0mqpqXUaInGsIqC4RA3s97NRLy B58vsCiE066NQ== To: Johannes Berg , linux-wireless@vger.kernel.org From: Marc Bornand Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kalle Valo , Marc Bornand , Yohan Prod'homme , stable@vger.kernel.org Subject: [PATCH v3] Set ssid when authenticating Message-ID: <20230213210521.1672392-1-dev.mbornand@systemb.ch> Feedback-ID: 65519157:user:proton MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org changes since v2: - The code was tottaly rewritten based on the disscution of the v2 patch. - the ssid is set in __cfg80211_connect_result() and only if the ssid is not already set. - Do not add an other ssid reset path since it is already done in __cfg80211_disconnected() When a connexion was established without going through NL80211_CMD_CONNECT, the ssid was never set in the wireless_dev struct. Now we set it in __cfg80211_connect_result() when it is not already set. Reported-by: Yohan Prod'homme Fixes: 7b0a0e3c3a88260b6fcb017e49f198463aa62ed1 Cc: linux-wireless@vger.kernel.org Cc: stable@vger.kernel.org Link: https://bugzilla.kernel.org/show_bug.cgi?id=216711 Signed-off-by: Marc Bornand --- net/wireless/sme.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- 2.39.1 diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 4b5b6ee0fe01..629d7b5f65c1 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c @@ -723,6 +723,7 @@ void __cfg80211_connect_result(struct net_device *dev, bool wextev) { struct wireless_dev *wdev = dev->ieee80211_ptr; + const struct element *ssid; const struct element *country_elem = NULL; const u8 *country_data; u8 country_datalen; @@ -883,6 +884,21 @@ void __cfg80211_connect_result(struct net_device *dev, country_data, country_datalen); kfree(country_data); + if (wdev->u.client.ssid_len == 0) { + rcu_read_lock(); + for_each_valid_link(cr, link) { + ssid = ieee80211_bss_get_elem(cr->links[link].bss, + WLAN_EID_SSID); + + if (ssid->datalen == 0) + continue; + + memcpy(wdev->u.client.ssid, ssid->data, ssid->datalen); + wdev->u.client.ssid_len = ssid->datalen; + } + rcu_read_unlock(); + } + return; out: for_each_valid_link(cr, link)