ifcfg-rh: save/restore WPS properties

This commit is contained in:
Lubomir Rintel 2017-04-24 15:23:19 +02:00
parent 0eb7617504
commit 99c112a493
3 changed files with 27 additions and 1 deletions

View file

@ -1847,6 +1847,15 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting
*
* Since: 1.10
**/
/* ---ifcfg-rh---
* property: wps-method
* variable: WPS_METHOD
* description: Used to control the WPS methods to be used
* Valid values are "default", "auto", "disabled", "pin" and "pbc".
* If omitted, whatver the AP announces is used.
* example: WPS_METHOD=disabled, WPS_METHOD="pin pbc"
* ---end---
*/
g_object_class_install_property
(object_class, PROP_WPS_METHOD,
g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_WPS_METHOD, "", "",
@ -1855,5 +1864,4 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting
G_PARAM_CONSTRUCT |
NM_SETTING_PARAM_FUZZY_IGNORE |
G_PARAM_STATIC_STRINGS));
}

View file

@ -3339,6 +3339,16 @@ make_wpa_setting (shvarFile *ifcfg,
if (!wpa_psk && !wpa_eap && !ieee8021x)
goto error; /* Not WPA or Dynamic WEP */
/* WPS */
i_val = NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DEFAULT;
if (!svGetValueEnum (ifcfg, "WPS_METHOD",
nm_setting_wireless_security_wps_method_get_type (),
&i_val, error))
goto error;
g_object_set (wsec,
NM_SETTING_WIRELESS_SECURITY_WPS_METHOD, (guint) i_val,
NULL);
/* Pairwise and Group ciphers (only relevant for WPA/RSN) */
if (wpa_psk || wpa_eap) {
fill_wpa_ciphers (ifcfg, wsec, FALSE, adhoc);

View file

@ -527,6 +527,7 @@ write_wireless_security_setting (NMConnection *connection,
const char *key_mgmt, *auth_alg, *key, *proto, *cipher;
const char *psk = NULL;
gboolean wep = FALSE, wpa = FALSE, dynamic_wep = FALSE;
NMSettingWirelessSecurityWpsMethod wps_method;
char *tmp;
guint32 i, num;
GString *str;
@ -580,6 +581,13 @@ write_wireless_security_setting (NMConnection *connection,
}
}
/* WPS */
wps_method = nm_setting_wireless_security_get_wps_method (s_wsec);
if (wps_method == NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DEFAULT)
svUnsetValue (ifcfg, "WPS_METHOD");
else
svSetValueEnum (ifcfg, "WPS_METHOD", nm_setting_wireless_security_wps_method_get_type (), wps_method);
/* WEP keys */
/* Clear any default key */