git: 12a511c84470 - main - LinuxKPI: 802.11: make (unsupported) cipher suite prints user friendly
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 19 Feb 2025 12:12:14 UTC
The branch main has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=12a511c844706917e49e24c8d1daa861288aea23
commit 12a511c844706917e49e24c8d1daa861288aea23
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-02-19 12:04:47 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-02-19 12:11:02 +0000
LinuxKPI: 802.11: make (unsupported) cipher suite prints user friendly
Rather than just printing the cipher suite as uint32_t hex
(or split into OUI and number) also print a short name.
iwlwifi(4), for example, now prints on startup with HW_CRYPTO on:
unsupported WLAN Cipher Suite 0x000fac | 8 (GCMP)
unsupported WLAN Cipher Suite 0x000fac | 9 (GCMP_256)
unsupported WLAN Cipher Suite 0x000fac | 6 (AES_CMAC)
unsupported WLAN Cipher Suite 0x000fac | 11 (BIP_GMAC_128)
unsupported WLAN Cipher Suite 0x000fac | 12 (BIP_GMAC_256)
Likewise _lkpi_iv_key_set() would now print:
iwlwifi0: _lkpi_iv_key_set: CIPHER SUITE 0xfac02 (TKIP) not supported
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
---
sys/compat/linuxkpi/common/src/linux_80211.c | 47 +++++++++++++++++++++++++---
1 file changed, 42 insertions(+), 5 deletions(-)
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 36c6f92123ff..95c7507fc34e 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -750,6 +750,38 @@ lkpi_opmode_to_vif_type(enum ieee80211_opmode opmode)
}
#ifdef LKPI_80211_HW_CRYPTO
+static const char *
+lkpi_cipher_suite_to_name(uint32_t wlan_cipher_suite)
+{
+
+ switch (wlan_cipher_suite) {
+ case WLAN_CIPHER_SUITE_WEP40:
+ return ("WEP40");
+ case WLAN_CIPHER_SUITE_TKIP:
+ return ("TKIP");
+ case WLAN_CIPHER_SUITE_CCMP:
+ return ("CCMP");
+ case WLAN_CIPHER_SUITE_WEP104:
+ return ("WEP104");
+ case WLAN_CIPHER_SUITE_AES_CMAC:
+ return ("AES_CMAC");
+ case WLAN_CIPHER_SUITE_GCMP:
+ return ("GCMP");
+ case WLAN_CIPHER_SUITE_GCMP_256:
+ return ("GCMP_256");
+ case WLAN_CIPHER_SUITE_CCMP_256:
+ return ("CCMP_256");
+ case WLAN_CIPHER_SUITE_BIP_GMAC_128:
+ return ("BIP_GMAC_128");
+ case WLAN_CIPHER_SUITE_BIP_GMAC_256:
+ return ("BIP_GMAC_256");
+ case WLAN_CIPHER_SUITE_BIP_CMAC_256:
+ return ("BIP_CMAC_256");
+ default:
+ return ("??");
+ }
+}
+
static uint32_t
lkpi_l80211_to_net80211_cyphers(uint32_t wlan_cipher_suite)
{
@@ -770,12 +802,16 @@ lkpi_l80211_to_net80211_cyphers(uint32_t wlan_cipher_suite)
case WLAN_CIPHER_SUITE_BIP_GMAC_128:
case WLAN_CIPHER_SUITE_BIP_GMAC_256:
case WLAN_CIPHER_SUITE_BIP_CMAC_256:
- printf("%s: unsupported WLAN Cipher Suite %#08x | %u\n", __func__,
- wlan_cipher_suite >> 8, wlan_cipher_suite & 0xff);
+ printf("%s: unsupported WLAN Cipher Suite %#08x | %u (%s)\n",
+ __func__,
+ wlan_cipher_suite >> 8, wlan_cipher_suite & 0xff,
+ lkpi_cipher_suite_to_name(wlan_cipher_suite));
break;
default:
- printf("%s: unknown WLAN Cipher Suite %#08x | %u\n", __func__,
- wlan_cipher_suite >> 8, wlan_cipher_suite & 0xff);
+ printf("%s: unknown WLAN Cipher Suite %#08x | %u (%s)\n",
+ __func__,
+ wlan_cipher_suite >> 8, wlan_cipher_suite & 0xff,
+ lkpi_cipher_suite_to_name(wlan_cipher_suite));
}
return (0);
@@ -1127,7 +1163,8 @@ _lkpi_iv_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k)
break;
case WLAN_CIPHER_SUITE_TKIP:
default:
- ic_printf(ic, "%s: CIPHER SUITE %#x not supported\n", __func__, lcipher);
+ ic_printf(ic, "%s: CIPHER SUITE %#x (%s) not supported\n",
+ __func__, lcipher, lkpi_cipher_suite_to_name(lcipher));
IMPROVE();
wiphy_unlock(hw->wiphy);
ieee80211_free_node(ni);