git: e53573cb3987 - stable/13 - net80211: improve error handling from ieee80211_parse_beacon()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Wed, 29 Nov 2023 16:37:47 UTC
The branch stable/13 has been updated by bz:

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

commit e53573cb3987f7841c81f7222559369efee59cae
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-04-07 20:50:39 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-11-29 16:36:03 +0000

    net80211: improve error handling from ieee80211_parse_beacon()
    
    Following up on fb8c87b4f3bfdfac014f9d894fe75fbad0391b24, which was
    supposed to go into all supported branches, increase ieee80211_scanparams
    status field from 8bit to 32bit (enum size) and add a dedicated error
    code for Mesh ID.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 7354782698f1cf5d6b368a9b1e65cfe3ee7f235c)
---
 sys/net80211/ieee80211_input.c | 2 +-
 sys/net80211/ieee80211_scan.h  | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c
index 4b17ab1188ef..492a3038c971 100644
--- a/sys/net80211/ieee80211_input.c
+++ b/sys/net80211/ieee80211_input.c
@@ -743,7 +743,7 @@ ieee80211_parse_beacon(struct ieee80211_node *ni, struct mbuf *m,
 #ifdef IEEE80211_SUPPORT_MESH
 	if (scan->meshid != NULL) {
 		IEEE80211_VERIFY_ELEMENT(scan->meshid, IEEE80211_MESHID_LEN,
-		    scan->status |= IEEE80211_BPARSE_RATES_INVALID);
+		    scan->status |= IEEE80211_BPARSE_MESHID_INVALID);
 	}
 #endif
 	/*
diff --git a/sys/net80211/ieee80211_scan.h b/sys/net80211/ieee80211_scan.h
index c140ac615979..4274f3948db6 100644
--- a/sys/net80211/ieee80211_scan.h
+++ b/sys/net80211/ieee80211_scan.h
@@ -210,6 +210,7 @@ enum {
 	IEEE80211_BPARSE_OFFCHAN	= 0x20,	/* DSPARMS chan != curchan */
 	IEEE80211_BPARSE_BINTVAL_INVALID= 0x40,	/* invalid beacon interval */
 	IEEE80211_BPARSE_CSA_INVALID	= 0x80,	/* invalid CSA ie */
+	IEEE80211_BPARSE_MESHID_INVALID = 0x100, /* invalid Mesh ID ie */
 };
 
 /*
@@ -220,7 +221,7 @@ enum {
  * All multi-byte values must be in host byte order.
  */
 struct ieee80211_scanparams {
-	uint8_t		status;		/* bitmask of IEEE80211_BPARSE_* */
+	uint32_t	status;		/* bitmask of IEEE80211_BPARSE_* */
 	uint8_t		chan;		/* channel # from FH/DSPARMS */
 	uint8_t		bchan;		/* curchan's channel # */
 	uint8_t		fhindex;