summaryrefslogtreecommitdiff
path: root/src/supplicant
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2017-03-18 14:56:38 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2017-04-15 10:37:33 +0200
commita72ffe230bce1486fcd6bbaea8e111a9e77f33ed (patch)
tree099e1b23998a7f6c7746603784099cfe186dfbb5 /src/supplicant
parentd38eadd9907b216da12b2dc5bafe7a1b4ad07003 (diff)
downloadNetworkManager-a72ffe230bce1486fcd6bbaea8e111a9e77f33ed.tar.gz
supplicant: enable PMF only when wpa_supplicant supports it
Diffstat (limited to 'src/supplicant')
-rw-r--r--src/supplicant/nm-supplicant-interface.c30
-rw-r--r--src/supplicant/nm-supplicant-interface.h6
-rw-r--r--src/supplicant/nm-supplicant-manager.c18
3 files changed, 48 insertions, 6 deletions
diff --git a/src/supplicant/nm-supplicant-interface.c b/src/supplicant/nm-supplicant-interface.c
index dbdee193da..e92a57ff86 100644
--- a/src/supplicant/nm-supplicant-interface.c
+++ b/src/supplicant/nm-supplicant-interface.c
@@ -80,6 +80,7 @@ NM_GOBJECT_PROPERTIES_DEFINE (NMSupplicantInterface,
PROP_DRIVER,
PROP_FAST_SUPPORT,
PROP_AP_SUPPORT,
+ PROP_PMF_SUPPORT,
);
typedef struct {
@@ -88,6 +89,7 @@ typedef struct {
gboolean has_credreq; /* Whether querying 802.1x credentials is supported */
NMSupplicantFeature fast_support;
NMSupplicantFeature ap_support; /* Lightweight AP mode support */
+ NMSupplicantFeature pmf_support;
guint32 max_scan_ssids;
guint32 ready_count;
@@ -587,6 +589,15 @@ nm_supplicant_interface_set_fast_support (NMSupplicantInterface *self,
priv->fast_support = fast_support;
}
+void
+nm_supplicant_interface_set_pmf_support (NMSupplicantInterface *self,
+ NMSupplicantFeature pmf_support)
+{
+ NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self);
+
+ priv->pmf_support = pmf_support;
+}
+
static void
iface_introspect_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data)
{
@@ -830,7 +841,8 @@ on_iface_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_
NULL,
NULL);
- if (priv->driver == NM_SUPPLICANT_DRIVER_WIRELESS) {
+ if ( priv->pmf_support
+ && priv->driver == NM_SUPPLICANT_DRIVER_WIRELESS) {
g_dbus_proxy_call (priv->iface_proxy,
DBUS_INTERFACE_PROPERTIES ".Set",
g_variant_new ("(ssv)",
@@ -1597,6 +1609,10 @@ set_property (GObject *object,
/* construct-only */
priv->ap_support = g_value_get_int (value);
break;
+ case PROP_PMF_SUPPORT:
+ /* construct-only */
+ priv->pmf_support = g_value_get_int (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1616,7 +1632,8 @@ NMSupplicantInterface *
nm_supplicant_interface_new (const char *ifname,
NMSupplicantDriver driver,
NMSupplicantFeature fast_support,
- NMSupplicantFeature ap_support)
+ NMSupplicantFeature ap_support,
+ NMSupplicantFeature pmf_support)
{
g_return_val_if_fail (ifname != NULL, NULL);
@@ -1625,6 +1642,7 @@ nm_supplicant_interface_new (const char *ifname,
NM_SUPPLICANT_INTERFACE_DRIVER, (guint) driver,
NM_SUPPLICANT_INTERFACE_FAST_SUPPORT, (int) fast_support,
NM_SUPPLICANT_INTERFACE_AP_SUPPORT, (int) ap_support,
+ NM_SUPPLICANT_INTERFACE_PMF_SUPPORT, (int) pmf_support,
NULL);
}
@@ -1706,6 +1724,14 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass)
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
+ obj_properties[PROP_PMF_SUPPORT] =
+ g_param_spec_int (NM_SUPPLICANT_INTERFACE_PMF_SUPPORT, "", "",
+ NM_SUPPLICANT_FEATURE_UNKNOWN,
+ NM_SUPPLICANT_FEATURE_YES,
+ NM_SUPPLICANT_FEATURE_UNKNOWN,
+ G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
diff --git a/src/supplicant/nm-supplicant-interface.h b/src/supplicant/nm-supplicant-interface.h
index d60d4a544c..a881ede236 100644
--- a/src/supplicant/nm-supplicant-interface.h
+++ b/src/supplicant/nm-supplicant-interface.h
@@ -60,6 +60,7 @@ typedef enum {
#define NM_SUPPLICANT_INTERFACE_DRIVER "driver"
#define NM_SUPPLICANT_INTERFACE_FAST_SUPPORT "fast-support"
#define NM_SUPPLICANT_INTERFACE_AP_SUPPORT "ap-support"
+#define NM_SUPPLICANT_INTERFACE_PMF_SUPPORT "pmf-support"
/* Signals */
#define NM_SUPPLICANT_INTERFACE_STATE "state"
@@ -76,7 +77,8 @@ GType nm_supplicant_interface_get_type (void);
NMSupplicantInterface * nm_supplicant_interface_new (const char *ifname,
NMSupplicantDriver driver,
NMSupplicantFeature fast_support,
- NMSupplicantFeature ap_support);
+ NMSupplicantFeature ap_support,
+ NMSupplicantFeature pmf_support);
void nm_supplicant_interface_set_supplicant_available (NMSupplicantInterface *self,
gboolean available);
@@ -126,4 +128,6 @@ void nm_supplicant_interface_set_ap_support (NMSupplicantInterface *self,
void nm_supplicant_interface_set_fast_support (NMSupplicantInterface *self,
NMSupplicantFeature fast_support);
+void nm_supplicant_interface_set_pmf_support (NMSupplicantInterface *self,
+ NMSupplicantFeature pmf_support);
#endif /* __NM_SUPPLICANT_INTERFACE_H__ */
diff --git a/src/supplicant/nm-supplicant-manager.c b/src/supplicant/nm-supplicant-manager.c
index 49650ab714..0f2eb63a62 100644
--- a/src/supplicant/nm-supplicant-manager.c
+++ b/src/supplicant/nm-supplicant-manager.c
@@ -39,6 +39,7 @@ typedef struct {
GSList *ifaces;
NMSupplicantFeature fast_support;
NMSupplicantFeature ap_support;
+ NMSupplicantFeature pmf_support;
guint die_count_reset_id;
guint die_count;
} NMSupplicantManagerPrivate;
@@ -159,7 +160,8 @@ nm_supplicant_manager_create_interface (NMSupplicantManager *self,
iface = nm_supplicant_interface_new (ifname,
driver,
priv->fast_support,
- priv->ap_support);
+ priv->ap_support,
+ priv->pmf_support);
priv->ifaces = g_slist_prepend (priv->ifaces, iface);
g_object_add_toggle_ref ((GObject *) iface, _sup_iface_last_ref, self);
@@ -193,28 +195,37 @@ update_capabilities (NMSupplicantManager *self)
* dbus: Add global capabilities property
*/
priv->ap_support = NM_SUPPLICANT_FEATURE_UNKNOWN;
+ priv->pmf_support = NM_SUPPLICANT_FEATURE_UNKNOWN;
value = g_dbus_proxy_get_cached_property (priv->proxy, "Capabilities");
if (value) {
if (g_variant_is_of_type (value, G_VARIANT_TYPE_STRING_ARRAY)) {
array = g_variant_get_strv (value, NULL);
priv->ap_support = NM_SUPPLICANT_FEATURE_NO;
+ priv->pmf_support = NM_SUPPLICANT_FEATURE_NO;
if (array) {
if (g_strv_contains (array, "ap"))
priv->ap_support = NM_SUPPLICANT_FEATURE_YES;
+ if (g_strv_contains (array, "pmf"))
+ priv->pmf_support = NM_SUPPLICANT_FEATURE_YES;
g_free (array);
}
}
g_variant_unref (value);
}
- /* Tell all interfaces about results of the AP check */
- for (ifaces = priv->ifaces; ifaces; ifaces = ifaces->next)
+ /* Tell all interfaces about results of the AP/PMF check */
+ for (ifaces = priv->ifaces; ifaces; ifaces = ifaces->next) {
nm_supplicant_interface_set_ap_support (ifaces->data, priv->ap_support);
+ nm_supplicant_interface_set_pmf_support (ifaces->data, priv->pmf_support);
+ }
_LOGD ("AP mode is %ssupported",
(priv->ap_support == NM_SUPPLICANT_FEATURE_YES) ? "" :
(priv->ap_support == NM_SUPPLICANT_FEATURE_NO) ? "not " : "possibly ");
+ _LOGD ("PMF is %ssupported",
+ (priv->pmf_support == NM_SUPPLICANT_FEATURE_YES) ? "" :
+ (priv->pmf_support == NM_SUPPLICANT_FEATURE_NO) ? "not " : "possibly ");
/* EAP-FAST */
priv->fast_support = NM_SUPPLICANT_FEATURE_NO;
@@ -337,6 +348,7 @@ name_owner_cb (GDBusProxy *proxy, GParamSpec *pspec, gpointer user_data)
priv->ap_support = NM_SUPPLICANT_FEATURE_UNKNOWN;
priv->fast_support = NM_SUPPLICANT_FEATURE_UNKNOWN;
+ priv->pmf_support = NM_SUPPLICANT_FEATURE_UNKNOWN;
set_running (self, FALSE);
}