supplicant: update whether EAP-FAST is supported for existing supplicant-interface

As the fast-supported flag changes, update the existing supplicant
interfaces with the new information.

Also, by default assume it is supported.
This commit is contained in:
Thomas Haller
2017-01-18 17:41:12 +01:00
parent 66ff601ecf
commit 872b9ec5ea
3 changed files with 45 additions and 24 deletions

View File

@@ -57,15 +57,15 @@ NM_GOBJECT_PROPERTIES_DEFINE (NMSupplicantInterface,
PROP_SCANNING, PROP_SCANNING,
PROP_CURRENT_BSS, PROP_CURRENT_BSS,
PROP_DRIVER, PROP_DRIVER,
PROP_FAST_SUPPORTED, PROP_FAST_SUPPORT,
PROP_AP_SUPPORT, PROP_AP_SUPPORT,
); );
typedef struct { typedef struct {
char * dev; char * dev;
NMSupplicantDriver driver; NMSupplicantDriver driver;
bool fast_supported;
gboolean has_credreq; /* Whether querying 802.1x credentials is supported */ gboolean has_credreq; /* Whether querying 802.1x credentials is supported */
NMSupplicantFeature fast_support;
NMSupplicantFeature ap_support; /* Lightweight AP mode support */ NMSupplicantFeature ap_support; /* Lightweight AP mode support */
NMSupplicantFeature mac_randomization_support; NMSupplicantFeature mac_randomization_support;
guint32 max_scan_ssids; guint32 max_scan_ssids;
@@ -510,6 +510,15 @@ nm_supplicant_interface_set_ap_support (NMSupplicantInterface *self,
priv->ap_support = ap_support; priv->ap_support = ap_support;
} }
void
nm_supplicant_interface_set_fast_support (NMSupplicantInterface *self,
NMSupplicantFeature fast_support)
{
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self);
priv->fast_support = fast_support;
}
static void static void
set_preassoc_scan_mac_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) set_preassoc_scan_mac_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data)
{ {
@@ -1302,7 +1311,8 @@ nm_supplicant_interface_set_config (NMSupplicantInterface *self,
/* Make sure the supplicant supports EAP-FAST before trying to send /* Make sure the supplicant supports EAP-FAST before trying to send
* it an EAP-FAST configuration. * it an EAP-FAST configuration.
*/ */
if (nm_supplicant_config_fast_required (cfg) && !priv->fast_supported) { if ( priv->fast_support == NM_SUPPLICANT_FEATURE_NO
&& nm_supplicant_config_fast_required (cfg)) {
g_set_error (error, NM_SUPPLICANT_ERROR, NM_SUPPLICANT_ERROR_CONFIG, g_set_error (error, NM_SUPPLICANT_ERROR, NM_SUPPLICANT_ERROR_CONFIG,
"EAP-FAST is not supported by the supplicant"); "EAP-FAST is not supported by the supplicant");
return FALSE; return FALSE;
@@ -1464,7 +1474,7 @@ nm_supplicant_interface_get_max_scan_ssids (NMSupplicantInterface *self)
NMSupplicantInterface * NMSupplicantInterface *
nm_supplicant_interface_new (const char *ifname, nm_supplicant_interface_new (const char *ifname,
NMSupplicantDriver driver, NMSupplicantDriver driver,
gboolean fast_supported, NMSupplicantFeature fast_support,
NMSupplicantFeature ap_support) NMSupplicantFeature ap_support)
{ {
g_return_val_if_fail (ifname != NULL, NULL); g_return_val_if_fail (ifname != NULL, NULL);
@@ -1472,7 +1482,7 @@ nm_supplicant_interface_new (const char *ifname,
return g_object_new (NM_TYPE_SUPPLICANT_INTERFACE, return g_object_new (NM_TYPE_SUPPLICANT_INTERFACE,
NM_SUPPLICANT_INTERFACE_IFACE, ifname, NM_SUPPLICANT_INTERFACE_IFACE, ifname,
NM_SUPPLICANT_INTERFACE_DRIVER, (guint) driver, NM_SUPPLICANT_INTERFACE_DRIVER, (guint) driver,
NM_SUPPLICANT_INTERFACE_FAST_SUPPORTED, fast_supported, NM_SUPPLICANT_INTERFACE_FAST_SUPPORT, (int) fast_support,
NM_SUPPLICANT_INTERFACE_AP_SUPPORT, (int) ap_support, NM_SUPPLICANT_INTERFACE_AP_SUPPORT, (int) ap_support,
NULL); NULL);
} }
@@ -1504,9 +1514,9 @@ set_property (GObject *object,
/* construct-only */ /* construct-only */
priv->driver = g_value_get_uint (value); priv->driver = g_value_get_uint (value);
break; break;
case PROP_FAST_SUPPORTED: case PROP_FAST_SUPPORT:
/* construct-only */ /* construct-only */
priv->fast_supported = g_value_get_boolean (value); priv->fast_support = g_value_get_int (value);
break; break;
case PROP_AP_SUPPORT: case PROP_AP_SUPPORT:
/* construct-only */ /* construct-only */
@@ -1597,12 +1607,14 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass)
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS); G_PARAM_STATIC_STRINGS);
obj_properties[PROP_FAST_SUPPORTED] = obj_properties[PROP_FAST_SUPPORT] =
g_param_spec_boolean (NM_SUPPLICANT_INTERFACE_FAST_SUPPORTED, "", "", g_param_spec_int (NM_SUPPLICANT_INTERFACE_FAST_SUPPORT, "", "",
TRUE, NM_SUPPLICANT_FEATURE_UNKNOWN,
G_PARAM_WRITABLE | NM_SUPPLICANT_FEATURE_YES,
G_PARAM_CONSTRUCT_ONLY | NM_SUPPLICANT_FEATURE_UNKNOWN,
G_PARAM_STATIC_STRINGS); G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_properties[PROP_AP_SUPPORT] = obj_properties[PROP_AP_SUPPORT] =
g_param_spec_int (NM_SUPPLICANT_INTERFACE_AP_SUPPORT, "", "", g_param_spec_int (NM_SUPPLICANT_INTERFACE_AP_SUPPORT, "", "",
NM_SUPPLICANT_FEATURE_UNKNOWN, NM_SUPPLICANT_FEATURE_UNKNOWN,

View File

@@ -19,8 +19,8 @@
* Copyright (C) 2007 - 2008 Novell, Inc. * Copyright (C) 2007 - 2008 Novell, Inc.
*/ */
#ifndef __NETWORKMANAGER_SUPPLICANT_INTERFACE_H__ #ifndef __NM_SUPPLICANT_INTERFACE_H__
#define __NETWORKMANAGER_SUPPLICANT_INTERFACE_H__ #define __NM_SUPPLICANT_INTERFACE_H__
#include "nm-supplicant-types.h" #include "nm-supplicant-types.h"
@@ -58,7 +58,7 @@ enum {
#define NM_SUPPLICANT_INTERFACE_SCANNING "scanning" #define NM_SUPPLICANT_INTERFACE_SCANNING "scanning"
#define NM_SUPPLICANT_INTERFACE_CURRENT_BSS "current-bss" #define NM_SUPPLICANT_INTERFACE_CURRENT_BSS "current-bss"
#define NM_SUPPLICANT_INTERFACE_DRIVER "driver" #define NM_SUPPLICANT_INTERFACE_DRIVER "driver"
#define NM_SUPPLICANT_INTERFACE_FAST_SUPPORTED "fast-supported" #define NM_SUPPLICANT_INTERFACE_FAST_SUPPORT "fast-support"
#define NM_SUPPLICANT_INTERFACE_AP_SUPPORT "ap-support" #define NM_SUPPLICANT_INTERFACE_AP_SUPPORT "ap-support"
/* Signals */ /* Signals */
@@ -77,7 +77,7 @@ GType nm_supplicant_interface_get_type (void);
NMSupplicantInterface * nm_supplicant_interface_new (const char *ifname, NMSupplicantInterface * nm_supplicant_interface_new (const char *ifname,
NMSupplicantDriver driver, NMSupplicantDriver driver,
gboolean fast_supported, NMSupplicantFeature fast_support,
NMSupplicantFeature ap_support); NMSupplicantFeature ap_support);
void nm_supplicant_interface_set_supplicant_available (NMSupplicantInterface *self, void nm_supplicant_interface_set_supplicant_available (NMSupplicantInterface *self,
@@ -119,4 +119,7 @@ NMSupplicantFeature nm_supplicant_interface_get_ap_support (NMSupplicantInterfac
void nm_supplicant_interface_set_ap_support (NMSupplicantInterface *self, void nm_supplicant_interface_set_ap_support (NMSupplicantInterface *self,
NMSupplicantFeature apmode); NMSupplicantFeature apmode);
#endif /* NM_SUPPLICANT_INTERFACE_H */ void nm_supplicant_interface_set_fast_support (NMSupplicantInterface *self,
NMSupplicantFeature fast_support);
#endif /* __NM_SUPPLICANT_INTERFACE_H__ */

View File

@@ -37,7 +37,7 @@ typedef struct {
gboolean running; gboolean running;
GSList *ifaces; GSList *ifaces;
gboolean fast_supported; NMSupplicantFeature fast_support;
NMSupplicantFeature ap_support; NMSupplicantFeature ap_support;
guint die_count_reset_id; guint die_count_reset_id;
guint die_count; guint die_count;
@@ -158,7 +158,7 @@ nm_supplicant_manager_create_interface (NMSupplicantManager *self,
iface = nm_supplicant_interface_new (ifname, iface = nm_supplicant_interface_new (ifname,
driver, driver,
priv->fast_supported, priv->fast_support,
priv->ap_support); priv->ap_support);
priv->ifaces = g_slist_prepend (priv->ifaces, iface); priv->ifaces = g_slist_prepend (priv->ifaces, iface);
@@ -217,7 +217,7 @@ update_capabilities (NMSupplicantManager *self)
(priv->ap_support == NM_SUPPLICANT_FEATURE_NO) ? "not " : "possibly "); (priv->ap_support == NM_SUPPLICANT_FEATURE_NO) ? "not " : "possibly ");
/* EAP-FAST */ /* EAP-FAST */
priv->fast_supported = FALSE; priv->fast_support = NM_SUPPLICANT_FEATURE_NO;
value = g_dbus_proxy_get_cached_property (priv->proxy, "EapMethods"); value = g_dbus_proxy_get_cached_property (priv->proxy, "EapMethods");
if (value) { if (value) {
if (g_variant_is_of_type (value, G_VARIANT_TYPE_STRING_ARRAY)) { if (g_variant_is_of_type (value, G_VARIANT_TYPE_STRING_ARRAY)) {
@@ -227,7 +227,7 @@ update_capabilities (NMSupplicantManager *self)
for (a = array; *a; a++) { for (a = array; *a; a++) {
if (g_ascii_strcasecmp (*a, "FAST") == 0) { if (g_ascii_strcasecmp (*a, "FAST") == 0) {
priv->fast_supported = TRUE; priv->fast_support = NM_SUPPLICANT_FEATURE_YES;
break; break;
} }
} }
@@ -237,7 +237,12 @@ update_capabilities (NMSupplicantManager *self)
g_variant_unref (value); g_variant_unref (value);
} }
_LOGD ("EAP-FAST is %ssupported", priv->fast_supported ? "" : "not "); for (ifaces = priv->ifaces; ifaces; ifaces = ifaces->next)
nm_supplicant_interface_set_fast_support (ifaces->data, priv->fast_support);
_LOGD ("EAP-FAST is %ssupported",
(priv->fast_support == NM_SUPPLICANT_FEATURE_YES) ? "" :
(priv->fast_support == NM_SUPPLICANT_FEATURE_NO) ? "not " : "possibly ");
} }
static void static void
@@ -332,7 +337,8 @@ name_owner_cb (GDBusProxy *proxy, GParamSpec *pspec, gpointer user_data)
set_running (self, FALSE); set_running (self, FALSE);
priv->fast_supported = FALSE; priv->ap_support = NM_SUPPLICANT_FEATURE_UNKNOWN;
priv->fast_support = NM_SUPPLICANT_FEATURE_UNKNOWN;
} }
g_free (owner); g_free (owner);