about summary refs log tree commit diff
path: root/src/supplicant
diff options
context:
space:
mode:
Diffstat (limited to 'src/supplicant')
-rw-r--r--src/supplicant/nm-supplicant-interface.c38
-rw-r--r--src/supplicant/nm-supplicant-interface.h13
-rw-r--r--src/supplicant/nm-supplicant-manager.c30
3 files changed, 54 insertions, 27 deletions
diff --git a/src/supplicant/nm-supplicant-interface.c b/src/supplicant/nm-supplicant-interface.c
index 6fc85535..deaac779 100644
--- a/src/supplicant/nm-supplicant-interface.c
+++ b/src/supplicant/nm-supplicant-interface.c
@@ -57,15 +57,15 @@ NM_GOBJECT_PROPERTIES_DEFINE (NMSupplicantInterface,
 	PROP_SCANNING,
 	PROP_CURRENT_BSS,
 	PROP_DRIVER,
-	PROP_FAST_SUPPORTED,
+	PROP_FAST_SUPPORT,
 	PROP_AP_SUPPORT,
 );
 
 typedef struct {
 	char *         dev;
 	NMSupplicantDriver driver;
-	bool           fast_supported;
 	gboolean       has_credreq;  /* Whether querying 802.1x credentials is supported */
+	NMSupplicantFeature fast_support;
 	NMSupplicantFeature ap_support;   /* Lightweight AP mode support */
 	NMSupplicantFeature mac_randomization_support;
 	guint32        max_scan_ssids;
@@ -510,6 +510,15 @@ nm_supplicant_interface_set_ap_support (NMSupplicantInterface *self,
 		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
 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
 	 * 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,
 		             "EAP-FAST is not supported by the supplicant");
 		return FALSE;
@@ -1464,7 +1474,7 @@ nm_supplicant_interface_get_max_scan_ssids (NMSupplicantInterface *self)
 NMSupplicantInterface *
 nm_supplicant_interface_new (const char *ifname,
                              NMSupplicantDriver driver,
-                             gboolean fast_supported,
+                             NMSupplicantFeature fast_support,
                              NMSupplicantFeature ap_support)
 {
 	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,
 	                     NM_SUPPLICANT_INTERFACE_IFACE, ifname,
 	                     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,
 	                     NULL);
 }
@@ -1504,9 +1514,9 @@ set_property (GObject *object,
 		/* construct-only */
 		priv->driver = g_value_get_uint (value);
 		break;
-	case PROP_FAST_SUPPORTED:
+	case PROP_FAST_SUPPORT:
 		/* construct-only */
-		priv->fast_supported = g_value_get_boolean (value);
+		priv->fast_support = g_value_get_int (value);
 		break;
 	case PROP_AP_SUPPORT:
 		/* construct-only */
@@ -1597,12 +1607,14 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass)
 	                       G_PARAM_WRITABLE |
 	                       G_PARAM_CONSTRUCT_ONLY |
 	                       G_PARAM_STATIC_STRINGS);
-	obj_properties[PROP_FAST_SUPPORTED] =
-	    g_param_spec_boolean (NM_SUPPLICANT_INTERFACE_FAST_SUPPORTED, "", "",
-	                          TRUE,
-	                          G_PARAM_WRITABLE |
-	                          G_PARAM_CONSTRUCT_ONLY |
-	                          G_PARAM_STATIC_STRINGS);
+	obj_properties[PROP_FAST_SUPPORT] =
+	    g_param_spec_int (NM_SUPPLICANT_INTERFACE_FAST_SUPPORT, "", "",
+	                      NM_SUPPLICANT_FEATURE_UNKNOWN,
+	                      NM_SUPPLICANT_FEATURE_YES,
+	                      NM_SUPPLICANT_FEATURE_UNKNOWN,
+	                      G_PARAM_WRITABLE |
+	                      G_PARAM_CONSTRUCT_ONLY |
+	                      G_PARAM_STATIC_STRINGS);
 	obj_properties[PROP_AP_SUPPORT] =
 	    g_param_spec_int (NM_SUPPLICANT_INTERFACE_AP_SUPPORT, "", "",
 	                      NM_SUPPLICANT_FEATURE_UNKNOWN,
diff --git a/src/supplicant/nm-supplicant-interface.h b/src/supplicant/nm-supplicant-interface.h
index 5ab66d5d..2ef63d1e 100644
--- a/src/supplicant/nm-supplicant-interface.h
+++ b/src/supplicant/nm-supplicant-interface.h
@@ -19,8 +19,8 @@
  * Copyright (C) 2007 - 2008 Novell, Inc.
  */
 
-#ifndef __NETWORKMANAGER_SUPPLICANT_INTERFACE_H__
-#define __NETWORKMANAGER_SUPPLICANT_INTERFACE_H__
+#ifndef __NM_SUPPLICANT_INTERFACE_H__
+#define __NM_SUPPLICANT_INTERFACE_H__
 
 #include "nm-supplicant-types.h"
 
@@ -58,7 +58,7 @@ enum {
 #define NM_SUPPLICANT_INTERFACE_SCANNING         "scanning"
 #define NM_SUPPLICANT_INTERFACE_CURRENT_BSS      "current-bss"
 #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"
 
 /* Signals */
@@ -77,7 +77,7 @@ GType nm_supplicant_interface_get_type (void);
 
 NMSupplicantInterface * nm_supplicant_interface_new (const char *ifname,
                                                      NMSupplicantDriver driver,
-                                                     gboolean fast_supported,
+                                                     NMSupplicantFeature fast_support,
                                                      NMSupplicantFeature ap_support);
 
 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,
                                              NMSupplicantFeature apmode);
 
-#endif	/* NM_SUPPLICANT_INTERFACE_H */
+void nm_supplicant_interface_set_fast_support (NMSupplicantInterface *self,
+                                               NMSupplicantFeature fast_support);
+
+#endif /* __NM_SUPPLICANT_INTERFACE_H__ */
diff --git a/src/supplicant/nm-supplicant-manager.c b/src/supplicant/nm-supplicant-manager.c
index 2fbfa391..cf53fb41 100644
--- a/src/supplicant/nm-supplicant-manager.c
+++ b/src/supplicant/nm-supplicant-manager.c
@@ -37,7 +37,7 @@ typedef struct {
 	gboolean         running;
 
 	GSList          *ifaces;
-	gboolean          fast_supported;
+	NMSupplicantFeature fast_support;
 	NMSupplicantFeature ap_support;
 	guint             die_count_reset_id;
 	guint             die_count;
@@ -158,7 +158,7 @@ nm_supplicant_manager_create_interface (NMSupplicantManager *self,
 
 	iface = nm_supplicant_interface_new (ifname,
 	                                     driver,
-	                                     priv->fast_supported,
+	                                     priv->fast_support,
 	                                     priv->ap_support);
 
 	priv->ifaces = g_slist_prepend (priv->ifaces, iface);
@@ -217,21 +217,32 @@ update_capabilities (NMSupplicantManager *self)
 	           (priv->ap_support == NM_SUPPLICANT_FEATURE_NO) ? "not " : "possibly ");
 
 	/* EAP-FAST */
-	priv->fast_supported = FALSE;
+	priv->fast_support = NM_SUPPLICANT_FEATURE_NO;
 	value = g_dbus_proxy_get_cached_property (priv->proxy, "EapMethods");
 	if (value) {
 		if (g_variant_is_of_type (value, G_VARIANT_TYPE_STRING_ARRAY)) {
 			array = g_variant_get_strv (value, NULL);
 			if (array) {
-				if (g_strv_contains (array, "fast"))
-					priv->fast_supported = TRUE;
+				const char **a;
+
+				for (a = array; *a; a++) {
+					if (g_ascii_strcasecmp (*a, "FAST") == 0) {
+						priv->fast_support = NM_SUPPLICANT_FEATURE_YES;
+						break;
+					}
+				}
 				g_free (array);
 			}
 		}
 		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
@@ -306,8 +317,8 @@ name_owner_cb (GDBusProxy *proxy, GParamSpec *pspec, gpointer user_data)
 	_LOGI ("wpa_supplicant %s", owner ? "running" : "stopped");
 
 	if (owner) {
-		set_running (self, TRUE);
 		update_capabilities (self);
+		set_running (self, TRUE);
 	} else if (priv->running) {
 		/* Reschedule the die count reset timeout.  Every time the supplicant
 		 * dies we wait 10 seconds before resetting the counter.  If the
@@ -324,9 +335,10 @@ name_owner_cb (GDBusProxy *proxy, GParamSpec *pspec, gpointer user_data)
 			       priv->die_count);
 		}
 
-		set_running (self, FALSE);
+		priv->ap_support = NM_SUPPLICANT_FEATURE_UNKNOWN;
+		priv->fast_support = NM_SUPPLICANT_FEATURE_UNKNOWN;
 
-		priv->fast_supported = FALSE;
+		set_running (self, FALSE);
 	}
 
 	g_free (owner);