supplicant: move strv lists into option meta data

Have the string list definition closer to the option where it is used.
This commit is contained in:
Thomas Haller 2020-06-10 11:37:22 +02:00
parent 03b3e0bfd6
commit f2f82c13b5
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -49,106 +49,67 @@ static const struct validate_entry validate_table[] = {
{ TYPE_KEYWORD, validate_type_keyword },
};
static const char *const pairwise_allowed[] = { "CCMP",
"TKIP",
"NONE",
NULL };
static const char *const group_allowed[] = { "CCMP",
"TKIP",
"WEP104",
"WEP40",
NULL };
static const char *const proto_allowed[] = { "WPA",
"RSN",
NULL };
static const char *const key_mgmt_allowed[] = { "WPA-PSK",
"WPA-PSK-SHA256",
"FT-PSK",
"WPA-EAP",
"WPA-EAP-SHA256",
"FT-EAP",
"FT-EAP-SHA384",
"FILS-SHA256",
"FILS-SHA384",
"FT-FILS-SHA256",
"FT-FILS-SHA384",
"IEEE8021X",
"SAE",
"FT-SAE",
"OWE",
"NONE",
NULL };
static const char *const auth_alg_allowed[] = { "OPEN",
"SHARED",
"LEAP",
NULL };
static const char *const eap_allowed[] = { "LEAP",
"MD5",
"TLS",
"PEAP",
"TTLS",
"SIM",
"PSK",
"FAST",
"PWD",
NULL };
static const char *const phase1_allowed[] = { "peapver=0",
"peapver=1",
"peaplabel=1",
"peap_outer_success=0",
"include_tls_length=1",
"sim_min_num_chal=3",
"fast_provisioning=0",
"fast_provisioning=1",
"fast_provisioning=2",
"fast_provisioning=3",
"tls_disable_tlsv1_0=0",
"tls_disable_tlsv1_0=1",
"tls_disable_tlsv1_1=0",
"tls_disable_tlsv1_1=1",
"tls_disable_tlsv1_2=0",
"tls_disable_tlsv1_2=1",
NULL };
static const char *const phase2_allowed[] = { "auth=PAP",
"auth=CHAP",
"auth=MSCHAP",
"auth=MSCHAPV2",
"auth=GTC",
"auth=OTP",
"auth=MD5",
"auth=TLS",
"autheap=MD5",
"autheap=MSCHAPV2",
"autheap=OTP",
"autheap=GTC",
"autheap=TLS",
NULL };
static const struct Opt opt_table[] = {
{ "ssid", TYPE_BYTES, 0, 32, FALSE, NULL },
{ "bssid", TYPE_KEYWORD, 0, 0, FALSE, NULL },
{ "scan_ssid", TYPE_INT, 0, 1, FALSE, NULL },
{ "frequency", TYPE_INT, 2412, 5825, FALSE, NULL },
{ "auth_alg", TYPE_KEYWORD, 0, 0, FALSE, auth_alg_allowed },
{ "auth_alg", TYPE_KEYWORD, 0, 0, FALSE, NM_MAKE_STRV (
"OPEN",
"SHARED",
"LEAP",
) },
{ "psk", TYPE_BYTES, 0, 0, FALSE, NULL },
{ "pairwise", TYPE_KEYWORD, 0, 0, FALSE, pairwise_allowed },
{ "group", TYPE_KEYWORD, 0, 0, FALSE, group_allowed },
{ "proto", TYPE_KEYWORD, 0, 0, FALSE, proto_allowed },
{ "key_mgmt", TYPE_KEYWORD, 0, 0, FALSE, key_mgmt_allowed },
{ "pairwise", TYPE_KEYWORD, 0, 0, FALSE, NM_MAKE_STRV (
"CCMP",
"TKIP",
"NONE",
) },
{ "group", TYPE_KEYWORD, 0, 0, FALSE, NM_MAKE_STRV (
"CCMP",
"TKIP",
"WEP104",
"WEP40",
) },
{ "proto", TYPE_KEYWORD, 0, 0, FALSE, NM_MAKE_STRV (
"WPA",
"RSN",
) },
{ "key_mgmt", TYPE_KEYWORD, 0, 0, FALSE, NM_MAKE_STRV (
"WPA-PSK",
"WPA-PSK-SHA256",
"FT-PSK",
"WPA-EAP",
"WPA-EAP-SHA256",
"FT-EAP",
"FT-EAP-SHA384",
"FILS-SHA256",
"FILS-SHA384",
"FT-FILS-SHA256",
"FT-FILS-SHA384",
"IEEE8021X",
"SAE",
"FT-SAE",
"OWE",
"NONE",
) },
{ "wep_key0", TYPE_BYTES, 0, 0, FALSE, NULL },
{ "wep_key1", TYPE_BYTES, 0, 0, FALSE, NULL },
{ "wep_key2", TYPE_BYTES, 0, 0, FALSE, NULL },
{ "wep_key3", TYPE_BYTES, 0, 0, FALSE, NULL },
{ "wep_tx_keyidx", TYPE_INT, 0, 3, FALSE, NULL },
{ "eapol_flags", TYPE_INT, 0, 3, FALSE, NULL },
{ "eap", TYPE_KEYWORD, 0, 0, FALSE, eap_allowed },
{ "eap", TYPE_KEYWORD, 0, 0, FALSE, NM_MAKE_STRV (
"LEAP",
"MD5",
"TLS",
"PEAP",
"TTLS",
"SIM",
"PSK",
"FAST",
"PWD",
) },
{ "identity", TYPE_BYTES, 0, 0, FALSE, NULL },
{ "password", TYPE_UTF8, 0, 0, FALSE, NULL },
{ "ca_path", TYPE_BYTES, 0, 0, FALSE, NULL },
@ -160,8 +121,39 @@ static const struct Opt opt_table[] = {
{ "client_cert", TYPE_BYTES, 0, 65536, FALSE, NULL },
{ "private_key", TYPE_BYTES, 0, 65536, FALSE, NULL },
{ "private_key_passwd", TYPE_BYTES, 0, 1024, FALSE, NULL },
{ "phase1", TYPE_KEYWORD, 0, 0, TRUE, phase1_allowed },
{ "phase2", TYPE_KEYWORD, 0, 0, TRUE, phase2_allowed },
{ "phase1", TYPE_KEYWORD, 0, 0, TRUE, NM_MAKE_STRV (
"peapver=0",
"peapver=1",
"peaplabel=1",
"peap_outer_success=0",
"include_tls_length=1",
"sim_min_num_chal=3",
"fast_provisioning=0",
"fast_provisioning=1",
"fast_provisioning=2",
"fast_provisioning=3",
"tls_disable_tlsv1_0=0",
"tls_disable_tlsv1_0=1",
"tls_disable_tlsv1_1=0",
"tls_disable_tlsv1_1=1",
"tls_disable_tlsv1_2=0",
"tls_disable_tlsv1_2=1",
) },
{ "phase2", TYPE_KEYWORD, 0, 0, TRUE, NM_MAKE_STRV (
"auth=PAP",
"auth=CHAP",
"auth=MSCHAP",
"auth=MSCHAPV2",
"auth=GTC",
"auth=OTP",
"auth=MD5",
"auth=TLS",
"autheap=MD5",
"autheap=MSCHAPV2",
"autheap=OTP",
"autheap=GTC",
"autheap=TLS",
) },
{ "anonymous_identity", TYPE_BYTES, 0, 0, FALSE, NULL },
{ "ca_path2", TYPE_BYTES, 0, 0, FALSE, NULL },
{ "subject_match2", TYPE_BYTES, 0, 0, FALSE, NULL },