supplicant: merge branch 'th/supplicant-cleanup-2'

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/411
This commit is contained in:
Thomas Haller 2020-02-14 09:49:42 +01:00
commit ecddb4c29b
6 changed files with 49 additions and 49 deletions

View file

@ -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,

View file

@ -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:

View file

@ -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;

View file

@ -1805,19 +1805,9 @@ on_wpas_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_d
*/
if (priv->dev != NULL) {
const char *driver_name = NULL;
const char *driver_name;
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;
}
driver_name = nm_supplicant_driver_to_string (priv->driver);
g_return_if_fail (driver_name);

View file

@ -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,

View file

@ -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);