3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 17:59:25 +01:00

diagnostic: add diagnostic_akm_suite_to_security

Converts ie_rsn_akm_suite values (and WPA1 hint) into a more
human readable security string such as:

WPA2-Personal, WPA3-Personal, WPA2-Personal + FT etc.
This commit is contained in:
James Prestwood 2021-03-29 10:33:08 -07:00 committed by Denis Kenzior
parent c66ade2eac
commit 2c2c1e3ebf
2 changed files with 44 additions and 0 deletions

View File

@ -28,6 +28,7 @@
#include "src/diagnostic.h" #include "src/diagnostic.h"
#include "src/dbus.h" #include "src/dbus.h"
#include "src/ie.h"
/* /*
* Appends values from diagnostic_station_info into a DBus dictionary. This * Appends values from diagnostic_station_info into a DBus dictionary. This
@ -111,3 +112,41 @@ bool diagnostic_info_to_dict(const struct diagnostic_station_info *info,
return true; return true;
} }
const char *diagnostic_akm_suite_to_security(enum ie_rsn_akm_suite akm,
bool wpa)
{
switch (akm) {
case IE_RSN_AKM_SUITE_8021X:
case IE_RSN_AKM_SUITE_8021X_SHA256:
return "WPA2-Enterprise";
case IE_RSN_AKM_SUITE_PSK:
if (wpa)
return "WPA1-Personal";
/* Fall through */
case IE_RSN_AKM_SUITE_PSK_SHA256:
return "WPA2-Personal";
case IE_RSN_AKM_SUITE_FT_OVER_8021X:
case IE_RSN_AKM_SUITE_FT_OVER_8021X_SHA384:
return "WPA2-Enterprise + FT";
case IE_RSN_AKM_SUITE_FT_USING_PSK:
return "WPA2-Personal + FT";
case IE_RSN_AKM_SUITE_SAE_SHA256:
return "WPA3-Personal";
case IE_RSN_AKM_SUITE_FT_OVER_SAE_SHA256:
return "WPA3-Personal + FT";
case IE_RSN_AKM_SUITE_OWE:
return "OWE";
case IE_RSN_AKM_SUITE_FILS_SHA256:
case IE_RSN_AKM_SUITE_FILS_SHA384:
return "FILS";
case IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA256:
case IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA384:
return "FILS + FT";
case IE_RSN_AKM_SUITE_OSEN:
return "OSEN";
default:
return NULL;
}
}

View File

@ -20,6 +20,8 @@
* *
*/ */
enum ie_rsn_akm_suite;
enum diagnostic_mcs_type { enum diagnostic_mcs_type {
DIAGNOSTIC_MCS_TYPE_NONE, DIAGNOSTIC_MCS_TYPE_NONE,
DIAGNOSTIC_MCS_TYPE_HT, DIAGNOSTIC_MCS_TYPE_HT,
@ -52,3 +54,6 @@ struct diagnostic_station_info {
bool diagnostic_info_to_dict(const struct diagnostic_station_info *info, bool diagnostic_info_to_dict(const struct diagnostic_station_info *info,
struct l_dbus_message_builder *builder); struct l_dbus_message_builder *builder);
const char *diagnostic_akm_suite_to_security(enum ie_rsn_akm_suite suite,
bool wpa);