summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-02-14 09:49:42 +0100
committerThomas Haller <thaller@redhat.com>2020-02-14 09:49:42 +0100
commitecddb4c29bde12804d10173b74399f992bf3efed (patch)
tree80ce4868989d5cc76f04d687caa1b3909d76ec5d
parent02c95a2d3dd9c1dbb404f50f093f5a606c060a03 (diff)
parentf0bc4aa525617b631fa30374322365b7e2b4460b (diff)
supplicant: merge branch 'th/supplicant-cleanup-2'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/411
-rw-r--r--shared/nm-glib-aux/nm-dbus-aux.c2
-rw-r--r--src/devices/nm-device-ethernet.c45
-rw-r--r--src/devices/nm-device-macsec.c24
-rw-r--r--src/supplicant/nm-supplicant-interface.c16
-rw-r--r--src/supplicant/nm-supplicant-manager.c10
-rw-r--r--src/supplicant/nm-supplicant-types.h3
6 files changed, 50 insertions, 50 deletions
diff --git a/shared/nm-glib-aux/nm-dbus-aux.c b/shared/nm-glib-aux/nm-dbus-aux.c
index 7c55b5a75..9cb0a7f09 100644
--- a/shared/nm-glib-aux/nm-dbus-aux.c
+++ b/shared/nm-glib-aux/nm-dbus-aux.c
@@ -111,8 +111,6 @@ void nm_dbus_connection_call_set (GDBusConnection *dbus_connection,
NMDBusConnectionCallDefaultCb callback,
gpointer user_data)
{
- nm_assert (callback);
-
g_dbus_connection_call (dbus_connection,
bus_name,
object_path,
diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c
index a87b772e8..bdb46844c 100644
--- a/src/devices/nm-device-ethernet.c
+++ b/src/devices/nm-device-ethernet.c
@@ -45,18 +45,6 @@ _LOG_DECLARE_SELF(NMDeviceEthernet);
/*****************************************************************************/
-typedef struct Supplicant {
- NMSupplicantManager *mgr;
- NMSupplicantInterface *iface;
-
- /* signal handler ids */
- gulong iface_state_id;
- gulong auth_state_id;
-
- /* Timeouts and idles */
- guint con_timeout_id;
-} Supplicant;
-
typedef enum {
DCB_WAIT_UNKNOWN = 0,
/* Ensure carrier is up before enabling DCB */
@@ -72,12 +60,6 @@ typedef enum {
} DcbWait;
typedef struct _NMDeviceEthernetPrivate {
- guint32 speed;
- gulong carrier_id;
-
- Supplicant supplicant;
- guint supplicant_timeout_id;
-
/* s390 */
char * subchan1;
char * subchan2;
@@ -87,6 +69,23 @@ typedef struct _NMDeviceEthernetPrivate {
char * s390_nettype;
GHashTable * s390_options;
+ guint32 speed;
+ gulong carrier_id;
+
+ struct {
+ NMSupplicantManager *mgr;
+ NMSupplicantInterface *iface;
+
+ /* signal handler ids */
+ gulong iface_state_id;
+ gulong auth_state_id;
+
+ /* Timeouts and idles */
+ guint con_timeout_id;
+
+ guint timeout_id;
+ } supplicant;
+
NMActRequestGetSecretsCallId *wired_secrets_id;
/* PPPoE */
@@ -400,7 +399,7 @@ supplicant_interface_release (NMDeviceEthernet *self)
{
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
- nm_clear_g_source (&priv->supplicant_timeout_id);
+ nm_clear_g_source (&priv->supplicant.timeout_id);
nm_clear_g_source (&priv->supplicant.con_timeout_id);
nm_clear_g_signal_handler (priv->supplicant.iface, &priv->supplicant.iface_state_id);
nm_clear_g_signal_handler (priv->supplicant.iface, &priv->supplicant.auth_state_id);
@@ -547,7 +546,7 @@ link_timeout_cb (gpointer user_data)
NMConnection *applied_connection;
const char *setting_name;
- priv->supplicant_timeout_id = 0;
+ priv->supplicant.timeout_id = 0;
req = nm_device_get_act_request (device);
@@ -675,7 +674,7 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface,
}
break;
case NM_SUPPLICANT_INTERFACE_STATE_COMPLETED:
- nm_clear_g_source (&priv->supplicant_timeout_id);
+ nm_clear_g_source (&priv->supplicant.timeout_id);
nm_clear_g_source (&priv->supplicant.con_timeout_id);
/* If this is the initial association during device activation,
@@ -690,8 +689,8 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface,
case NM_SUPPLICANT_INTERFACE_STATE_DISCONNECTED:
if ((devstate == NM_DEVICE_STATE_ACTIVATED) || nm_device_is_activating (device)) {
/* Start the link timeout so we allow some time for reauthentication */
- if (!priv->supplicant_timeout_id)
- priv->supplicant_timeout_id = g_timeout_add_seconds (15, link_timeout_cb, device);
+ if (!priv->supplicant.timeout_id)
+ priv->supplicant.timeout_id = g_timeout_add_seconds (15, link_timeout_cb, device);
}
break;
case NM_SUPPLICANT_INTERFACE_STATE_DOWN:
diff --git a/src/devices/nm-device-macsec.c b/src/devices/nm-device-macsec.c
index dbb4ac8ef..b7c9e7728 100644
--- a/src/devices/nm-device-macsec.c
+++ b/src/devices/nm-device-macsec.c
@@ -23,17 +23,6 @@ _LOG_DECLARE_SELF(NMDeviceMacsec);
/*****************************************************************************/
-typedef struct Supplicant {
- NMSupplicantManager *mgr;
- NMSupplicantInterface *iface;
-
- /* signal handler ids */
- gulong iface_state_id;
-
- /* Timeouts and idles */
- guint con_timeout_id;
-} Supplicant;
-
NM_GOBJECT_PROPERTIES_DEFINE (NMDeviceMacsec,
PROP_SCI,
PROP_CIPHER_SUITE,
@@ -53,7 +42,18 @@ typedef struct {
NMPlatformLnkMacsec props;
gulong parent_state_id;
gulong parent_mtu_id;
- Supplicant supplicant;
+
+ struct {
+ NMSupplicantManager *mgr;
+ NMSupplicantInterface *iface;
+
+ /* signal handler ids */
+ gulong iface_state_id;
+
+ /* Timeouts and idles */
+ guint con_timeout_id;
+ } supplicant;
+
guint supplicant_timeout_id;
NMActRequestGetSecretsCallId *macsec_secrets_id;
} NMDeviceMacsecPrivate;
diff --git a/src/supplicant/nm-supplicant-interface.c b/src/supplicant/nm-supplicant-interface.c
index 4b6b4f6e1..e25928c14 100644
--- a/src/supplicant/nm-supplicant-interface.c
+++ b/src/supplicant/nm-supplicant-interface.c
@@ -1805,19 +1805,9 @@ on_wpas_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_d
*/
if (priv->dev != NULL) {
- const char *driver_name = NULL;
-
- switch (priv->driver) {
- case NM_SUPPLICANT_DRIVER_WIRELESS:
- driver_name = NM_WPAS_DEFAULT_WIFI_DRIVER;
- break;
- case NM_SUPPLICANT_DRIVER_WIRED:
- driver_name = "wired";
- break;
- case NM_SUPPLICANT_DRIVER_MACSEC:
- driver_name = "macsec_linux";
- break;
- }
+ const char *driver_name;
+
+ driver_name = nm_supplicant_driver_to_string (priv->driver);
g_return_if_fail (driver_name);
diff --git a/src/supplicant/nm-supplicant-manager.c b/src/supplicant/nm-supplicant-manager.c
index 65b910cad..08bed98cf 100644
--- a/src/supplicant/nm-supplicant-manager.c
+++ b/src/supplicant/nm-supplicant-manager.c
@@ -48,6 +48,16 @@ NM_CACHED_QUARK_FCN ("nm-supplicant-error-quark", nm_supplicant_error_quark)
/*****************************************************************************/
+NM_UTILS_LOOKUP_STR_DEFINE (nm_supplicant_driver_to_string, NMSupplicantDriver,
+ NM_UTILS_LOOKUP_DEFAULT_WARN (NULL),
+ NM_UTILS_LOOKUP_ITEM (NM_SUPPLICANT_DRIVER_UNKNOWN, "???"),
+ NM_UTILS_LOOKUP_ITEM (NM_SUPPLICANT_DRIVER_WIRELESS, NM_WPAS_DEFAULT_WIFI_DRIVER),
+ NM_UTILS_LOOKUP_ITEM (NM_SUPPLICANT_DRIVER_WIRED, "wired"),
+ NM_UTILS_LOOKUP_ITEM (NM_SUPPLICANT_DRIVER_MACSEC, "macsec_linux"),
+);
+
+/*****************************************************************************/
+
static void
_caps_set (NMSupplicantManagerPrivate *priv,
NMSupplCapType type,
diff --git a/src/supplicant/nm-supplicant-types.h b/src/supplicant/nm-supplicant-types.h
index de0283b24..17fbc0c00 100644
--- a/src/supplicant/nm-supplicant-types.h
+++ b/src/supplicant/nm-supplicant-types.h
@@ -127,11 +127,14 @@ typedef enum {
} NMSupplicantError;
typedef enum {
+ NM_SUPPLICANT_DRIVER_UNKNOWN,
NM_SUPPLICANT_DRIVER_WIRELESS,
NM_SUPPLICANT_DRIVER_WIRED,
NM_SUPPLICANT_DRIVER_MACSEC,
} NMSupplicantDriver;
+const char *nm_supplicant_driver_to_string (NMSupplicantDriver driver);
+
#define NM_SUPPLICANT_ERROR (nm_supplicant_error_quark ())
GQuark nm_supplicant_error_quark (void);