git: 8f564898b937 - stable/14 - net80211: cleanup keyidx argument of ieee80211_notify_michael_failure()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Fri, 18 Apr 2025 14:37:01 UTC
The branch stable/14 has been updated by bz:

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

commit 8f564898b937555273d6a8da107168ce16c7db99
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-03-14 23:33:26 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-04-18 14:35:58 +0000

    net80211: cleanup keyidx argument of ieee80211_notify_michael_failure()
    
    Instead of passing -1 to the function in ieee80211_crypto_demic(),
    use the defined IEEE80211_KEYIX_NONE.
    net80211 uses ieee80211_keyix not u_int as type for the key index
    internally.  Use that.  This also helps when printing the -1 unsigned
    as it stays within the expected numerical scope and makes the debug
    message more readable.
    
    Sponsored by:   The FreeBSD Foundation
    Reviewed by:    adrian
    Differential Revision: https://reviews.freebsd.org/D49368
    
    (cherry picked from commit db8ceb8e59487d1d6b2e019efab3eef40688731c)
---
 sys/net80211/ieee80211_crypto.c  | 3 ++-
 sys/net80211/ieee80211_crypto.h  | 2 +-
 sys/net80211/ieee80211_freebsd.c | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/sys/net80211/ieee80211_crypto.c b/sys/net80211/ieee80211_crypto.c
index c5e0816bd43c..45316b43605a 100644
--- a/sys/net80211/ieee80211_crypto.c
+++ b/sys/net80211/ieee80211_crypto.c
@@ -725,7 +725,8 @@ ieee80211_crypto_demic(struct ieee80211vap *vap, struct ieee80211_key *k,
 			 * modules to handle a NULL key and not to dereference
 			 * it.
 			 */
-			ieee80211_notify_michael_failure(vap, wh, -1);
+			ieee80211_notify_michael_failure(vap, wh,
+			    IEEE80211_KEYIX_NONE);
 			return (0);
 		}
 
diff --git a/sys/net80211/ieee80211_crypto.h b/sys/net80211/ieee80211_crypto.h
index 156d5d77fd55..49e3f93410b2 100644
--- a/sys/net80211/ieee80211_crypto.h
+++ b/sys/net80211/ieee80211_crypto.h
@@ -249,6 +249,6 @@ void	ieee80211_notify_replay_failure(struct ieee80211vap *,
 		const struct ieee80211_frame *, const struct ieee80211_key *,
 		uint64_t rsc, int tid);
 void	ieee80211_notify_michael_failure(struct ieee80211vap *,
-		const struct ieee80211_frame *, u_int keyix);
+		const struct ieee80211_frame *, ieee80211_keyix keyix);
 #endif /* defined(__KERNEL__) || defined(_KERNEL) */
 #endif /* _NET80211_IEEE80211_CRYPTO_H_ */
diff --git a/sys/net80211/ieee80211_freebsd.c b/sys/net80211/ieee80211_freebsd.c
index db118bc19d16..d3c8352ab411 100644
--- a/sys/net80211/ieee80211_freebsd.c
+++ b/sys/net80211/ieee80211_freebsd.c
@@ -870,7 +870,7 @@ ieee80211_notify_replay_failure(struct ieee80211vap *vap,
 
 void
 ieee80211_notify_michael_failure(struct ieee80211vap *vap,
-	const struct ieee80211_frame *wh, u_int keyix)
+	const struct ieee80211_frame *wh, ieee80211_keyix keyix)
 {
 	struct ifnet *ifp = vap->iv_ifp;