Skip to content

Commit 3b8e6b6

Browse files
committed
[nrf fromlist] net: wifi: Expand security enumeration for scan display
Expand the security modes identified in the display-scan results. Add appropriate strings for corresponding enumerations. Upstream PR #: 81514 Signed-off-by: Ravi Dondaputi <[email protected]>
1 parent cd54e15 commit 3b8e6b6

File tree

5 files changed

+149
-10
lines changed

5 files changed

+149
-10
lines changed

drivers/wifi/nrf_wifi/src/wifi_mgmt_scan.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,34 @@ static inline enum wifi_mfp_options drv_to_wifi_mgmt_mfp(unsigned char mfp_flag)
278278

279279
return WIFI_MFP_UNKNOWN;
280280
}
281+
282+
static inline enum wifi_cipher_suite_b drv_to_wifi_mgmt_suiteb(int drv_security_type)
283+
{
284+
switch (drv_security_type) {
285+
case NRF_WIFI_OPEN:
286+
case NRF_WIFI_WEP:
287+
case NRF_WIFI_WPA:
288+
case NRF_WIFI_WPA2:
289+
case NRF_WIFI_WPA2_256:
290+
case NRF_WIFI_WPA3:
291+
case NRF_WIFI_WAPI:
292+
case NRF_WIFI_FT_EAP_SHA384:
293+
case NRF_WIFI_FT_PSK_SHA384:
294+
case NRF_WIFI_PSK_SHA384:
295+
return WIFI_CIPHER_SUITE_B_NA;
296+
case NRF_WIFI_EAP:
297+
case NRF_WIFI_EAP_TLS_SHA256:
298+
case NRF_WIFI_FT_EAP:
299+
return WIFI_CIPHER_SUITE_B_NONE;
300+
case NRF_WIFI_EAP_SUITEB_SHA256:
301+
return WIFI_CIPHER_SUITE_B;
302+
case NRF_WIFI_EAP_SUITEB_SHA384:
303+
return WIFI_CIPHER_SUITE_B_192;
304+
default:
305+
return WIFI_CIPHER_SUITE_B_NA;
306+
}
307+
}
308+
281309
static inline enum wifi_security_type drv_to_wifi_mgmt(int drv_security_type)
282310
{
283311
switch (drv_security_type) {
@@ -299,6 +327,18 @@ static inline enum wifi_security_type drv_to_wifi_mgmt(int drv_security_type)
299327
return WIFI_SECURITY_TYPE_EAP;
300328
case NRF_WIFI_EAP_TLS_SHA256:
301329
return WIFI_SECURITY_TYPE_EAP_TLS_SHA256;
330+
case NRF_WIFI_FT_EAP:
331+
return WIFI_SECURITY_TYPE_FT_EAP;
332+
case NRF_WIFI_EAP_SUITEB_SHA256:
333+
return WIFI_SECURITY_TYPE_EAP;
334+
case NRF_WIFI_EAP_SUITEB_SHA384:
335+
return WIFI_SECURITY_TYPE_EAP;
336+
case NRF_WIFI_FT_EAP_SHA384:
337+
return WIFI_SECURITY_TYPE_FT_EAP_SHA384;
338+
case NRF_WIFI_FT_PSK_SHA384:
339+
return WIFI_SECURITY_TYPE_FT_PSK;
340+
case NRF_WIFI_PSK_SHA384:
341+
return WIFI_SECURITY_TYPE_PSK_SHA384;
302342
default:
303343
return WIFI_SECURITY_TYPE_UNKNOWN;
304344
}
@@ -347,6 +387,8 @@ void nrf_wifi_event_proc_disp_scan_res_zep(void *vif_ctx,
347387

348388
res.security = drv_to_wifi_mgmt(r->security_type);
349389

390+
res.suite_b_type = drv_to_wifi_mgmt_suiteb(r->security_type);
391+
350392
res.mfp = drv_to_wifi_mgmt_mfp(r->mfp_flag);
351393

352394
memcpy(res.ssid,

include/zephyr/net/wifi.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@
3838
extern "C" {
3939
#endif
4040

41+
/** @brief IEEE 802.11 SUITE-B */
42+
enum wifi_cipher_suite_b {
43+
/** Not Applicable for Personal mode security */
44+
WIFI_CIPHER_SUITE_B_NA,
45+
/** Not enable for Enterprise mode security */
46+
WIFI_CIPHER_SUITE_B_NONE,
47+
/** SUITE-B */
48+
WIFI_CIPHER_SUITE_B,
49+
/** SUITE-B-192 */
50+
WIFI_CIPHER_SUITE_B_192,
51+
};
52+
4153
/** @brief IEEE 802.11 security types. */
4254
enum wifi_security_type {
4355
/** No security. */
@@ -78,6 +90,16 @@ enum wifi_security_type {
7890
WIFI_SECURITY_TYPE_EAP_PEAP_TLS,
7991
/** EAP TLS SHA256 security - Enterprise. */
8092
WIFI_SECURITY_TYPE_EAP_TLS_SHA256,
93+
/** FT-PSK security */
94+
WIFI_SECURITY_TYPE_FT_PSK,
95+
/** FT-SAE security */
96+
WIFI_SECURITY_TYPE_FT_SAE,
97+
/** FT-EAP security */
98+
WIFI_SECURITY_TYPE_FT_EAP,
99+
/** FT-EAP-SHA384 security */
100+
WIFI_SECURITY_TYPE_FT_EAP_SHA384,
101+
/** WPA2-PSK-SHA384 security. */
102+
WIFI_SECURITY_TYPE_PSK_SHA384,
81103

82104
/** @cond INTERNAL_HIDDEN */
83105
__WIFI_SECURITY_TYPE_AFTER_LAST,
@@ -171,6 +193,9 @@ struct wifi_eap_config {
171193
char *phase2;
172194
};
173195

196+
/** Helper function to get user-friendly Suite_B type name. */
197+
const char *wifi_suiteb_txt(enum wifi_cipher_suite_b suite_b);
198+
174199
/** Helper function to get user-friendly security type name. */
175200
const char *wifi_security_txt(enum wifi_security_type security);
176201

include/zephyr/net/wifi_mgmt.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,8 @@ struct wifi_scan_result {
428428
uint8_t channel;
429429
/** Security type */
430430
enum wifi_security_type security;
431+
/** Cipher SuiteB */
432+
enum wifi_cipher_suite_b suite_b_type;
431433
/** MFP options */
432434
enum wifi_mfp_options mfp;
433435
/** RSSI */

subsys/net/l2/wifi/wifi_mgmt.c

Lines changed: 75 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,72 @@ LOG_MODULE_REGISTER(net_wifi_mgmt, CONFIG_NET_L2_WIFI_MGMT_LOG_LEVEL);
1818
#include <zephyr/net/wifi_nm.h>
1919
#endif /* CONFIG_WIFI_NM */
2020

21+
#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING
22+
#define MAX_NEIGHBOR_AP_LIMIT 6U
23+
#define MAX_EVENT_STR_LEN 32
24+
25+
struct wifi_rrm_neighbor_ap_t {
26+
char ssid[WIFI_SSID_MAX_LEN + 1];
27+
uint8_t bssid[WIFI_SSID_MAX_LEN];
28+
uint8_t bssid_info[WIFI_SSID_MAX_LEN];
29+
int op_class;
30+
int channel;
31+
int phy_type;
32+
};
33+
34+
struct wifi_rrm_neighbor_report_t {
35+
struct wifi_rrm_neighbor_ap_t neighbor_ap[MAX_NEIGHBOR_AP_LIMIT];
36+
int neighbor_cnt;
37+
};
38+
39+
struct wifi_roaming_params {
40+
bool is_11r_used;
41+
bool is_11k_enabled;
42+
struct wifi_rrm_neighbor_report_t neighbor_rep;
43+
};
44+
45+
static struct wifi_roaming_params roaming_params;
46+
#endif
47+
48+
const bool is_enterprise_security(enum wifi_security_type security)
49+
{
50+
switch (security) {
51+
case WIFI_SECURITY_TYPE_EAP_TLS:
52+
case WIFI_SECURITY_TYPE_EAP_TLS_SHA256:
53+
case WIFI_SECURITY_TYPE_EAP_PEAP_MSCHAPV2:
54+
case WIFI_SECURITY_TYPE_EAP_PEAP_GTC:
55+
case WIFI_SECURITY_TYPE_EAP_TTLS_MSCHAPV2:
56+
case WIFI_SECURITY_TYPE_EAP_PEAP_TLS:
57+
return true;
58+
default:
59+
return false;
60+
}
61+
}
62+
63+
const char *wifi_suiteb_txt(enum wifi_cipher_suite_b suiteb)
64+
{
65+
switch (suiteb) {
66+
case WIFI_CIPHER_SUITE_B_NA:
67+
return "Not Applicable";
68+
case WIFI_CIPHER_SUITE_B_NONE:
69+
return "Not Enabled";
70+
case WIFI_CIPHER_SUITE_B:
71+
return "SUITE-B";
72+
case WIFI_CIPHER_SUITE_B_192:
73+
return "SUITE-B-192";
74+
default:
75+
return "UNKNOWN";
76+
}
77+
}
2178
const char *wifi_security_txt(enum wifi_security_type security)
2279
{
80+
if (is_enterprise_security(security)) {
81+
return "IEEE_8021_x";
82+
}
83+
2384
switch (security) {
2485
case WIFI_SECURITY_TYPE_NONE:
2586
return "OPEN";
26-
case WIFI_SECURITY_TYPE_WEP:
27-
return "WEP";
28-
case WIFI_SECURITY_TYPE_WPA_PSK:
29-
return "WPA-PSK";
3087
case WIFI_SECURITY_TYPE_PSK:
3188
return "WPA2-PSK";
3289
case WIFI_SECURITY_TYPE_PSK_SHA256:
@@ -39,10 +96,22 @@ const char *wifi_security_txt(enum wifi_security_type security)
3996
return "WPA3-SAE-AUTO";
4097
case WIFI_SECURITY_TYPE_WAPI:
4198
return "WAPI";
42-
case WIFI_SECURITY_TYPE_EAP_TLS:
43-
return "EAP";
99+
case WIFI_SECURITY_TYPE_WEP:
100+
return "WEP";
101+
case WIFI_SECURITY_TYPE_WPA_PSK:
102+
return "WPA-PSK";
44103
case WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL:
45104
return "WPA/WPA2/WPA3 PSK";
105+
case WIFI_SECURITY_TYPE_DPP:
106+
return "DPP";
107+
case WIFI_SECURITY_TYPE_FT_PSK:
108+
return "FT-PSK";
109+
case WIFI_SECURITY_TYPE_FT_SAE:
110+
return "FT-SAE";
111+
case WIFI_SECURITY_TYPE_FT_EAP:
112+
return "FT-EAP";
113+
case WIFI_SECURITY_TYPE_FT_EAP_SHA384:
114+
return "FT-EAP-SHA384";
46115
case WIFI_SECURITY_TYPE_UNKNOWN:
47116
default:
48117
return "UNKNOWN";

subsys/net/l2/wifi/wifi_shell.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,19 @@ static void handle_wifi_scan_result(struct net_mgmt_event_callback *cb)
175175
context.scan_result++;
176176

177177
if (context.scan_result == 1U) {
178-
PR("\n%-4s | %-32s %-5s | %-13s | %-4s | %-15s | %-17s | %-8s\n",
179-
"Num", "SSID", "(len)", "Chan (Band)", "RSSI", "Security", "BSSID", "MFP");
178+
PR("\n%-4s | %-32s %-5s | %-13s | %-4s | %-30s | %-17s | %-8s\n",
179+
"Num", "SSID", "(len)", "Chan (Band)", "RSSI", "Security (Suite-B)",
180+
"BSSID", "MFP");
180181
}
181182

182183
strncpy(ssid_print, entry->ssid, sizeof(ssid_print) - 1);
183184
ssid_print[sizeof(ssid_print) - 1] = '\0';
184185

185-
PR("%-4d | %-32s %-5u | %-4u (%-6s) | %-4d | %-15s | %-17s | %-8s\n",
186+
PR("%-4d | %-32s %-5u | %-4u (%-6s) | %-4d | %-18s (%-12s) | %-17s | %-8s\n",
186187
context.scan_result, ssid_print, entry->ssid_length, entry->channel,
187188
wifi_band_txt(entry->band),
188189
entry->rssi,
189-
wifi_security_txt(entry->security),
190+
wifi_security_txt(entry->security), wifi_suiteb_txt(entry->suite_b_type),
190191
((entry->mac_length) ?
191192
net_sprint_ll_addr_buf(entry->mac, WIFI_MAC_ADDR_LEN,
192193
mac_string_buf,

0 commit comments

Comments
 (0)