linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] wifi: cfg80211: Reject (re-)association to the same BSSID
@ 2023-06-02 22:57 Kevin Lund
  2023-06-02 22:57 ` [PATCH 2/2] wifi: mwifiex: Stop rejecting connection attempts while connected Kevin Lund
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Kevin Lund @ 2023-06-02 22:57 UTC (permalink / raw)
  To: johannes, linux-wireless; +Cc: Kevin Lund

Within cfg80211_connect, reject the (re-)association request if we are
already connected to the exact BSSID which is being requested. This
prevents an unnecessary attempt to connect which in the best case
leaves us back where we started.

There is precedent for behaving this way over on the userspace SME side
of things in cfg80211_mlme_auth. Further, cfg80211_connect already makes
several basic checks to ensure the connection attempt is reasonable, so
this fits in that context.

Signed-off-by: Kevin Lund <kglund@google.com>
---
 net/wireless/sme.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 7bdeb8eea92dc..8f88e66bc85fc 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -1442,7 +1442,8 @@ int cfg80211_connect(struct cfg80211_registered_device *rdev,
 
 	/*
 	 * If connected, reject (re-)association unless prev_bssid
-	 * matches the current BSSID.
+	 * matches the current BSSID. Also reject if the current BSSID matches
+	 * the desired BSSID.
 	 */
 	if (wdev->connected) {
 		if (!prev_bssid)
@@ -1450,6 +1451,9 @@ int cfg80211_connect(struct cfg80211_registered_device *rdev,
 		if (!ether_addr_equal(prev_bssid,
 				      wdev->u.client.connected_addr))
 			return -ENOTCONN;
+		if (ether_addr_equal(wdev->current_bss->pub.bssid,
+				     connect->bssid))
+			return -EALREADY;
 	}
 
 	/*
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-08-15  0:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-02 22:57 [PATCH 1/2] wifi: cfg80211: Reject (re-)association to the same BSSID Kevin Lund
2023-06-02 22:57 ` [PATCH 2/2] wifi: mwifiex: Stop rejecting connection attempts while connected Kevin Lund
2023-08-04  1:21   ` Brian Norris
2023-08-07 22:35     ` Kevin Lund
2023-08-15  0:21       ` Brian Norris
2023-06-03  3:32 ` [PATCH 1/2] wifi: cfg80211: Reject (re-)association to the same BSSID kernel test robot
2023-06-03  5:55 ` kernel test robot
2023-06-05 16:42 ` Johannes Berg
2023-08-04 17:29   ` Kevin Lund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).