meta-digi/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/0003-supplicant-detect-SHA3...

234 lines
11 KiB
Diff

From: Lubomir Rintel <lkundrak@v3.sk>
Date: Mon, 15 Jul 2019 11:30:19 +0000
Subject: [PATCH 3/7] supplicant: detect SHA384 support
---
src/supplicant/nm-supplicant-interface.c | 33 +++++++++++++++++++++++-
src/supplicant/nm-supplicant-interface.h | 8 +++++-
src/supplicant/nm-supplicant-manager.c | 18 ++++++++++---
3 files changed, 54 insertions(+), 5 deletions(-)
diff --git a/src/supplicant/nm-supplicant-interface.c b/src/supplicant/nm-supplicant-interface.c
index 2eaa1401e..1c92b9a74 100644
--- a/src/supplicant/nm-supplicant-interface.c
+++ b/src/supplicant/nm-supplicant-interface.c
@@ -114,6 +114,7 @@ NM_GOBJECT_PROPERTIES_DEFINE (NMSupplicantInterface,
PROP_P2P_SUPPORT,
PROP_WFD_SUPPORT,
PROP_FT_SUPPORT,
+ PROP_SHA384_SUPPORT,
);
typedef struct {
@@ -127,6 +128,7 @@ typedef struct {
NMSupplicantFeature p2p_support;
NMSupplicantFeature wfd_support;
NMSupplicantFeature ft_support;
+ NMSupplicantFeature sha384_support;
guint32 max_scan_ssids;
guint32 ready_count;
@@ -794,6 +796,12 @@ nm_supplicant_interface_get_ft_support (NMSupplicantInterface *self)
return NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self)->ft_support;
}
+NMSupplicantFeature
+nm_supplicant_interface_get_sha384_support (NMSupplicantInterface *self)
+{
+ return NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self)->sha384_support;
+}
+
void
nm_supplicant_interface_set_ap_support (NMSupplicantInterface *self,
NMSupplicantFeature ap_support)
@@ -861,6 +869,15 @@ nm_supplicant_interface_set_ft_support (NMSupplicantInterface *self,
priv->ft_support = ft_support;
}
+void
+nm_supplicant_interface_set_sha384_support (NMSupplicantInterface *self,
+ NMSupplicantFeature sha384_support)
+{
+ NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self);
+
+ priv->sha384_support = sha384_support;
+}
+
/*****************************************************************************/
static void
@@ -2705,6 +2722,10 @@ set_property (GObject *object,
/* construct-only */
priv->ft_support = g_value_get_int (value);
break;
+ case PROP_SHA384_SUPPORT:
+ /* construct-only */
+ priv->sha384_support = g_value_get_int (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -2731,7 +2752,8 @@ nm_supplicant_interface_new (const char *ifname,
NMSupplicantFeature fils_support,
NMSupplicantFeature p2p_support,
NMSupplicantFeature wfd_support,
- NMSupplicantFeature ft_support)
+ NMSupplicantFeature ft_support,
+ NMSupplicantFeature sha384_support)
{
/* One of ifname or path need to be set */
g_return_val_if_fail (ifname != NULL || object_path != NULL, NULL);
@@ -2748,6 +2770,7 @@ nm_supplicant_interface_new (const char *ifname,
NM_SUPPLICANT_INTERFACE_P2P_SUPPORT, (int) p2p_support,
NM_SUPPLICANT_INTERFACE_WFD_SUPPORT, (int) wfd_support,
NM_SUPPLICANT_INTERFACE_FT_SUPPORT, (int) ft_support,
+ NM_SUPPLICANT_INTERFACE_SHA384_SUPPORT, (int) sha384_support,
NULL);
}
@@ -2914,6 +2937,14 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass)
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
+ obj_properties[PROP_SHA384_SUPPORT] =
+ g_param_spec_int (NM_SUPPLICANT_INTERFACE_SHA384_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 0b33a4e41..8e9eede6f 100644
--- a/src/supplicant/nm-supplicant-interface.h
+++ b/src/supplicant/nm-supplicant-interface.h
@@ -69,6 +69,7 @@ typedef enum {
#define NM_SUPPLICANT_INTERFACE_P2P_SUPPORT "p2p-support"
#define NM_SUPPLICANT_INTERFACE_WFD_SUPPORT "wfd-support"
#define NM_SUPPLICANT_INTERFACE_FT_SUPPORT "ft-support"
+#define NM_SUPPLICANT_INTERFACE_SHA384_SUPPORT "sha384-support"
/* Signals */
#define NM_SUPPLICANT_INTERFACE_STATE "state"
@@ -97,7 +98,8 @@ NMSupplicantInterface * nm_supplicant_interface_new (const char *ifname,
NMSupplicantFeature fils_support,
NMSupplicantFeature p2p_support,
NMSupplicantFeature wfd_support,
- NMSupplicantFeature ft_support);
+ NMSupplicantFeature ft_support,
+ NMSupplicantFeature sha384_support);
void nm_supplicant_interface_set_supplicant_available (NMSupplicantInterface *self,
gboolean available);
@@ -164,6 +166,7 @@ NMSupplicantFeature nm_supplicant_interface_get_fils_support (NMSupplicantInterf
NMSupplicantFeature nm_supplicant_interface_get_p2p_support (NMSupplicantInterface *self);
NMSupplicantFeature nm_supplicant_interface_get_wfd_support (NMSupplicantInterface *self);
NMSupplicantFeature nm_supplicant_interface_get_ft_support (NMSupplicantInterface *self);
+NMSupplicantFeature nm_supplicant_interface_get_sha384_support (NMSupplicantInterface *self);
void nm_supplicant_interface_set_ap_support (NMSupplicantInterface *self,
NMSupplicantFeature apmode);
@@ -186,6 +189,9 @@ void nm_supplicant_interface_set_wfd_support (NMSupplicantInterface *self,
void nm_supplicant_interface_set_ft_support (NMSupplicantInterface *self,
NMSupplicantFeature ft_support);
+void nm_supplicant_interface_set_sha384_support (NMSupplicantInterface *self,
+ NMSupplicantFeature sha384_support);
+
void nm_supplicant_interface_enroll_wps (NMSupplicantInterface *self,
const char *const type,
const char *bssid,
diff --git a/src/supplicant/nm-supplicant-manager.c b/src/supplicant/nm-supplicant-manager.c
index f7a3bdbf2..d4b5bd831 100644
--- a/src/supplicant/nm-supplicant-manager.c
+++ b/src/supplicant/nm-supplicant-manager.c
@@ -41,6 +41,7 @@ typedef struct {
NMSupplicantFeature p2p_support;
NMSupplicantFeature wfd_support;
NMSupplicantFeature ft_support;
+ NMSupplicantFeature sha384_support;
guint die_count_reset_id;
guint die_count;
} NMSupplicantManagerPrivate;
@@ -233,7 +234,8 @@ nm_supplicant_manager_create_interface (NMSupplicantManager *self,
priv->fils_support,
priv->p2p_support,
priv->wfd_support,
- priv->ft_support);
+ priv->ft_support,
+ priv->sha384_support);
priv->ifaces = g_slist_prepend (priv->ifaces, iface);
g_object_add_toggle_ref ((GObject *) iface, _sup_iface_last_ref, self);
@@ -291,7 +293,8 @@ nm_supplicant_manager_create_interface_from_path (NMSupplicantManager *self,
priv->fils_support,
priv->p2p_support,
priv->wfd_support,
- priv->ft_support);
+ priv->ft_support,
+ priv->sha384_support);
priv->ifaces = g_slist_prepend (priv->ifaces, iface);
g_object_add_toggle_ref ((GObject *) iface, _sup_iface_last_ref, self);
@@ -330,6 +333,7 @@ update_capabilities (NMSupplicantManager *self)
/* Support for the following is newer than the capabilities property */
priv->p2p_support = NM_SUPPLICANT_FEATURE_NO;
priv->ft_support = NM_SUPPLICANT_FEATURE_NO;
+ priv->sha384_support = NM_SUPPLICANT_FEATURE_NO;
value = g_dbus_proxy_get_cached_property (priv->proxy, "Capabilities");
if (value) {
@@ -340,6 +344,7 @@ update_capabilities (NMSupplicantManager *self)
priv->fils_support = NM_SUPPLICANT_FEATURE_NO;
priv->p2p_support = NM_SUPPLICANT_FEATURE_NO;
priv->ft_support = NM_SUPPLICANT_FEATURE_NO;
+ priv->sha384_support = NM_SUPPLICANT_FEATURE_NO;
if (array) {
if (g_strv_contains (array, "ap"))
priv->ap_support = NM_SUPPLICANT_FEATURE_YES;
@@ -351,19 +356,22 @@ update_capabilities (NMSupplicantManager *self)
priv->p2p_support = NM_SUPPLICANT_FEATURE_YES;
if (g_strv_contains (array, "ft"))
priv->ft_support = NM_SUPPLICANT_FEATURE_YES;
+ if (g_strv_contains (array, "sha384"))
+ priv->sha384_support = NM_SUPPLICANT_FEATURE_YES;
g_free (array);
}
}
g_variant_unref (value);
}
- /* Tell all interfaces about results of the AP/PMF/FILS/P2P/FT check */
+ /* Tell all interfaces about results of the AP/PMF/FILS/P2P/FT/SHA384 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);
nm_supplicant_interface_set_fils_support (ifaces->data, priv->fils_support);
nm_supplicant_interface_set_p2p_support (ifaces->data, priv->p2p_support);
nm_supplicant_interface_set_ft_support (ifaces->data, priv->ft_support);
+ nm_supplicant_interface_set_sha384_support (ifaces->data, priv->sha384_support);
}
_LOGD ("AP mode is %ssupported",
@@ -381,6 +389,9 @@ update_capabilities (NMSupplicantManager *self)
_LOGD ("FT is %ssupported",
(priv->ft_support == NM_SUPPLICANT_FEATURE_YES) ? "" :
(priv->ft_support == NM_SUPPLICANT_FEATURE_NO) ? "not " : "possibly ");
+ _LOGD ("SHA384 is %ssupported",
+ (priv->sha384_support == NM_SUPPLICANT_FEATURE_YES) ? "" :
+ (priv->sha384_support == NM_SUPPLICANT_FEATURE_NO) ? "not " : "possibly ");
/* EAP-FAST */
priv->fast_support = NM_SUPPLICANT_FEATURE_NO;
@@ -520,6 +531,7 @@ name_owner_cb (GDBusProxy *proxy, GParamSpec *pspec, gpointer user_data)
priv->pmf_support = NM_SUPPLICANT_FEATURE_UNKNOWN;
priv->fils_support = NM_SUPPLICANT_FEATURE_UNKNOWN;
priv->ft_support = NM_SUPPLICANT_FEATURE_UNKNOWN;
+ priv->sha384_support = NM_SUPPLICANT_FEATURE_UNKNOWN;
set_running (self, FALSE);
}