git: 3346164ce844 - main - net80211: define mask for ss_flags rather than using hardcoded 0xfff

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Tue, 14 Mar 2023 22:19:54 UTC
The branch main has been updated by bz:

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

commit 3346164ce844f8995311c3988ab193bd6ddda0c9
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-03-14 21:00:48 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-03-14 22:16:41 +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
    MFC after:      3 days
    Reviewed by:    adrian
    Differential Revision: https://reviews.freebsd.org/D38832
---
 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 e1f7b786be19..8db7bd03e2d7 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 51e1189824e3..6442ed42112c 100644
--- a/sys/net80211/ieee80211_scan_sw.c
+++ b/sys/net80211/ieee80211_scan_sw.c
@@ -196,8 +196,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
@@ -307,7 +306,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;