mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-31 13:40:11 +01:00
wifi: merge branch 'bg/ibss-rsn'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/184
This commit is contained in:
commit
48da56ed6c
23 changed files with 995 additions and 998 deletions
|
|
@ -539,6 +539,9 @@ _metagen_device_detail_wifi_properties_get_fcn (NMC_META_GENERIC_INFO_GET_FCN_AR
|
|||
case NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_MESH:
|
||||
return nmc_meta_generic_get_bool (NM_FLAGS_HAS (wcaps, NM_WIFI_DEVICE_CAP_MESH),
|
||||
get_type);
|
||||
case NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_IBSS_RSN:
|
||||
return nmc_meta_generic_get_bool (NM_FLAGS_HAS (wcaps, NM_WIFI_DEVICE_CAP_IBSS_RSN),
|
||||
get_type);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -549,16 +552,17 @@ _metagen_device_detail_wifi_properties_get_fcn (NMC_META_GENERIC_INFO_GET_FCN_AR
|
|||
const NmcMetaGenericInfo *const metagen_device_detail_wifi_properties[_NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_NUM + 1] = {
|
||||
#define _METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES(type, name) \
|
||||
[type] = NMC_META_GENERIC(name, .info_type = type, .get_fcn = _metagen_device_detail_wifi_properties_get_fcn)
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_WEP, "WEP"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_WPA, "WPA"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_WPA2, "WPA2"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_TKIP, "TKIP"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_CCMP, "CCMP"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_AP, "AP"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_ADHOC, "ADHOC"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_2GHZ, "2GHZ"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_5GHZ, "5GHZ"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_MESH, "MESH"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_WEP, "WEP"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_WPA, "WPA"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_WPA2, "WPA2"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_TKIP, "TKIP"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_CCMP, "CCMP"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_AP, "AP"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_ADHOC, "ADHOC"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_2GHZ, "2GHZ"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_5GHZ, "5GHZ"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_MESH, "MESH"),
|
||||
_METAGEN_DEVICE_DETAIL_WIFI_PROPERTIES (NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_IBSS_RSN, "IBSS-RSN"),
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -226,6 +226,7 @@ typedef enum {
|
|||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_2GHZ,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_5GHZ,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_MESH,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_IBSS_RSN,
|
||||
_NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_NUM,
|
||||
|
||||
} NmcGenericInfoType;
|
||||
|
|
|
|||
|
|
@ -7311,7 +7311,7 @@ static const NMMetaPropertyInfo *const property_infos_WIRELESS_SECURITY[] = {
|
|||
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_KEY_MGMT,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = NM_MAKE_STRV ("none", "ieee8021x", "wpa-none", "wpa-psk", "wpa-eap", "sae"),
|
||||
.values_static = NM_MAKE_STRV ("none", "ieee8021x", "wpa-psk", "wpa-eap", "sae"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX,
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ add_wireless_secrets (RequestData *request,
|
|||
if (!key_mgmt)
|
||||
return FALSE;
|
||||
|
||||
if (NM_IN_STRSET (key_mgmt, "wpa-none", "wpa-psk", "sae")) {
|
||||
if (NM_IN_STRSET (key_mgmt, "wpa-psk", "sae")) {
|
||||
secret = _secret_real_new_plain (NM_SECRET_AGENT_SECRET_TYPE_SECRET,
|
||||
_("Password"),
|
||||
NM_SETTING (s_wsec),
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_AUTH_ALG N_("When WEP is used (ie, key-mgmt = \"none\" or \"ieee8021x\") indicate the 802.11 authentication algorithm required by the AP here. One of \"open\" for Open System, \"shared\" for Shared Key, or \"leap\" for Cisco LEAP. When using Cisco LEAP (ie, key-mgmt = \"ieee8021x\" and auth-alg = \"leap\") the \"leap-username\" and \"leap-password\" properties must be specified.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_FILS N_("Indicates whether Fast Initial Link Setup (802.11ai) must be enabled for the connection. One of NM_SETTING_WIRELESS_SECURITY_FILS_DEFAULT (0) (use global default value), NM_SETTING_WIRELESS_SECURITY_FILS_DISABLE (1) (disable FILS), NM_SETTING_WIRELESS_SECURITY_FILS_OPTIONAL (2) (enable FILS if the supplicant and the access point support it) or NM_SETTING_WIRELESS_SECURITY_FILS_REQUIRED (3) (enable FILS and fail if not supported). When set to NM_SETTING_WIRELESS_SECURITY_FILS_DEFAULT (0) and no global default is set, FILS will be optionally enabled.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_GROUP N_("A list of group/broadcast encryption algorithms which prevents connections to Wi-Fi networks that do not utilize one of the algorithms in the list. For maximum compatibility leave this property empty. Each list element may be one of \"wep40\", \"wep104\", \"tkip\", or \"ccmp\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_KEY_MGMT N_("Key management used for the connection. One of \"none\" (WEP), \"ieee8021x\" (Dynamic WEP), \"wpa-none\" (Ad-Hoc WPA-PSK), \"wpa-psk\" (infrastructure WPA-PSK), \"sae\" (SAE) or \"wpa-eap\" (WPA-Enterprise). This property must be set for any Wi-Fi connection that uses security.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_KEY_MGMT N_("Key management used for the connection. One of \"none\" (WEP), \"ieee8021x\" (Dynamic WEP), \"wpa-psk\" (infrastructure WPA-PSK), \"sae\" (SAE) or \"wpa-eap\" (WPA-Enterprise). This property must be set for any Wi-Fi connection that uses security.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD N_("The login password for legacy LEAP connections (ie, key-mgmt = \"ieee8021x\" and auth-alg = \"leap\").")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS N_("Flags indicating how to handle the \"leap-password\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME N_("The login username for legacy LEAP connections (ie, key-mgmt = \"ieee8021x\" and auth-alg = \"leap\").")
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -601,8 +601,7 @@ get_security_type (NMEditorWirelessSecurityMethodBinding *binding)
|
|||
return "dynamic-wep";
|
||||
}
|
||||
|
||||
if ( !strcmp (key_mgmt, "wpa-none")
|
||||
|| !strcmp (key_mgmt, "wpa-psk"))
|
||||
if (!strcmp (key_mgmt, "wpa-psk"))
|
||||
return "wpa-personal";
|
||||
|
||||
if (!strcmp (key_mgmt, "wpa-eap"))
|
||||
|
|
|
|||
|
|
@ -293,6 +293,7 @@ typedef enum { /*< flags >*/
|
|||
* @NM_WIFI_DEVICE_CAP_FREQ_2GHZ: device supports 2.4GHz frequencies
|
||||
* @NM_WIFI_DEVICE_CAP_FREQ_5GHZ: device supports 5GHz frequencies
|
||||
* @NM_WIFI_DEVICE_CAP_MESH: device supports acting as a mesh point. Since: 1.20.
|
||||
* @NM_WIFI_DEVICE_CAP_IBSS_RSN: device supports WPA2/RSN in an IBSS network. Since: 1.22.
|
||||
*
|
||||
* 802.11 specific device encryption and authentication capabilities.
|
||||
**/
|
||||
|
|
@ -310,6 +311,7 @@ typedef enum { /*< flags >*/
|
|||
NM_WIFI_DEVICE_CAP_FREQ_2GHZ = 0x00000200,
|
||||
NM_WIFI_DEVICE_CAP_FREQ_5GHZ = 0x00000400,
|
||||
NM_WIFI_DEVICE_CAP_MESH = 0x00001000,
|
||||
NM_WIFI_DEVICE_CAP_IBSS_RSN = 0x00002000,
|
||||
} NMDeviceWifiCapabilities;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -849,9 +849,8 @@ need_secrets (NMSetting *setting)
|
|||
goto no_secrets;
|
||||
}
|
||||
|
||||
/* WPA-PSK infrastructure and adhoc */
|
||||
if ( (strcmp (priv->key_mgmt, "wpa-none") == 0)
|
||||
|| (strcmp (priv->key_mgmt, "wpa-psk") == 0)) {
|
||||
/* WPA-PSK infrastructure */
|
||||
if (strcmp (priv->key_mgmt, "wpa-psk") == 0) {
|
||||
if (!nm_utils_wpa_psk_valid (priv->psk)) {
|
||||
g_ptr_array_add (secrets, NM_SETTING_WIRELESS_SECURITY_PSK);
|
||||
return secrets;
|
||||
|
|
@ -899,7 +898,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
|
|||
{
|
||||
NMSettingWirelessSecurity *self = NM_SETTING_WIRELESS_SECURITY (setting);
|
||||
NMSettingWirelessSecurityPrivate *priv = NM_SETTING_WIRELESS_SECURITY_GET_PRIVATE (self);
|
||||
const char *valid_key_mgmt[] = { "none", "ieee8021x", "wpa-none", "wpa-psk", "wpa-eap", "sae", NULL };
|
||||
const char *valid_key_mgmt[] = { "none", "ieee8021x", "wpa-psk", "wpa-eap", "sae", NULL };
|
||||
const char *valid_auth_algs[] = { "open", "shared", "leap", NULL };
|
||||
const char *valid_protos[] = { "wpa", "rsn", NULL };
|
||||
const char *valid_pairwise[] = { "tkip", "ccmp", NULL };
|
||||
|
|
@ -1024,33 +1023,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
|
|||
}
|
||||
|
||||
if (priv->pairwise) {
|
||||
const char *wpa_none[] = { "wpa-none", NULL };
|
||||
|
||||
/* For ad-hoc connections, pairwise must be "none" */
|
||||
if (g_strv_contains (wpa_none, priv->key_mgmt)) {
|
||||
GSList *iter;
|
||||
gboolean found = FALSE;
|
||||
|
||||
for (iter = priv->pairwise; iter; iter = g_slist_next (iter)) {
|
||||
if (!strcmp ((char *) iter->data, "none")) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* pairwise cipher list didn't contain "none", which is invalid
|
||||
* for WPA adhoc connections.
|
||||
*/
|
||||
if (!found) {
|
||||
g_set_error (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("'%s' connections require '%s' in this property"),
|
||||
NM_SETTING_WIRELESS_MODE_ADHOC, "none");
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, NM_SETTING_WIRELESS_SECURITY_PAIRWISE);
|
||||
return FALSE;
|
||||
}
|
||||
} else if (!_nm_utils_string_slist_validate (priv->pairwise, valid_pairwise)) {
|
||||
if (!_nm_utils_string_slist_validate (priv->pairwise, valid_pairwise)) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
|
|
@ -1468,10 +1441,10 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *klass)
|
|||
/**
|
||||
* NMSettingWirelessSecurity:key-mgmt:
|
||||
*
|
||||
* Key management used for the connection. One of "none" (WEP), "ieee8021x"
|
||||
* (Dynamic WEP), "wpa-none" (Ad-Hoc WPA-PSK), "wpa-psk" (infrastructure
|
||||
* WPA-PSK), "sae" (SAE) or "wpa-eap" (WPA-Enterprise).
|
||||
* This property must be set for any Wi-Fi connection that uses security.
|
||||
* Key management used for the connection. One of "none" (WEP),
|
||||
* "ieee8021x" (Dynamic WEP), "wpa-psk" (infrastructure WPA-PSK), "sae"
|
||||
* (SAE) or "wpa-eap" (WPA-Enterprise). This property must be set for
|
||||
* any Wi-Fi connection that uses security.
|
||||
**/
|
||||
/* ---ifcfg-rh---
|
||||
* property: key-mgmt
|
||||
|
|
|
|||
|
|
@ -157,14 +157,6 @@ nm_setting_wireless_ap_security_compatible (NMSettingWireless *s_wireless,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* Adhoc WPA */
|
||||
if (!strcmp (key_mgmt, "wpa-none")) {
|
||||
if (ap_mode != NM_802_11_MODE_ADHOC)
|
||||
return FALSE;
|
||||
/* FIXME: validate ciphers if they're in the beacon */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Adhoc WPA2 (ie, RSN IBSS) */
|
||||
if (ap_mode == NM_802_11_MODE_ADHOC) {
|
||||
if (strcmp (key_mgmt, "wpa-psk"))
|
||||
|
|
|
|||
|
|
@ -1214,46 +1214,30 @@ nm_utils_security_valid (NMUtilsSecurityType type,
|
|||
break;
|
||||
case NMU_SEC_WPA_PSK:
|
||||
if (adhoc)
|
||||
return FALSE; /* FIXME: Kernel WPA Ad-Hoc support is buggy */
|
||||
return FALSE;
|
||||
if (!(wifi_caps & NM_WIFI_DEVICE_CAP_WPA))
|
||||
return FALSE;
|
||||
if (have_ap) {
|
||||
/* Ad-Hoc WPA APs won't necessarily have the PSK flag set, and
|
||||
* they don't have any pairwise ciphers. */
|
||||
if (adhoc) {
|
||||
/* coverity[dead_error_line] */
|
||||
if ( (ap_wpa & NM_802_11_AP_SEC_GROUP_TKIP)
|
||||
if (ap_wpa & NM_802_11_AP_SEC_KEY_MGMT_PSK) {
|
||||
if ( (ap_wpa & NM_802_11_AP_SEC_PAIR_TKIP)
|
||||
&& (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_TKIP))
|
||||
return TRUE;
|
||||
if ( (ap_wpa & NM_802_11_AP_SEC_GROUP_CCMP)
|
||||
if ( (ap_wpa & NM_802_11_AP_SEC_PAIR_CCMP)
|
||||
&& (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_CCMP))
|
||||
return TRUE;
|
||||
} else {
|
||||
if (ap_wpa & NM_802_11_AP_SEC_KEY_MGMT_PSK) {
|
||||
if ( (ap_wpa & NM_802_11_AP_SEC_PAIR_TKIP)
|
||||
&& (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_TKIP))
|
||||
return TRUE;
|
||||
if ( (ap_wpa & NM_802_11_AP_SEC_PAIR_CCMP)
|
||||
&& (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_CCMP))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case NMU_SEC_WPA2_PSK:
|
||||
if (adhoc)
|
||||
return FALSE; /* FIXME: Kernel WPA Ad-Hoc support is buggy */
|
||||
if (!(wifi_caps & NM_WIFI_DEVICE_CAP_RSN))
|
||||
return FALSE;
|
||||
if (have_ap) {
|
||||
/* Ad-Hoc WPA APs won't necessarily have the PSK flag set, and
|
||||
* they don't have any pairwise ciphers, nor any RSA flags yet. */
|
||||
if (adhoc) {
|
||||
/* coverity[dead_error_line] */
|
||||
if (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_TKIP)
|
||||
return TRUE;
|
||||
if (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_CCMP)
|
||||
if (!(wifi_caps & NM_WIFI_DEVICE_CAP_IBSS_RSN))
|
||||
return FALSE;
|
||||
if ( (ap_rsn & NM_802_11_AP_SEC_PAIR_CCMP)
|
||||
&& (wifi_caps & NM_WIFI_DEVICE_CAP_CIPHER_CCMP))
|
||||
return TRUE;
|
||||
} else {
|
||||
if (ap_rsn & NM_802_11_AP_SEC_KEY_MGMT_PSK) {
|
||||
|
|
@ -6084,29 +6068,3 @@ _nm_utils_bridge_vlan_verify_list (GPtrArray *vlans,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_utils_connection_is_adhoc_wpa (NMConnection *connection)
|
||||
{
|
||||
NMSettingWireless *s_wifi;
|
||||
NMSettingWirelessSecurity *s_wsec;
|
||||
const char *key_mgmt;
|
||||
const char *mode;
|
||||
|
||||
s_wifi = nm_connection_get_setting_wireless (connection);
|
||||
if (!s_wifi)
|
||||
return FALSE;
|
||||
|
||||
mode = nm_setting_wireless_get_mode (s_wifi);
|
||||
if (!nm_streq0 (mode, NM_SETTING_WIRELESS_MODE_ADHOC))
|
||||
return FALSE;
|
||||
|
||||
s_wsec = nm_connection_get_setting_wireless_security (connection);
|
||||
if (!s_wsec)
|
||||
return FALSE;
|
||||
|
||||
key_mgmt = nm_setting_wireless_security_get_key_mgmt (s_wsec);
|
||||
if (!nm_streq0 (key_mgmt, "wpa-none"))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -636,8 +636,7 @@ connection_compatible (NMDevice *device, NMConnection *connection, GError **erro
|
|||
if (s_wsec) {
|
||||
/* Connection has security, verify it against the device's capabilities */
|
||||
key_mgmt = nm_setting_wireless_security_get_key_mgmt (s_wsec);
|
||||
if ( !g_strcmp0 (key_mgmt, "wpa-none")
|
||||
|| !g_strcmp0 (key_mgmt, "wpa-psk")
|
||||
if ( !g_strcmp0 (key_mgmt, "wpa-psk")
|
||||
|| !g_strcmp0 (key_mgmt, "wpa-eap")) {
|
||||
|
||||
wifi_caps = nm_device_wifi_get_capabilities (NM_DEVICE_WIFI (device));
|
||||
|
|
|
|||
|
|
@ -644,36 +644,6 @@ deactivate_reset_hw_addr (NMDevice *device)
|
|||
_hw_addr_set_scanning ((NMDeviceWifi *) device, TRUE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_adhoc_wpa (NMConnection *connection)
|
||||
{
|
||||
NMSettingWireless *s_wifi;
|
||||
NMSettingWirelessSecurity *s_wsec;
|
||||
const char *mode, *key_mgmt;
|
||||
|
||||
/* The kernel doesn't support Ad-Hoc WPA connections well at this time,
|
||||
* and turns them into open networks. It's been this way since at least
|
||||
* 2.6.30 or so; until that's fixed, disable WPA-protected Ad-Hoc networks.
|
||||
*/
|
||||
|
||||
s_wifi = nm_connection_get_setting_wireless (connection);
|
||||
g_return_val_if_fail (s_wifi != NULL, FALSE);
|
||||
|
||||
mode = nm_setting_wireless_get_mode (s_wifi);
|
||||
if (g_strcmp0 (mode, NM_SETTING_WIRELESS_MODE_ADHOC) != 0)
|
||||
return FALSE;
|
||||
|
||||
s_wsec = nm_connection_get_setting_wireless_security (connection);
|
||||
if (!s_wsec)
|
||||
return FALSE;
|
||||
|
||||
key_mgmt = nm_setting_wireless_security_get_key_mgmt (s_wsec);
|
||||
if (g_strcmp0 (key_mgmt, "wpa-none") != 0)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
check_connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
|
||||
{
|
||||
|
|
@ -720,12 +690,6 @@ check_connection_compatible (NMDevice *device, NMConnection *connection, GError
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (is_adhoc_wpa (connection)) {
|
||||
nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
|
||||
"Ad-Hoc WPA networks are not supported");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Early exit if supplicant or device doesn't support requested mode */
|
||||
mode = nm_setting_wireless_get_mode (s_wireless);
|
||||
if (g_strcmp0 (mode, NM_SETTING_WIRELESS_MODE_ADHOC) == 0) {
|
||||
|
|
@ -953,19 +917,6 @@ complete_connection (NMDevice *device,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* The kernel doesn't support Ad-Hoc WPA connections well at this time,
|
||||
* and turns them into open networks. It's been this way since at least
|
||||
* 2.6.30 or so; until that's fixed, disable WPA-protected Ad-Hoc networks.
|
||||
*/
|
||||
if (is_adhoc_wpa (connection)) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_SETTING,
|
||||
_("WPA Ad-Hoc disabled due to kernel bugs"));
|
||||
g_prefix_error (error, "%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ssid_utf8 = _nm_utils_ssid_to_utf8 (ssid);
|
||||
nm_utils_complete_generic (nm_device_get_platform (device),
|
||||
connection,
|
||||
|
|
@ -2703,16 +2654,6 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
|||
priv->mode = NM_802_11_MODE_MESH;
|
||||
_notify (self, PROP_MODE);
|
||||
|
||||
/* The kernel doesn't support Ad-Hoc WPA connections well at this time,
|
||||
* and turns them into open networks. It's been this way since at least
|
||||
* 2.6.30 or so; until that's fixed, disable WPA-protected Ad-Hoc networks.
|
||||
*/
|
||||
if (is_adhoc_wpa (connection)) {
|
||||
_LOGW (LOGD_WIFI, "Ad-Hoc WPA disabled due to kernel bugs");
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_SUPPLICANT_CONFIG_FAILED);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
/* expire the temporary MAC address used during scanning */
|
||||
priv->hw_addr_scan_expire = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -1232,7 +1232,7 @@ nm_wifi_ap_new_fake_from_connection (NMConnection *connection)
|
|||
const char *mode, *band, *key_mgmt;
|
||||
guint32 channel;
|
||||
NM80211ApSecurityFlags flags;
|
||||
gboolean psk = FALSE, eap = FALSE;
|
||||
gboolean psk = FALSE, eap = FALSE, adhoc = FALSE;
|
||||
|
||||
g_return_val_if_fail (connection != NULL, NULL);
|
||||
|
||||
|
|
@ -1252,9 +1252,10 @@ nm_wifi_ap_new_fake_from_connection (NMConnection *connection)
|
|||
if (mode) {
|
||||
if (!strcmp (mode, "infrastructure"))
|
||||
nm_wifi_ap_set_mode (ap, NM_802_11_MODE_INFRA);
|
||||
else if (!strcmp (mode, "adhoc"))
|
||||
else if (!strcmp (mode, "adhoc")) {
|
||||
nm_wifi_ap_set_mode (ap, NM_802_11_MODE_ADHOC);
|
||||
else if (!strcmp (mode, "mesh"))
|
||||
adhoc = TRUE;
|
||||
} else if (!strcmp (mode, "mesh"))
|
||||
nm_wifi_ap_set_mode (ap, NM_802_11_MODE_MESH);
|
||||
else if (!strcmp (mode, "ap")) {
|
||||
nm_wifi_ap_set_mode (ap, NM_802_11_MODE_INFRA);
|
||||
|
|
@ -1293,7 +1294,7 @@ nm_wifi_ap_new_fake_from_connection (NMConnection *connection)
|
|||
|
||||
psk = !strcmp (key_mgmt, "wpa-psk");
|
||||
eap = !strcmp (key_mgmt, "wpa-eap");
|
||||
if (psk || eap) {
|
||||
if (!adhoc && (psk || eap)) {
|
||||
if (has_proto (s_wireless_sec, PROTO_WPA)) {
|
||||
flags = priv->wpa_flags | (eap ? NM_802_11_AP_SEC_KEY_MGMT_802_1X : NM_802_11_AP_SEC_KEY_MGMT_PSK);
|
||||
nm_wifi_ap_set_wpa_flags (ap, flags);
|
||||
|
|
@ -1305,42 +1306,27 @@ nm_wifi_ap_new_fake_from_connection (NMConnection *connection)
|
|||
|
||||
add_pair_ciphers (ap, s_wireless_sec);
|
||||
add_group_ciphers (ap, s_wireless_sec);
|
||||
} else if (!strcmp (key_mgmt, "wpa-none")) {
|
||||
guint32 i;
|
||||
|
||||
/* Ad-Hoc has special requirements: proto=WPA, pairwise=(none), and
|
||||
* group=TKIP/CCMP (but not both).
|
||||
} else if (adhoc && psk) {
|
||||
/* Ad-Hoc has special requirements: proto=RSN, pairwise=CCMP and
|
||||
* group=CCMP.
|
||||
*/
|
||||
|
||||
flags = priv->wpa_flags | NM_802_11_AP_SEC_KEY_MGMT_PSK;
|
||||
|
||||
/* Clear ciphers; pairwise must be unset anyway, and group gets set below */
|
||||
/* Clear ciphers; only CCMP is supported */
|
||||
flags &= ~( NM_802_11_AP_SEC_PAIR_WEP40
|
||||
| NM_802_11_AP_SEC_PAIR_WEP104
|
||||
| NM_802_11_AP_SEC_PAIR_TKIP
|
||||
| NM_802_11_AP_SEC_PAIR_CCMP
|
||||
| NM_802_11_AP_SEC_GROUP_WEP40
|
||||
| NM_802_11_AP_SEC_GROUP_WEP104
|
||||
| NM_802_11_AP_SEC_GROUP_TKIP
|
||||
| NM_802_11_AP_SEC_GROUP_CCMP);
|
||||
| NM_802_11_AP_SEC_GROUP_TKIP);
|
||||
|
||||
for (i = 0; i < nm_setting_wireless_security_get_num_groups (s_wireless_sec); i++) {
|
||||
if (!strcmp (nm_setting_wireless_security_get_group (s_wireless_sec, i), "ccmp")) {
|
||||
flags |= NM_802_11_AP_SEC_GROUP_CCMP;
|
||||
break;
|
||||
}
|
||||
}
|
||||
flags |= NM_802_11_AP_SEC_PAIR_CCMP;
|
||||
flags |= NM_802_11_AP_SEC_GROUP_CCMP;
|
||||
nm_wifi_ap_set_rsn_flags (ap, flags);
|
||||
|
||||
/* Default to TKIP since not all WPA-capable cards can do CCMP */
|
||||
if (!(flags & NM_802_11_AP_SEC_GROUP_CCMP))
|
||||
flags |= NM_802_11_AP_SEC_GROUP_TKIP;
|
||||
|
||||
nm_wifi_ap_set_wpa_flags (ap, flags);
|
||||
|
||||
/* Don't use Ad-Hoc RSN yet */
|
||||
nm_wifi_ap_set_rsn_flags (ap, NM_802_11_AP_SEC_NONE);
|
||||
/* Don't use Ad-Hoc WPA (WPA-none) anymore */
|
||||
nm_wifi_ap_set_wpa_flags (ap, NM_802_11_AP_SEC_NONE);
|
||||
}
|
||||
|
||||
done:
|
||||
return ap;
|
||||
|
||||
|
|
|
|||
|
|
@ -297,96 +297,79 @@ verify_wpa_psk (NMSettingWirelessSecurity *s_wsec,
|
|||
guint32 rsn_flags,
|
||||
GError **error)
|
||||
{
|
||||
const char *key_mgmt, *auth_alg, *tmp;
|
||||
int n;
|
||||
const char *key_mgmt, *auth_alg;
|
||||
|
||||
key_mgmt = nm_setting_wireless_security_get_key_mgmt (s_wsec);
|
||||
auth_alg = nm_setting_wireless_security_get_auth_alg (s_wsec);
|
||||
|
||||
if (key_mgmt) {
|
||||
if (!strcmp (key_mgmt, "wpa-psk") || !strcmp (key_mgmt, "wpa-none")) {
|
||||
if (s_8021x) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_SETTING,
|
||||
_("WPA-PSK authentication is incompatible with 802.1x"));
|
||||
g_prefix_error (error, "%s: ", NM_SETTING_802_1X_SETTING_NAME);
|
||||
return FALSE;
|
||||
}
|
||||
if (!nm_streq0 (key_mgmt, "wpa-psk"))
|
||||
return TRUE;
|
||||
|
||||
if (auth_alg && strcmp (auth_alg, "open")) {
|
||||
/* WPA must use "open" authentication */
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("WPA-PSK requires 'open' authentication"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
||||
NM_SETTING_WIRELESS_SECURITY_AUTH_ALG);
|
||||
return FALSE;
|
||||
}
|
||||
if (s_8021x) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_SETTING,
|
||||
_("WPA-PSK authentication is incompatible with 802.1x"));
|
||||
g_prefix_error (error, "%s: ", NM_SETTING_802_1X_SETTING_NAME);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (auth_alg && !nm_streq (auth_alg, "open")) {
|
||||
/* WPA must use "open" authentication */
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("WPA-PSK requires 'open' authentication"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
||||
NM_SETTING_WIRELESS_SECURITY_AUTH_ALG);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Make sure the AP's capabilities support WPA-PSK */
|
||||
if ( !(wpa_flags & NM_802_11_AP_SEC_KEY_MGMT_PSK)
|
||||
&& !(rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_PSK)) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("Access point does not support PSK but setting requires it"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
||||
NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (adhoc) {
|
||||
/* Ad-Hoc RSN requires 'rsn' proto, 'ccmp' pairwise, and 'ccmp' group */
|
||||
if ( nm_setting_wireless_security_get_num_protos (s_wsec) != 1
|
||||
|| !nm_streq0 (nm_setting_wireless_security_get_proto (s_wsec, 0), "rsn")) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("WPA Ad-Hoc authentication requires 'rsn' protocol"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
||||
NM_SETTING_WIRELESS_SECURITY_PROTO);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!strcmp (key_mgmt, "wpa-none")) {
|
||||
if (!adhoc) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("WPA Ad-Hoc authentication requires an Ad-Hoc mode AP"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SETTING_NAME,
|
||||
NM_SETTING_WIRELESS_MODE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Ad-Hoc WPA requires 'wpa' proto, 'none' pairwise, and 'tkip' group */
|
||||
n = nm_setting_wireless_security_get_num_protos (s_wsec);
|
||||
tmp = (n > 0) ? nm_setting_wireless_security_get_proto (s_wsec, 0) : NULL;
|
||||
if (n > 1 || !tmp || strcmp (tmp, "wpa")) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("WPA Ad-Hoc authentication requires 'wpa' protocol"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
||||
NM_SETTING_WIRELESS_SECURITY_PROTO);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
n = nm_setting_wireless_security_get_num_pairwise (s_wsec);
|
||||
tmp = (n > 0) ? nm_setting_wireless_security_get_pairwise (s_wsec, 0) : NULL;
|
||||
if (n > 1 || g_strcmp0 (tmp, "none")) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("WPA Ad-Hoc authentication requires 'none' pairwise cipher"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
||||
NM_SETTING_WIRELESS_SECURITY_PAIRWISE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
n = nm_setting_wireless_security_get_num_groups (s_wsec);
|
||||
tmp = (n > 0) ? nm_setting_wireless_security_get_group (s_wsec, 0) : NULL;
|
||||
if (n > 1 || !tmp || strcmp (tmp, "tkip")) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("WPA Ad-Hoc requires 'tkip' group cipher"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
||||
NM_SETTING_WIRELESS_SECURITY_GROUP);
|
||||
return FALSE;
|
||||
}
|
||||
if ( nm_setting_wireless_security_get_num_pairwise (s_wsec) != 1
|
||||
|| !nm_streq0 (nm_setting_wireless_security_get_pairwise (s_wsec, 0), "ccmp")) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("WPA Ad-Hoc authentication requires 'ccmp' pairwise cipher"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
||||
NM_SETTING_WIRELESS_SECURITY_PAIRWISE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!strcmp (key_mgmt, "wpa-psk")) {
|
||||
/* Make sure the AP's capabilities support WPA-PSK */
|
||||
if ( !(wpa_flags & NM_802_11_AP_SEC_KEY_MGMT_PSK)
|
||||
&& !(rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_PSK)) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("Access point does not support PSK but setting requires it"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
||||
NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
|
||||
return FALSE;
|
||||
}
|
||||
if ( nm_setting_wireless_security_get_num_groups (s_wsec) != 1
|
||||
|| !nm_streq0 (nm_setting_wireless_security_get_group (s_wsec, 0), "ccmp")) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("WPA Ad-Hoc requires 'ccmp' group cipher"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
||||
NM_SETTING_WIRELESS_SECURITY_GROUP);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -463,61 +446,52 @@ verify_adhoc (NMSettingWirelessSecurity *s_wsec,
|
|||
{
|
||||
const char *key_mgmt = NULL, *leap_username = NULL, *auth_alg = NULL;
|
||||
|
||||
if (!adhoc)
|
||||
return TRUE;
|
||||
|
||||
if (s_wsec) {
|
||||
key_mgmt = nm_setting_wireless_security_get_key_mgmt (s_wsec);
|
||||
auth_alg = nm_setting_wireless_security_get_auth_alg (s_wsec);
|
||||
leap_username = nm_setting_wireless_security_get_leap_username (s_wsec);
|
||||
}
|
||||
|
||||
if (adhoc) {
|
||||
if (key_mgmt && strcmp (key_mgmt, "wpa-none") && strcmp (key_mgmt, "none")) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("Access point mode is Ad-Hoc but setting requires Infrastructure security"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
||||
NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
|
||||
return FALSE;
|
||||
}
|
||||
if (key_mgmt && !NM_IN_STRSET (key_mgmt, "none", "wpa-psk")) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("Ad-Hoc mode requires 'none' or 'wpa-psk' key management"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
||||
NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (s_8021x) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_SETTING,
|
||||
_("Ad-Hoc mode is incompatible with 802.1x security"));
|
||||
g_prefix_error (error, "%s: ", NM_SETTING_802_1X_SETTING_NAME);
|
||||
return FALSE;
|
||||
}
|
||||
if (s_8021x) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_SETTING,
|
||||
_("Ad-Hoc mode is incompatible with 802.1x security"));
|
||||
g_prefix_error (error, "%s: ", NM_SETTING_802_1X_SETTING_NAME);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (leap_username) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("Ad-Hoc mode is incompatible with LEAP security"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
||||
NM_SETTING_WIRELESS_SECURITY_AUTH_ALG);
|
||||
return FALSE;
|
||||
}
|
||||
if (leap_username) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("Ad-Hoc mode is incompatible with LEAP security"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
||||
NM_SETTING_WIRELESS_SECURITY_AUTH_ALG);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (auth_alg && strcmp (auth_alg, "open")) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("Ad-Hoc mode requires 'open' authentication"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
||||
NM_SETTING_WIRELESS_SECURITY_AUTH_ALG);
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
if (key_mgmt && !strcmp (key_mgmt, "wpa-none")) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("Access point mode is Infrastructure but setting requires Ad-Hoc security"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
||||
NM_SETTING_WIRELESS_SECURITY_KEY_MGMT);
|
||||
return FALSE;
|
||||
}
|
||||
if (auth_alg && !nm_streq (auth_alg, "open")) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("Ad-Hoc mode requires 'open' authentication"));
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
|
||||
NM_SETTING_WIRELESS_SECURITY_AUTH_ALG);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
@ -773,11 +747,13 @@ nm_wifi_utils_complete_connection (GBytes *ap_ssid,
|
|||
return FALSE;
|
||||
|
||||
if (adhoc) {
|
||||
g_object_set (s_wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-none", NULL);
|
||||
/* Ad-Hoc does not support RSN/WPA2 */
|
||||
nm_setting_wireless_security_add_proto (s_wsec, "wpa");
|
||||
nm_setting_wireless_security_add_pairwise (s_wsec, "none");
|
||||
nm_setting_wireless_security_add_group (s_wsec, "tkip");
|
||||
g_object_set (s_wsec,
|
||||
NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk",
|
||||
NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "open",
|
||||
NULL);
|
||||
nm_setting_wireless_security_add_proto (s_wsec, "rsn");
|
||||
nm_setting_wireless_security_add_pairwise (s_wsec, "ccmp");
|
||||
nm_setting_wireless_security_add_group (s_wsec, "ccmp");
|
||||
} else if (s_8021x) {
|
||||
g_object_set (s_wsec,
|
||||
NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-eap",
|
||||
|
|
|
|||
|
|
@ -907,6 +907,9 @@ static int nl80211_wiphy_info_handler (struct nl_msg *msg, void *arg)
|
|||
if (tb[NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED])
|
||||
info->can_wowlan = TRUE;
|
||||
|
||||
if (tb[NL80211_ATTR_SUPPORT_IBSS_RSN])
|
||||
info->caps |= NM_WIFI_DEVICE_CAP_IBSS_RSN;
|
||||
|
||||
info->success = TRUE;
|
||||
|
||||
return NL_SKIP;
|
||||
|
|
|
|||
|
|
@ -2487,17 +2487,6 @@ nm_settings_add_connection_dbus (NMSettings *self,
|
|||
goto done;
|
||||
}
|
||||
|
||||
/* FIXME: The kernel doesn't support Ad-Hoc WPA connections well at this time,
|
||||
* and turns them into open networks. It's been this way since at least
|
||||
* 2.6.30 or so; until that's fixed, disable WPA-protected Ad-Hoc networks.
|
||||
*/
|
||||
if (nm_utils_connection_is_adhoc_wpa (connection)) {
|
||||
error = g_error_new_literal (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_INVALID_CONNECTION,
|
||||
"WPA Ad-Hoc disabled due to kernel bugs");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!nm_auth_is_subject_in_acl_set_error (connection,
|
||||
subject,
|
||||
NM_SETTINGS_ERROR,
|
||||
|
|
|
|||
|
|
@ -2954,22 +2954,6 @@ fill_wpa_ciphers (shvarFile *ifcfg,
|
|||
|
||||
list = nm_utils_strsplit_set (p, " ");
|
||||
for (iter = list; iter && *iter; iter++, i++) {
|
||||
/* Ad-Hoc configurations cannot have pairwise ciphers, and can only
|
||||
* have one group cipher. Ignore any additional group ciphers and
|
||||
* any pairwise ciphers specified.
|
||||
*/
|
||||
if (adhoc) {
|
||||
if (group && (i > 0)) {
|
||||
PARSE_WARNING ("ignoring group cipher '%s' (only one group cipher allowed "
|
||||
"in Ad-Hoc mode)", *iter);
|
||||
continue;
|
||||
} else if (!group) {
|
||||
PARSE_WARNING ("ignoring pairwise cipher '%s' (pairwise not used "
|
||||
"in Ad-Hoc mode)", *iter);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcmp (*iter, "CCMP")) {
|
||||
if (group)
|
||||
nm_setting_wireless_security_add_group (wsec, "ccmp");
|
||||
|
|
@ -3644,8 +3628,8 @@ make_wpa_setting (shvarFile *ifcfg,
|
|||
|
||||
/* WPA and/or RSN */
|
||||
if (adhoc) {
|
||||
/* Ad-Hoc mode only supports WPA proto for now */
|
||||
nm_setting_wireless_security_add_proto (wsec, "wpa");
|
||||
/* Ad-Hoc mode only supports RSN proto */
|
||||
nm_setting_wireless_security_add_proto (wsec, "rsn");
|
||||
} else {
|
||||
gs_free char *value2 = NULL;
|
||||
const char *v2;
|
||||
|
|
@ -3679,9 +3663,7 @@ make_wpa_setting (shvarFile *ifcfg,
|
|||
}
|
||||
}
|
||||
|
||||
if (adhoc)
|
||||
g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-none", NULL);
|
||||
else if (wpa_psk)
|
||||
if (wpa_psk)
|
||||
g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk", NULL);
|
||||
else {
|
||||
nm_assert (wpa_sae);
|
||||
|
|
|
|||
|
|
@ -583,7 +583,7 @@ write_wireless_security_setting (NMConnection *connection,
|
|||
svUnsetValue (ifcfg, "KEY_MGMT");
|
||||
wep = TRUE;
|
||||
*no_8021x = TRUE;
|
||||
} else if (!strcmp (key_mgmt, "wpa-none") || !strcmp (key_mgmt, "wpa-psk")) {
|
||||
} else if (!strcmp (key_mgmt, "wpa-psk")) {
|
||||
svSetValueStr (ifcfg, "KEY_MGMT", "WPA-PSK");
|
||||
wpa = TRUE;
|
||||
*no_8021x = TRUE;
|
||||
|
|
|
|||
|
|
@ -12,5 +12,6 @@ USERCTL=yes
|
|||
PEERDNS=yes
|
||||
IPV6INIT=no
|
||||
CIPHER_GROUP=CCMP
|
||||
CIPHER_PAIRWISE=CCMP
|
||||
KEY_MGMT=WPA-PSK
|
||||
|
||||
|
|
|
|||
|
|
@ -3133,17 +3133,17 @@ test_read_wifi_wpa_psk_adhoc (void)
|
|||
|
||||
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), ==, "wpa-none");
|
||||
g_assert_cmpstr (nm_setting_wireless_security_get_key_mgmt (s_wsec), ==, "wpa-psk");
|
||||
g_assert_cmpstr (nm_setting_wireless_security_get_psk (s_wsec), ==, "I wonder what the king is doing tonight?");
|
||||
|
||||
/* Pairwise cipher is unused in adhoc mode */
|
||||
g_assert_cmpint (nm_setting_wireless_security_get_num_pairwise (s_wsec), ==, 0);
|
||||
g_assert_cmpint (nm_setting_wireless_security_get_num_pairwise (s_wsec), ==, 1);
|
||||
g_assert_cmpstr (nm_setting_wireless_security_get_pairwise (s_wsec, 0), ==, "ccmp");
|
||||
|
||||
g_assert_cmpint (nm_setting_wireless_security_get_num_groups (s_wsec), ==, 1);
|
||||
g_assert_cmpstr (nm_setting_wireless_security_get_group (s_wsec, 0), ==, "ccmp");
|
||||
|
||||
g_assert_cmpint (nm_setting_wireless_security_get_num_protos (s_wsec), ==, 1);
|
||||
g_assert_cmpstr (nm_setting_wireless_security_get_proto (s_wsec, 0), ==, "wpa");
|
||||
g_assert_cmpstr (nm_setting_wireless_security_get_proto (s_wsec, 0), ==, "rsn");
|
||||
|
||||
/* ===== IPv4 SETTING ===== */
|
||||
|
||||
|
|
@ -6460,12 +6460,13 @@ test_write_wifi_wpa_psk_adhoc (void)
|
|||
nm_connection_add_setting (connection, NM_SETTING (s_wsec));
|
||||
|
||||
g_object_set (s_wsec,
|
||||
NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-none",
|
||||
NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk",
|
||||
NM_SETTING_WIRELESS_SECURITY_PSK, "7d308b11df1b4243b0f78e5f3fc68cdbb9a264ed0edf4c188edf329ff5b467f0",
|
||||
NULL);
|
||||
|
||||
nm_setting_wireless_security_add_proto (s_wsec, "wpa");
|
||||
nm_setting_wireless_security_add_group (s_wsec, "tkip");
|
||||
nm_setting_wireless_security_add_proto (s_wsec, "rsn");
|
||||
nm_setting_wireless_security_add_pairwise (s_wsec, "ccmp");
|
||||
nm_setting_wireless_security_add_group (s_wsec, "ccmp");
|
||||
|
||||
/* IP4 setting */
|
||||
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
|
||||
|
|
|
|||
|
|
@ -897,8 +897,7 @@ nm_supplicant_config_add_setting_wireless_security (NMSupplicantConfig *self,
|
|||
}
|
||||
|
||||
/* Only WPA-specific things when using WPA */
|
||||
if ( !strcmp (key_mgmt, "wpa-none")
|
||||
|| !strcmp (key_mgmt, "wpa-psk")
|
||||
if ( !strcmp (key_mgmt, "wpa-psk")
|
||||
|| !strcmp (key_mgmt, "wpa-eap")
|
||||
|| !strcmp (key_mgmt, "sae")) {
|
||||
if (!ADD_STRING_LIST_VAL (self, setting, wireless_security, proto, protos, "proto", ' ', TRUE, NULL, error))
|
||||
|
|
@ -909,7 +908,6 @@ nm_supplicant_config_add_setting_wireless_security (NMSupplicantConfig *self,
|
|||
return FALSE;
|
||||
|
||||
if ( set_pmf
|
||||
&& !nm_streq (key_mgmt, "wpa-none")
|
||||
&& NM_IN_SET (pmf,
|
||||
NM_SETTING_WIRELESS_SECURITY_PMF_DISABLE,
|
||||
NM_SETTING_WIRELESS_SECURITY_PMF_REQUIRED)) {
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ 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",
|
||||
"IEEE8021X", "WPA-NONE", "SAE",
|
||||
"IEEE8021X", "SAE",
|
||||
"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",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue