Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 05 Mar 2026 13:44:31 +0000
From:      Bjoern A. Zeeb <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 9b03cc2a70e4 - main - net80211: sta: use IEEE80211_STATUS_SUCCESS instead of magic 0
Message-ID:  <69a988bf.21582.38fcbb17@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=9b03cc2a70e4b6354c5f5b90e4c51b850b6b1dd2

commit 9b03cc2a70e4b6354c5f5b90e4c51b850b6b1dd2
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-03-02 10:33:53 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-03-05 13:44:00 +0000

    net80211: sta: use IEEE80211_STATUS_SUCCESS instead of magic 0
    
    Rather than using the status != 0 check use the way more descriptive
    status != IEEE80211_STATUS_SUCCESS definition.  This makes it a lot
    more clear what is checked here.  While here add a comment in case
    aof the (Re)Assoc Resp failure as we do not update state in that case
    but rely on a timeout which will bounce us back to State 1
    (cf. 802.11-2024, Figure 11-23) which means SCAN in our case, rather
    than possibly moving us back to AUTH.  We will likely have to revisit
    this when SAE hits the tree.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
    Reviewed by:    adrian
    Differential Revision: https://reviews.freebsd.org/D55643
---
 sys/net80211/ieee80211_sta.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c
index 19e5ffe9a367..3522b1b24742 100644
--- a/sys/net80211/ieee80211_sta.c
+++ b/sys/net80211/ieee80211_sta.c
@@ -1011,7 +1011,7 @@ sta_auth_open(struct ieee80211_node *ni, struct ieee80211_frame *wh,
 		vap->iv_stats.is_rx_bad_auth++;
 		return;
 	}
-	if (status != 0) {
+	if (status != IEEE80211_STATUS_SUCCESS) {
 		IEEE80211_NOTE(vap, IEEE80211_MSG_DEBUG | IEEE80211_MSG_AUTH,
 		    ni, "open auth failed (reason %d)", status);
 		vap->iv_stats.is_rx_auth_fail++;
@@ -1100,7 +1100,7 @@ sta_auth_shared(struct ieee80211_node *ni, struct ieee80211_frame *wh,
 			IEEE80211_FREE(ni->ni_challenge, M_80211_NODE);
 			ni->ni_challenge = NULL;
 		}
-		if (status != 0) {
+		if (status != IEEE80211_STATUS_SUCCESS) {
 			IEEE80211_NOTE_FRAME(vap,
 			    IEEE80211_MSG_DEBUG | IEEE80211_MSG_AUTH, wh,
 			    "shared key auth failed (reason %d)", status);
@@ -1766,7 +1766,12 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype,
 		frm += 2;
 		status = le16toh(*(uint16_t *)frm);
 		frm += 2;
-		if (status != 0) {
+		if (status != IEEE80211_STATUS_SUCCESS) {
+			/*
+			 * See ieee80211_tx_mgt_cb() for state handling.  This
+			 * essentially provokes a timeout bouncing us back to
+			 * State 1 instead of dealing with it properly.
+			 */
 			IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_ASSOC,
 			    wh->i_addr2, "%sassoc failed (reason %d)",
 			    ISREASSOC(subtype) ?  "re" : "", status);


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69a988bf.21582.38fcbb17>