mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-03 17:10:26 +01:00
ifcfg-rh: support the wifi.pmf property
This commit is contained in:
parent
6181f41d8d
commit
53f3113389
4 changed files with 40 additions and 0 deletions
|
|
@ -1529,6 +1529,14 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting
|
|||
*
|
||||
* Since: 1.10
|
||||
**/
|
||||
/* ---ifcfg-rh---
|
||||
* property: pmf
|
||||
* variable: PMF(+)
|
||||
* values: default, disable, optional, required
|
||||
* description: Enables or disables PMF (802.11w)
|
||||
* example: PMF=required
|
||||
* ---end---
|
||||
*/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_PMF,
|
||||
g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_PMF, "", "",
|
||||
|
|
|
|||
|
|
@ -3294,7 +3294,9 @@ make_wpa_setting (shvarFile *ifcfg,
|
|||
{
|
||||
NMSettingWirelessSecurity *wsec;
|
||||
char *value, *psk, *lower;
|
||||
const char *cvalue;
|
||||
gboolean wpa_psk = FALSE, wpa_eap = FALSE, ieee8021x = FALSE;
|
||||
guint pmf = NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT;
|
||||
|
||||
wsec = NM_SETTING_WIRELESS_SECURITY (nm_setting_wireless_security_new ());
|
||||
|
||||
|
|
@ -3373,6 +3375,24 @@ make_wpa_setting (shvarFile *ifcfg,
|
|||
|
||||
g_free (value);
|
||||
|
||||
cvalue = svGetValue (ifcfg, "PMF", &value);
|
||||
if (cvalue) {
|
||||
int i_pmf;
|
||||
|
||||
if (!nm_utils_enum_from_str (nm_setting_wireless_security_pmf_get_type (),
|
||||
cvalue,
|
||||
&i_pmf,
|
||||
NULL)) {
|
||||
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
|
||||
"Invalid PMF value '%s'", cvalue);
|
||||
g_free (value);
|
||||
goto error;
|
||||
}
|
||||
pmf = i_pmf;
|
||||
g_free (value);
|
||||
}
|
||||
g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_PMF, pmf, NULL);
|
||||
|
||||
value = svGetValueStr_cp (ifcfg, "SECURITYMODE");
|
||||
if (NM_IN_STRSET (value, NULL, "open"))
|
||||
g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, value, NULL);
|
||||
|
|
|
|||
|
|
@ -707,6 +707,17 @@ write_wireless_security_setting (NMConnection *connection,
|
|||
"WPA_PSK_FLAGS",
|
||||
wpa ? nm_setting_wireless_security_get_psk_flags (s_wsec) : NM_SETTING_SECRET_FLAG_NONE);
|
||||
|
||||
|
||||
if (nm_setting_wireless_security_get_pmf (s_wsec) == NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT)
|
||||
svUnsetValue (ifcfg, "PMF");
|
||||
else {
|
||||
gs_free char * value = NULL;
|
||||
|
||||
value = nm_utils_enum_to_str (nm_setting_wireless_security_pmf_get_type(),
|
||||
nm_setting_wireless_security_get_pmf (s_wsec));
|
||||
svSetValueStr (ifcfg, "PMF", value);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5768,6 +5768,7 @@ test_write_wifi_wpa_psk (gconstpointer test_data)
|
|||
g_object_set (s_wsec,
|
||||
NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk",
|
||||
NM_SETTING_WIRELESS_SECURITY_PSK, args.psk,
|
||||
NM_SETTING_WIRELESS_SECURITY_PMF, (guint) NM_SETTING_WIRELESS_SECURITY_PMF_REQUIRED,
|
||||
NULL);
|
||||
|
||||
if (GPOINTER_TO_INT (args.wep_group_p)) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue