mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 12:18:13 +02:00
supplicant: Initial pmf support (a.k.a. MFP, a.k.a. 802.11w)
https://bugzilla.gnome.org/show_bug.cgi?id=748367 Signed-off-by: Michael Cronenworth <mike@cchtml.com>
This commit is contained in:
parent
fff918ec5a
commit
8b051bb35e
3 changed files with 54 additions and 0 deletions
|
|
@ -44,6 +44,7 @@ typedef struct {
|
|||
GHashTable *config;
|
||||
GHashTable *blobs;
|
||||
guint32 ap_scan;
|
||||
guint32 pmf;
|
||||
gboolean fast_required;
|
||||
gboolean dispose_has_run;
|
||||
} NMSupplicantConfigPrivate;
|
||||
|
|
@ -96,6 +97,7 @@ nm_supplicant_config_init (NMSupplicantConfig * self)
|
|||
(GDestroyNotify) blob_free);
|
||||
|
||||
priv->ap_scan = 1;
|
||||
priv->pmf = 1;
|
||||
priv->dispose_has_run = FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -280,6 +282,14 @@ nm_supplicant_config_get_ap_scan (NMSupplicantConfig * self)
|
|||
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
|
||||
nm_supplicant_config_fast_required (NMSupplicantConfig *self)
|
||||
{
|
||||
|
|
@ -467,6 +477,8 @@ nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self,
|
|||
else
|
||||
priv->ap_scan = 1;
|
||||
|
||||
priv->pmf = 1;
|
||||
|
||||
ssid = nm_setting_wireless_get_ssid (setting);
|
||||
if (!nm_supplicant_config_add_option (self, "ssid",
|
||||
(char *) g_bytes_get_data (ssid, NULL),
|
||||
|
|
@ -931,6 +943,7 @@ nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self,
|
|||
if (!add_string_val (self, "0", "eapol_flags", FALSE, NULL, error))
|
||||
return FALSE;
|
||||
priv->ap_scan = 0;
|
||||
priv->pmf = 0;
|
||||
}
|
||||
|
||||
if (!ADD_STRING_LIST_VAL (self, setting, 802_1x, eap_method, eap_methods, "eap", ' ', TRUE, NULL, error))
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@ NMSupplicantConfig *nm_supplicant_config_new (void);
|
|||
|
||||
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);
|
||||
|
||||
GVariant *nm_supplicant_config_to_variant (NMSupplicantConfig *self);
|
||||
|
|
|
|||
|
|
@ -470,6 +470,34 @@ iface_check_ready (NMSupplicantInterface *self)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_pmf_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data)
|
||||
{
|
||||
NMSupplicantInterface *self;
|
||||
NMSupplicantInterfacePrivate *priv;
|
||||
gs_unref_variant GVariant *reply = NULL;
|
||||
gs_free_error GError *error = NULL;
|
||||
|
||||
reply = g_dbus_proxy_call_finish (proxy, result, &error);
|
||||
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||
return;
|
||||
|
||||
self = NM_SUPPLICANT_INTERFACE (user_data);
|
||||
priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self);
|
||||
|
||||
if (!reply) {
|
||||
g_dbus_error_strip_remote_error (error);
|
||||
_LOGW ("couldn't send PMF mode to the supplicant interface: %s",
|
||||
error->message);
|
||||
emit_error_helper (self, error);
|
||||
return;
|
||||
}
|
||||
|
||||
_LOGI ("config: set interface pmf to %d",
|
||||
nm_supplicant_config_get_pmf (priv->cfg));
|
||||
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_supplicant_interface_credentials_reply (NMSupplicantInterface *self,
|
||||
const char *field,
|
||||
|
|
@ -835,6 +863,17 @@ on_iface_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_
|
|||
priv->init_cancellable,
|
||||
(GAsyncReadyCallback) iface_introspect_cb,
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue