mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-05 20:30:59 +01:00
setting-wireless: add wps-method property
This property will be used to decide if it makes sense to attempt a WPS enrollment on connection activation.
This commit is contained in:
parent
36b6bbdae3
commit
e6f95b50c8
4 changed files with 97 additions and 2 deletions
|
|
@ -40,6 +40,7 @@
|
|||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY2 N_("Index 2 WEP key. This WEP index is not used by most networks. See the \"wep-key-type\" property for a description of how this key is interpreted.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY3 N_("Index 3 WEP key. This WEP index is not used by most networks. See the \"wep-key-type\" property for a description of how this key is interpreted.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX N_("When static WEP is used (ie, key-mgmt = \"none\") and a non-default WEP key index is used by the AP, put that WEP key index here. Valid values are 0 (default key) through 3. Note that some consumer access points (like the Linksys WRT54G) number the keys 1 - 4.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WPS_METHOD N_("Flags indicating which mode of WPS is to be used if any. There's little point in changing the default setting as NetworkManager will automatically determine whether it's feasible to start WPS enrollment from the Access Point capabilities. WPS can by disabled by setting this property to a value of 1.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_ALTSUBJECT_MATCHES N_("List of strings to be matched against the altSubjectName of the certificate presented by the authentication server. If the list is empty, no verification of the server certificate's altSubjectName is performed.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_ANONYMOUS_IDENTITY N_("Anonymous identity string for EAP authentication methods. Used as the unencrypted identity with EAP types that support different tunneled identity like EAP-TTLS.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_AUTH_TIMEOUT N_("A timeout for the authentication. Zero means the global default; if the global default is not set, the authentication timeout is 25 seconds.")
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright 2007 - 2014 Red Hat, Inc.
|
||||
* Copyright 2007 - 2017 Red Hat, Inc.
|
||||
* Copyright 2007 - 2008 Novell, Inc.
|
||||
*/
|
||||
|
||||
|
|
@ -84,6 +84,9 @@ typedef struct {
|
|||
/* WPA-PSK */
|
||||
char *psk;
|
||||
NMSettingSecretFlags psk_flags;
|
||||
|
||||
/* WPS */
|
||||
NMSettingWirelessSecurityWpsMethod wps_method;
|
||||
} NMSettingWirelessSecurityPrivate;
|
||||
|
||||
enum {
|
||||
|
|
@ -106,6 +109,7 @@ enum {
|
|||
PROP_PSK_FLAGS,
|
||||
PROP_LEAP_PASSWORD,
|
||||
PROP_LEAP_PASSWORD_FLAGS,
|
||||
PROP_WPS_METHOD,
|
||||
|
||||
LAST_PROP
|
||||
};
|
||||
|
|
@ -793,6 +797,23 @@ nm_setting_wireless_security_get_wep_key_type (NMSettingWirelessSecurity *settin
|
|||
return NM_SETTING_WIRELESS_SECURITY_GET_PRIVATE (setting)->wep_key_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_wireless_security_get_wps_method:
|
||||
* @setting: the #NMSettingWirelessSecurity
|
||||
*
|
||||
* Returns: the #NMSettingWirelessSecurity:wps-method property of the setting
|
||||
*
|
||||
* Since: 1.10
|
||||
**/
|
||||
NMSettingWirelessSecurityWpsMethod
|
||||
nm_setting_wireless_security_get_wps_method (NMSettingWirelessSecurity *setting)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_WIRELESS_SECURITY (setting),
|
||||
NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DISABLED);
|
||||
|
||||
return NM_SETTING_WIRELESS_SECURITY_GET_PRIVATE (setting)->wps_method;
|
||||
}
|
||||
|
||||
static GPtrArray *
|
||||
need_secrets (NMSetting *setting)
|
||||
{
|
||||
|
|
@ -1056,6 +1077,25 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* WPS */
|
||||
if (priv->wps_method > NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_PIN) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("property is invalid"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, NM_SETTING_WIRELESS_SECURITY_WPS_METHOD);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (priv->wps_method & NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DISABLED && priv->wps_method != NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DISABLED) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("can't be simultaneously disabled and enabled"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, NM_SETTING_WIRELESS_SECURITY_WPS_METHOD);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1284,6 +1324,9 @@ set_property (GObject *object, guint prop_id,
|
|||
case PROP_WEP_KEY_TYPE:
|
||||
priv->wep_key_type = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_WPS_METHOD:
|
||||
priv->wps_method = g_value_get_uint (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
|
@ -1352,6 +1395,9 @@ get_property (GObject *object, guint prop_id,
|
|||
case PROP_WEP_KEY_TYPE:
|
||||
g_value_set_enum (value, priv->wep_key_type);
|
||||
break;
|
||||
case PROP_WPS_METHOD:
|
||||
g_value_set_uint (value, priv->wps_method);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
|
@ -1788,4 +1834,26 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting
|
|||
G_VARIANT_TYPE_UINT32,
|
||||
wep_key_type_to_dbus,
|
||||
NULL);
|
||||
/**
|
||||
* NMSettingWirelessSecurity:wps-method:
|
||||
*
|
||||
* Flags indicating which mode of WPS is to be used if any.
|
||||
*
|
||||
* There's little point in changing the default setting as NetworkManager will
|
||||
* automatically determine whether it's feasible to start WPS enrollment from
|
||||
* the Access Point capabilities.
|
||||
*
|
||||
* WPS can by disabled by setting this property to a value of 1.
|
||||
*
|
||||
* Since: 1.10
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_WPS_METHOD,
|
||||
g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_WPS_METHOD, "", "",
|
||||
0, G_MAXUINT32, NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DEFAULT,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT |
|
||||
NM_SETTING_PARAM_FUZZY_IGNORE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright 2007 - 2014 Red Hat, Inc.
|
||||
* Copyright 2007 - 2017 Red Hat, Inc.
|
||||
* Copyright 2007 - 2008 Novell, Inc.
|
||||
*/
|
||||
|
||||
|
|
@ -89,6 +89,26 @@ typedef enum {
|
|||
NM_SETTING_WIRELESS_SECURITY_PMF_LAST = _NM_SETTING_WIRELESS_SECURITY_PMF_NUM - 1, /*< skip >*/
|
||||
} NMSettingWirelessSecurityPmf;
|
||||
|
||||
/**
|
||||
* NMSettingWirelessSecurityWpsMethod:
|
||||
* @NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DEFAULT: Attempt whichever method AP supports
|
||||
* @NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DISABLED: WPS can not be used.
|
||||
* @NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_AUTO: Use WPS, any method
|
||||
* @NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_PBC: use WPS push-buthon method
|
||||
* @NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_PIN: use PIN method
|
||||
*
|
||||
* Configure the use of WPS by a connection while it activates.
|
||||
*
|
||||
* Since: 1.10
|
||||
**/
|
||||
typedef enum {
|
||||
NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DEFAULT = 0x00000000,
|
||||
NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_DISABLED = 0x00000001,
|
||||
NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_AUTO = 0x00000002,
|
||||
NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_PBC = 0x00000004,
|
||||
NM_SETTING_WIRELESS_SECURITY_WPS_METHOD_PIN = 0x00000008,
|
||||
} NMSettingWirelessSecurityWpsMethod;
|
||||
|
||||
#define NM_SETTING_WIRELESS_SECURITY_KEY_MGMT "key-mgmt"
|
||||
#define NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX "wep-tx-keyidx"
|
||||
#define NM_SETTING_WIRELESS_SECURITY_AUTH_ALG "auth-alg"
|
||||
|
|
@ -107,6 +127,7 @@ typedef enum {
|
|||
#define NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS "psk-flags"
|
||||
#define NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD "leap-password"
|
||||
#define NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS "leap-password-flags"
|
||||
#define NM_SETTING_WIRELESS_SECURITY_WPS_METHOD "wps-method"
|
||||
|
||||
/**
|
||||
* NMSettingWirelessSecurity:
|
||||
|
|
@ -169,6 +190,9 @@ const char *nm_setting_wireless_security_get_auth_alg (NMSettingWirelessSec
|
|||
NMSettingSecretFlags nm_setting_wireless_security_get_wep_key_flags (NMSettingWirelessSecurity *setting);
|
||||
NMWepKeyType nm_setting_wireless_security_get_wep_key_type (NMSettingWirelessSecurity *setting);
|
||||
|
||||
NM_AVAILABLE_IN_1_10
|
||||
NMSettingWirelessSecurityWpsMethod nm_setting_wireless_security_get_wps_method (NMSettingWirelessSecurity *setting);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __NM_SETTING_WIRELESS_SECURITY_H__ */
|
||||
|
|
|
|||
|
|
@ -1181,5 +1181,7 @@ global:
|
|||
libnm_1_10_0 {
|
||||
global:
|
||||
nm_setting_wireless_security_get_pmf;
|
||||
nm_setting_wireless_security_get_wps_method;
|
||||
nm_setting_wireless_security_pmf_get_type;
|
||||
nm_setting_wireless_security_wps_method_get_type;
|
||||
} libnm_1_8_0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue