Skip to content

Commit fb81ddb

Browse files
D-Trivenirlubos
authored andcommitted
[nrf fromtree] net: lib: wifi_credentials: Use getopt API for adding network options
Use getopt API to process arguments for `cred add` command. Signed-off-by: Triveni Danda <[email protected]> (cherry picked from commit 7b6f257)
1 parent 6447cfb commit fb81ddb

File tree

3 files changed

+219
-170
lines changed

3 files changed

+219
-170
lines changed

include/zephyr/net/wifi_credentials.h

+20-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,16 @@ extern "C" {
3333
#define WIFI_CREDENTIALS_FLAG_2_4GHz BIT(2)
3434
/* this entry can use the 5 GHz band */
3535
#define WIFI_CREDENTIALS_FLAG_5GHz BIT(3)
36+
/* this entry can use the 6 GHz band */
37+
#define WIFI_CREDENTIALS_FLAG_6GHz BIT(4)
3638
/* this entry requires management frame protection */
37-
#define WIFI_CREDENTIALS_FLAG_MFP_REQUIRED BIT(4)
39+
#define WIFI_CREDENTIALS_FLAG_MFP_REQUIRED BIT(5)
3840
/* this entry disables management frame protection */
39-
#define WIFI_CREDENTIALS_FLAG_MFP_DISABLED BIT(5)
41+
#define WIFI_CREDENTIALS_FLAG_MFP_DISABLED BIT(6)
42+
/* this entry has anonymous identity configured */
43+
#define WIFI_CREDENTIALS_FLAG_ANONYMOUS_IDENTITY BIT(7)
44+
/* this entry has key password configured */
45+
#define WIFI_CREDENTIALS_FLAG_KEY_PASSWORD BIT(8)
4046

4147
/* Maximum length of the password */
4248
#define WIFI_CREDENTIALS_MAX_PASSWORD_LEN \
@@ -71,6 +77,18 @@ struct wifi_credentials_header {
7177

7278
/** Channel on which the network operates */
7379
uint8_t channel;
80+
81+
/** Anonymous identifier (Limited to 16 bytes due to settings subsystem overflow) */
82+
char anon_id[16];
83+
84+
/** Length of the Anonymous identifier */
85+
uint8_t aid_length;
86+
87+
/** Password/PSK (Limited to 16 bytes due to settings subsystem overflow) */
88+
char key_passwd[16];
89+
90+
/** Length of the Password */
91+
uint8_t key_passwd_length;
7492
};
7593

7694
/**

subsys/net/lib/wifi_credentials/Kconfig

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ config WIFI_CREDENTIALS_SHELL
5757
bool "Shell commands to manage Wi-Fi credentials"
5858
default y
5959
depends on SHELL
60+
select SHELL_GETOPT
61+
select GETOPT_LONG
6062
depends on !WIFI_CREDENTIALS_BACKEND_NONE
6163

6264
config WIFI_CREDENTIALS_CONNECT_STORED

0 commit comments

Comments
 (0)