mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-06 17:14:02 +00:00
settings/ifcfg: add support for KEY_MGMT=OWE
This commit is contained in:
parent
1e55eff498
commit
235cb4a5d3
|
@ -3073,6 +3073,7 @@ EXTRA_DIST += \
|
|||
src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-ssid-long-hex \
|
||||
src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-ssid-long-quoted \
|
||||
src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open-ssid-quoted \
|
||||
src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-owe \
|
||||
src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-sae \
|
||||
src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep \
|
||||
src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wep-104-ascii \
|
||||
|
|
|
@ -3643,7 +3643,7 @@ make_wpa_setting (shvarFile *ifcfg,
|
|||
gs_unref_object NMSettingWirelessSecurity *wsec = NULL;
|
||||
gs_free char *value = NULL;
|
||||
const char *v;
|
||||
gboolean wpa_psk = FALSE, wpa_sae = FALSE, wpa_eap = FALSE, ieee8021x = FALSE;
|
||||
gboolean wpa_psk = FALSE, wpa_sae = FALSE, wpa_owe = FALSE, wpa_eap = FALSE, ieee8021x = FALSE;
|
||||
int i_val;
|
||||
GError *local = NULL;
|
||||
|
||||
|
@ -3652,10 +3652,12 @@ make_wpa_setting (shvarFile *ifcfg,
|
|||
v = svGetValueStr (ifcfg, "KEY_MGMT", &value);
|
||||
wpa_psk = nm_streq0 (v, "WPA-PSK");
|
||||
wpa_sae = nm_streq0 (v, "SAE");
|
||||
wpa_owe = nm_streq0 (v, "OWE");
|
||||
wpa_eap = nm_streq0 (v, "WPA-EAP");
|
||||
ieee8021x = nm_streq0 (v, "IEEE8021X");
|
||||
if ( !wpa_psk
|
||||
&& !wpa_sae
|
||||
&& !wpa_owe
|
||||
&& !wpa_eap
|
||||
&& !ieee8021x)
|
||||
return NULL; /* Not WPA or Dynamic WEP */
|
||||
|
@ -3671,7 +3673,7 @@ make_wpa_setting (shvarFile *ifcfg,
|
|||
NULL);
|
||||
|
||||
/* Pairwise and Group ciphers (only relevant for WPA/RSN) */
|
||||
if (wpa_psk || wpa_sae || wpa_eap) {
|
||||
if (wpa_psk || wpa_sae || wpa_owe || wpa_eap) {
|
||||
fill_wpa_ciphers (ifcfg, wsec, FALSE, adhoc);
|
||||
fill_wpa_ciphers (ifcfg, wsec, TRUE, adhoc);
|
||||
}
|
||||
|
@ -3720,7 +3722,7 @@ make_wpa_setting (shvarFile *ifcfg,
|
|||
g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "sae", NULL);
|
||||
}
|
||||
} else {
|
||||
nm_assert (wpa_eap || ieee8021x);
|
||||
nm_assert (wpa_eap || ieee8021x || wpa_owe);
|
||||
|
||||
/* Adhoc mode is mutually exclusive with any 802.1x-based authentication */
|
||||
if (adhoc) {
|
||||
|
@ -3729,14 +3731,17 @@ make_wpa_setting (shvarFile *ifcfg,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
*s_8021x = fill_8021x (ifcfg, file, v, TRUE, error);
|
||||
if (!*s_8021x)
|
||||
return NULL;
|
||||
if (wpa_owe) {
|
||||
g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "owe", NULL);
|
||||
} else {
|
||||
*s_8021x = fill_8021x (ifcfg, file, v, TRUE, error);
|
||||
if (!*s_8021x)
|
||||
return NULL;
|
||||
|
||||
{
|
||||
gs_free char *lower = g_ascii_strdown (v, -1);
|
||||
|
||||
g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, lower, NULL);
|
||||
{
|
||||
gs_free char *lower = g_ascii_strdown (v, -1);
|
||||
g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, lower, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -583,6 +583,10 @@ write_wireless_security_setting (NMConnection *connection,
|
|||
svSetValueStr (ifcfg, "KEY_MGMT", "SAE");
|
||||
wpa = TRUE;
|
||||
*no_8021x = TRUE;
|
||||
} else if (!strcmp (key_mgmt, "owe")) {
|
||||
svSetValueStr (ifcfg, "KEY_MGMT", "OWE");
|
||||
wpa = FALSE;
|
||||
*no_8021x = TRUE;
|
||||
} else if (!strcmp (key_mgmt, "ieee8021x")) {
|
||||
svSetValueStr (ifcfg, "KEY_MGMT", "IEEE8021X");
|
||||
dynamic_wep = TRUE;
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
TYPE=Wireless
|
||||
DEVICE=wlan1
|
||||
ESSID=blahblah_owe
|
||||
MODE=Managed
|
||||
KEY_MGMT=OWE
|
|
@ -3034,6 +3034,45 @@ test_read_wifi_sae (void)
|
|||
g_assert (!nm_setting_wireless_security_get_auth_alg (s_wsec));
|
||||
}
|
||||
|
||||
static void
|
||||
test_read_wifi_owe (void)
|
||||
{
|
||||
gs_unref_object NMConnection *connection = NULL;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingWireless *s_wireless;
|
||||
NMSettingWirelessSecurity *s_wsec;
|
||||
GBytes *ssid;
|
||||
const char *expected_ssid = "blahblah_owe";
|
||||
|
||||
connection = _connection_from_file (TEST_IFCFG_DIR"/ifcfg-test-wifi-owe",
|
||||
NULL, TYPE_WIRELESS, NULL);
|
||||
|
||||
s_con = nm_connection_get_setting_connection (connection);
|
||||
g_assert (s_con);
|
||||
g_assert_cmpstr (nm_setting_connection_get_id (s_con), ==, "System blahblah_owe (test-wifi-owe)");
|
||||
|
||||
g_assert_cmpint (nm_setting_connection_get_timestamp (s_con), ==, 0);
|
||||
g_assert (nm_setting_connection_get_autoconnect (s_con));
|
||||
|
||||
s_wireless = nm_connection_get_setting_wireless (connection);
|
||||
g_assert (s_wireless);
|
||||
|
||||
g_assert_cmpint (nm_setting_wireless_get_mtu (s_wireless), ==, 0);
|
||||
|
||||
ssid = nm_setting_wireless_get_ssid (s_wireless);
|
||||
g_assert (ssid);
|
||||
g_assert_cmpmem (g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid), expected_ssid, strlen (expected_ssid));
|
||||
|
||||
g_assert (!nm_setting_wireless_get_bssid (s_wireless));
|
||||
g_assert_cmpstr (nm_setting_wireless_get_mode (s_wireless), ==, "infrastructure");
|
||||
|
||||
s_wsec = nm_connection_get_setting_wireless_security (connection);
|
||||
g_assert (s_wsec);
|
||||
g_assert_cmpstr (nm_setting_wireless_security_get_key_mgmt (s_wsec), ==, "owe");
|
||||
g_assert (!nm_setting_wireless_security_get_psk (s_wsec));
|
||||
g_assert (!nm_setting_wireless_security_get_auth_alg (s_wsec));
|
||||
}
|
||||
|
||||
static void
|
||||
test_read_wifi_wpa_psk_2 (void)
|
||||
{
|
||||
|
@ -10322,6 +10361,7 @@ int main (int argc, char **argv)
|
|||
g_test_add_func (TPATH "wifi/read/wpa-psk/adhoc", test_read_wifi_wpa_psk_adhoc);
|
||||
g_test_add_func (TPATH "wifi/read/wpa-psk/hex", test_read_wifi_wpa_psk_hex);
|
||||
g_test_add_func (TPATH "wifi/read/sae", test_read_wifi_sae);
|
||||
g_test_add_func (TPATH "wifi/read/owe", test_read_wifi_owe);
|
||||
g_test_add_func (TPATH "wifi/read/dynamic-wep/leap", test_read_wifi_dynamic_wep_leap);
|
||||
g_test_add_func (TPATH "wifi/read/wpa/eap/tls", test_read_wifi_wpa_eap_tls);
|
||||
g_test_add_func (TPATH "wifi/read/wpa/eap/ttls/tls", test_read_wifi_wpa_eap_ttls_tls);
|
||||
|
|
Loading…
Reference in a new issue