From patchwork Fri Feb 10 21:22:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Bornand X-Patchwork-Id: 13136468 X-Patchwork-Delegate: johannes@sipsolutions.net 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 CBA48C636D7 for ; Fri, 10 Feb 2023 21:22:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233421AbjBJVWU (ORCPT ); Fri, 10 Feb 2023 16:22:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232871AbjBJVWU (ORCPT ); Fri, 10 Feb 2023 16:22:20 -0500 Received: from mail-4317.proton.ch (mail-4317.proton.ch [185.70.43.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D771073585 for ; Fri, 10 Feb 2023 13:22:17 -0800 (PST) Date: Fri, 10 Feb 2023 21:22:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=systemb.ch; s=protonmail; t=1676064135; x=1676323335; bh=/yDUn5YxSnSJ0YVlmOrlV6K8CJsZnDgQARF+6ZbpYMU=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=Kp05vDPa9KEOV6NL0nuTVLXSIvT6vOohhiNqj5ZUQxqWtXzru1aKY+tJQOXg6GQ09 +LVENsTBG1go3DzUnlGTzeopYEe5+qiSKCU4Y2ZHLrrme2oi1MmF2OtCVLyBfNxolf 5sEp/lziWppKRH4CkO8H3+246WVlRs/Ywa646MxwWdC52hLSnVZdzXz/kcCwfzQ2EX 3KkB4yjIXzofDTJ/GUEPua8yr0b6DpZ/sdyV5VTtZCotmNqvSZs9rJGNKOh8tYHvzv YjK+azwPjyKj/aU6HJNK8BFJ935Tdtx2Od4bXzjpxJGh9L485FjHUzf2SongYwaHGU x60cqvnQVjKSg== To: Johannes Berg From: Marc Bornand Cc: Marc Bornand , Yohan Prod'homme , linux-wireless@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] Set ssid when authenticating Message-ID: <20230210212057.83161-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 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 during when an NL80211_CMD_AUTHENTICATE is issued. It may be needed to test this on some additional hardware (tested with iwlwifi and a AX201, and iwd on the userspace side), I could not test things like roaming and p2p. This applies to v6.2-rc7, but I think it may also be interesting to backport it from 5.19 to 6.1 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/nl80211.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.39.1 diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 33a82ecab9d5..f1627ea542b9 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -10552,6 +10552,10 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info) return -ENOENT; wdev_lock(dev->ieee80211_ptr); + + memcpy(dev->ieee80211_ptr->u.client.ssid, ssid, ssid_len); + dev->ieee80211_ptr->u.client.ssid_len = ssid_len; + err = cfg80211_mlme_auth(rdev, dev, &req); wdev_unlock(dev->ieee80211_ptr); @@ -11025,6 +11029,11 @@ static int nl80211_deauthenticate(struct sk_buff *skb, struct genl_info *info) local_state_change = !!info->attrs[NL80211_ATTR_LOCAL_STATE_CHANGE]; wdev_lock(dev->ieee80211_ptr); + + if (reason_code == WLAN_REASON_DEAUTH_LEAVING) { + dev->ieee80211_ptr->u.client.ssid_len = 0; + } + err = cfg80211_mlme_deauth(rdev, dev, bssid, ie, ie_len, reason_code, local_state_change); wdev_unlock(dev->ieee80211_ptr);