git: c6f7abeaeb5b - stable/13 - net80211: define mask for ss_flags rather than using hardcoded 0xfff

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 26 Jun 2023 12:08:19 UTC
The branch stable/13 has been updated by bz:

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

commit c6f7abeaeb5ba9754799c4ff2129a4c49056448d
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-03-14 21:00:48 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-06-26 08:29:22 +0000

    net80211: define mask for ss_flags rather than using hardcoded 0xfff
    
    scan state ss_flags in two places cut off the "internal" GOTPICK
    options.  Replace the hardcoded 0xfff with a defined mask.
    Note that "internal" flags is confusing as we also supplement the
    the 16bit by another 16bit of "internal flags" passed around but
    comaparing to GOTPICK never stored to my understanding.
    
    No functional change.
    
    Sponsored by:   The FreeBSD Foundation
    Reviewed by:    adrian
    Differential Revision: https://reviews.freebsd.org/D38832
    
    (cherry picked from commit 3346164ce844f8995311c3988ab193bd6ddda0c9)
---
 sys/net80211/ieee80211_scan.h    | 1 +
 sys/net80211/ieee80211_scan_sw.c | 5 ++---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/net80211/ieee80211_scan.h b/sys/net80211/ieee80211_scan.h
index 609339ae77e8..32330322ce33 100644
--- a/sys/net80211/ieee80211_scan.h
+++ b/sys/net80211/ieee80211_scan.h
@@ -136,6 +136,7 @@ struct ieee80211_scan_state {
 #define	IEEE80211_SCAN_ONCE	0x0010		/* do one complete pass */
 #define	IEEE80211_SCAN_NOBCAST	0x0020		/* no broadcast probe req */
 #define	IEEE80211_SCAN_NOJOIN	0x0040		/* no auto-sequencing */
+#define	IEEE80211_SCAN_PUBLIC_MASK	0x0fff	/* top 4 bits for internal use */
 #define	IEEE80211_SCAN_GOTPICK	0x1000		/* got candidate, can stop */
 	uint8_t		ss_nssid;		/* # ssid's to probe/match */
 	struct ieee80211_scan_ssid ss_ssid[IEEE80211_SCAN_MAX_SSID];
diff --git a/sys/net80211/ieee80211_scan_sw.c b/sys/net80211/ieee80211_scan_sw.c
index 4c184095ad35..f72f4658ad67 100644
--- a/sys/net80211/ieee80211_scan_sw.c
+++ b/sys/net80211/ieee80211_scan_sw.c
@@ -195,8 +195,7 @@ ieee80211_swscan_start_scan_locked(const struct ieee80211_scanner *scan,
 			if ((flags & IEEE80211_SCAN_NOSSID) == 0)
 				ieee80211_scan_copy_ssid(vap, ss, nssid, ssids);
 
-			/* NB: top 4 bits for internal use */
-			ss->ss_flags = flags & 0xfff;
+			ss->ss_flags = flags & IEEE80211_SCAN_PUBLIC_MASK;
 			if (ss->ss_flags & IEEE80211_SCAN_ACTIVE)
 				vap->iv_stats.is_scan_active++;
 			else
@@ -306,7 +305,7 @@ ieee80211_swscan_check_scan(const struct ieee80211_scanner *scan,
 			ic->ic_flags |= IEEE80211_F_SCAN;
 
 			/* NB: need to use supplied flags in check */
-			ss->ss_flags = flags & 0xff;
+			ss->ss_flags = flags & IEEE80211_SCAN_PUBLIC_MASK;
 			result = ss->ss_ops->scan_end(ss, vap);
 
 			ic->ic_flags &= ~IEEE80211_F_SCAN;