Commit d38eadd9 authored by Beniamino Galvani's avatar Beniamino Galvani

supplicant: enable PMF based on driver type

Instead of adding a new flag to configuration based on connection
type, use the driver-type field directly in the supplicant-interface.
parent 8b051bb3
...@@ -44,7 +44,6 @@ typedef struct { ...@@ -44,7 +44,6 @@ typedef struct {
GHashTable *config; GHashTable *config;
GHashTable *blobs; GHashTable *blobs;
guint32 ap_scan; guint32 ap_scan;
guint32 pmf;
gboolean fast_required; gboolean fast_required;
gboolean dispose_has_run; gboolean dispose_has_run;
} NMSupplicantConfigPrivate; } NMSupplicantConfigPrivate;
...@@ -97,7 +96,6 @@ nm_supplicant_config_init (NMSupplicantConfig * self) ...@@ -97,7 +96,6 @@ nm_supplicant_config_init (NMSupplicantConfig * self)
(GDestroyNotify) blob_free); (GDestroyNotify) blob_free);
priv->ap_scan = 1; priv->ap_scan = 1;
priv->pmf = 1;
priv->dispose_has_run = FALSE; priv->dispose_has_run = FALSE;
} }
...@@ -282,14 +280,6 @@ nm_supplicant_config_get_ap_scan (NMSupplicantConfig * self) ...@@ -282,14 +280,6 @@ nm_supplicant_config_get_ap_scan (NMSupplicantConfig * self)
return NM_SUPPLICANT_CONFIG_GET_PRIVATE (self)->ap_scan; return NM_SUPPLICANT_CONFIG_GET_PRIVATE (self)->ap_scan;
} }
guint32
nm_supplicant_config_get_pmf (NMSupplicantConfig * self)
{
g_return_val_if_fail (NM_IS_SUPPLICANT_CONFIG (self), 1);
return NM_SUPPLICANT_CONFIG_GET_PRIVATE (self)->pmf;
}
gboolean gboolean
nm_supplicant_config_fast_required (NMSupplicantConfig *self) nm_supplicant_config_fast_required (NMSupplicantConfig *self)
{ {
...@@ -477,8 +467,6 @@ nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self, ...@@ -477,8 +467,6 @@ nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self,
else else
priv->ap_scan = 1; priv->ap_scan = 1;
priv->pmf = 1;
ssid = nm_setting_wireless_get_ssid (setting); ssid = nm_setting_wireless_get_ssid (setting);
if (!nm_supplicant_config_add_option (self, "ssid", if (!nm_supplicant_config_add_option (self, "ssid",
(char *) g_bytes_get_data (ssid, NULL), (char *) g_bytes_get_data (ssid, NULL),
...@@ -943,7 +931,6 @@ nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self, ...@@ -943,7 +931,6 @@ nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self,
if (!add_string_val (self, "0", "eapol_flags", FALSE, NULL, error)) if (!add_string_val (self, "0", "eapol_flags", FALSE, NULL, error))
return FALSE; return FALSE;
priv->ap_scan = 0; priv->ap_scan = 0;
priv->pmf = 0;
} }
if (!ADD_STRING_LIST_VAL (self, setting, 802_1x, eap_method, eap_methods, "eap", ' ', TRUE, NULL, error)) if (!ADD_STRING_LIST_VAL (self, setting, 802_1x, eap_method, eap_methods, "eap", ' ', TRUE, NULL, error))
......
...@@ -44,8 +44,6 @@ NMSupplicantConfig *nm_supplicant_config_new (void); ...@@ -44,8 +44,6 @@ NMSupplicantConfig *nm_supplicant_config_new (void);
guint32 nm_supplicant_config_get_ap_scan (NMSupplicantConfig *self); guint32 nm_supplicant_config_get_ap_scan (NMSupplicantConfig *self);
guint32 nm_supplicant_config_get_pmf (NMSupplicantConfig *self);
gboolean nm_supplicant_config_fast_required (NMSupplicantConfig *self); gboolean nm_supplicant_config_fast_required (NMSupplicantConfig *self);
GVariant *nm_supplicant_config_to_variant (NMSupplicantConfig *self); GVariant *nm_supplicant_config_to_variant (NMSupplicantConfig *self);
......
...@@ -487,15 +487,11 @@ set_pmf_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) ...@@ -487,15 +487,11 @@ set_pmf_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data)
if (!reply) { if (!reply) {
g_dbus_error_strip_remote_error (error); g_dbus_error_strip_remote_error (error);
_LOGW ("couldn't send PMF mode to the supplicant interface: %s", _LOGW ("couldn't enable PMF: %s", error->message);
error->message);
emit_error_helper (self, error);
return; return;
} }
_LOGI ("config: set interface pmf to %d", _LOGD ("PMF enabled");
nm_supplicant_config_get_pmf (priv->cfg));
} }
gboolean gboolean
...@@ -812,7 +808,7 @@ on_iface_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_ ...@@ -812,7 +808,7 @@ on_iface_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_
/* Scan result aging parameters */ /* Scan result aging parameters */
g_dbus_proxy_call (priv->iface_proxy, g_dbus_proxy_call (priv->iface_proxy,
"org.freedesktop.DBus.Properties.Set", DBUS_INTERFACE_PROPERTIES ".Set",
g_variant_new ("(ssv)", g_variant_new ("(ssv)",
WPAS_DBUS_IFACE_INTERFACE, WPAS_DBUS_IFACE_INTERFACE,
"BSSExpireAge", "BSSExpireAge",
...@@ -823,7 +819,7 @@ on_iface_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_ ...@@ -823,7 +819,7 @@ on_iface_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_
NULL, NULL,
NULL); NULL);
g_dbus_proxy_call (priv->iface_proxy, g_dbus_proxy_call (priv->iface_proxy,
"org.freedesktop.DBus.Properties.Set", DBUS_INTERFACE_PROPERTIES ".Set",
g_variant_new ("(ssv)", g_variant_new ("(ssv)",
WPAS_DBUS_IFACE_INTERFACE, WPAS_DBUS_IFACE_INTERFACE,
"BSSExpireCount", "BSSExpireCount",
...@@ -834,6 +830,20 @@ on_iface_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_ ...@@ -834,6 +830,20 @@ on_iface_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_
NULL, NULL,
NULL); NULL);
if (priv->driver == NM_SUPPLICANT_DRIVER_WIRELESS) {
g_dbus_proxy_call (priv->iface_proxy,
DBUS_INTERFACE_PROPERTIES ".Set",
g_variant_new ("(ssv)",
WPAS_DBUS_IFACE_INTERFACE,
"Pmf",
g_variant_new_uint32 (1)),
G_DBUS_CALL_FLAGS_NONE,
-1,
priv->init_cancellable,
(GAsyncReadyCallback) set_pmf_cb,
self);
}
/* Check whether NetworkReply and AP mode are supported */ /* Check whether NetworkReply and AP mode are supported */
priv->ready_count = 1; priv->ready_count = 1;
g_dbus_proxy_call (priv->iface_proxy, g_dbus_proxy_call (priv->iface_proxy,
...@@ -863,17 +873,6 @@ on_iface_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_ ...@@ -863,17 +873,6 @@ on_iface_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_
priv->init_cancellable, priv->init_cancellable,
(GAsyncReadyCallback) iface_introspect_cb, (GAsyncReadyCallback) iface_introspect_cb,
self); self);
g_dbus_proxy_call (priv->iface_proxy,
DBUS_INTERFACE_PROPERTIES ".Set",
g_variant_new ("(ssv)",
WPAS_DBUS_IFACE_INTERFACE,
"Pmf",
g_variant_new_uint32 (nm_supplicant_config_get_pmf (priv->cfg))),
G_DBUS_CALL_FLAGS_NONE,
-1,
priv->assoc_cancellable,
(GAsyncReadyCallback) set_pmf_cb,
self);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment