Commit 38ef82d0 authored by Dan Winship's avatar Dan Winship

core: various fixes to autoconnect retry handling (rh #1029480)

parents 6c332f33 e2ab0eaf
......@@ -180,11 +180,6 @@ pan_connection_check_create (NMBluezDevice *self)
return;
}
if (!nm_connection_provider_has_connections_loaded (priv->provider)) {
/* do not try to create any connections until the connection provider is ready. */
return;
}
/* Only try once to create a connection. If it does not succeed, we do not try again. Also,
* if the connection gets deleted later, do not create another one for this device. */
priv->pan_connection_no_autocreate = TRUE;
......@@ -387,13 +382,14 @@ cp_connection_updated (NMConnectionProvider *provider,
}
static void
cp_connections_loaded (NMConnectionProvider *provider, NMBluezDevice *self)
load_connections (NMBluezDevice *self)
{
NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self);
const GSList *connections, *iter;
connections = nm_connection_provider_get_connections (provider);
connections = nm_connection_provider_get_connections (priv->provider);
for (iter = connections; iter; iter = g_slist_next (iter))
cp_connection_added (provider, NM_CONNECTION (iter->data), self);
cp_connection_added (priv->provider, NM_CONNECTION (iter->data), self);
}
/***********************************************************/
......@@ -832,7 +828,7 @@ get_properties_cb_4 (GObject *source_object, GAsyncResult *res, gpointer user_da
g_variant_unref (v_properties);
/* Check if any connections match this device */
cp_connections_loaded (priv->provider, self);
load_connections (self);
priv->initialized = TRUE;
g_signal_emit (self, signals[INITIALIZED], 0, TRUE);
......@@ -883,7 +879,7 @@ query_properties (NMBluezDevice *self)
}
/* Check if any connections match this device */
cp_connections_loaded (priv->provider, self);
load_connections (self);
break;
}
......@@ -970,11 +966,6 @@ nm_bluez_device_new (const char *path, NMConnectionProvider *provider, int bluez
G_CALLBACK (cp_connection_updated),
self);
g_signal_connect (priv->provider,
NM_CP_SIGNAL_CONNECTIONS_LOADED,
G_CALLBACK (cp_connections_loaded),
self);
g_bus_get (G_BUS_TYPE_SYSTEM,
NULL,
(GAsyncReadyCallback) on_bus_acquired,
......@@ -1027,7 +1018,6 @@ dispose (GObject *object)
g_signal_handlers_disconnect_by_func (priv->provider, cp_connection_added, self);
g_signal_handlers_disconnect_by_func (priv->provider, cp_connection_removed, self);
g_signal_handlers_disconnect_by_func (priv->provider, cp_connection_updated, self);
g_signal_handlers_disconnect_by_func (priv->provider, cp_connections_loaded, self);
g_slist_free_full (priv->connections, g_object_unref);
priv->connections = NULL;
......
This diff is collapsed.
......@@ -66,6 +66,7 @@
#define NM_DEVICE_RFKILL_TYPE "rfkill-type" /* Internal only */
#define NM_DEVICE_IFINDEX "ifindex" /* Internal only */
#define NM_DEVICE_IS_MASTER "is-master" /* Internal only */
#define NM_DEVICE_MASTER "master" /* Internal only */
#define NM_DEVICE_HW_ADDRESS "hw-address" /* Internal only */
#define NM_DEVICE_HAS_PENDING_ACTION "has-pending-action" /* Internal only */
......@@ -239,6 +240,9 @@ gboolean nm_device_master_add_slave (NMDevice *dev, NMDevice *slave, gbo
GSList * nm_device_master_get_slaves (NMDevice *dev);
gboolean nm_device_is_master (NMDevice *dev);
/* Slave */
NMDevice * nm_device_get_master (NMDevice *dev);
NMActRequest * nm_device_get_act_request (NMDevice *dev);
NMConnection * nm_device_get_connection (NMDevice *dev);
......
......@@ -44,7 +44,6 @@ typedef struct {
char *path;
char *specific_object;
NMDevice *device;
guint32 device_state_id;
char *pending_activation_id;
......@@ -92,7 +91,7 @@ enum {
};
static void check_master_ready (NMActiveConnection *self);
static void _device_cleanup (NMActiveConnectionPrivate *priv);
static void _device_cleanup (NMActiveConnection *self);
/****************************************************************/
......@@ -169,7 +168,7 @@ nm_active_connection_set_state (NMActiveConnection *self,
* emit property change notification so clients re-read the value,
* which will be NULL due to conditions in get_property().
*/
_device_cleanup (priv);
_device_cleanup (self);
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEVICES);
}
}
......@@ -344,10 +343,8 @@ device_state_changed (NMDevice *device,
/* If the device used to be active, but now is disconnected/failed, we
* no longer care about its state.
*/
if (new_state <= NM_DEVICE_STATE_DISCONNECTED || new_state == NM_DEVICE_STATE_FAILED) {
g_signal_handler_disconnect (device, priv->device_state_id);
priv->device_state_id = 0;
}
if (new_state <= NM_DEVICE_STATE_DISCONNECTED || new_state == NM_DEVICE_STATE_FAILED)
g_signal_handlers_disconnect_by_func (device, G_CALLBACK (device_state_changed), self);
}
/* Let subclasses handle the state change */
......@@ -355,6 +352,31 @@ device_state_changed (NMDevice *device,
NM_ACTIVE_CONNECTION_GET_CLASS (self)->device_state_changed (self, device, new_state, old_state);
}
static void
device_master_changed (GObject *object,
GParamSpec *pspec,
gpointer user_data)
{
NMDevice *device = NM_DEVICE (object);
NMActiveConnection *self = NM_ACTIVE_CONNECTION (user_data);
NMActiveConnection *master;
NMActiveConnectionState master_state;
if (!nm_device_get_master (device))
return;
g_signal_handlers_disconnect_by_func (device, G_CALLBACK (device_master_changed), self);
master = nm_active_connection_get_master (self);
g_assert (master);
master_state = nm_active_connection_get_state (master);
if (master_state >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) {
/* Master failed before attaching the slave */
if (NM_ACTIVE_CONNECTION_GET_CLASS (self)->master_failed)
NM_ACTIVE_CONNECTION_GET_CLASS (self)->master_failed (self);
}
}
gboolean
nm_active_connection_set_device (NMActiveConnection *self, NMDevice *device)
{
......@@ -374,10 +396,10 @@ nm_active_connection_set_device (NMActiveConnection *self, NMDevice *device)
priv->device = g_object_ref (device);
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_INT_DEVICE);
priv->device_state_id = g_signal_connect (device,
"state-changed",
G_CALLBACK (device_state_changed),
self);
g_signal_connect (device, "state-changed",
G_CALLBACK (device_state_changed), self);
g_signal_connect (device, "notify::master",
G_CALLBACK (device_master_changed), self);
priv->pending_activation_id = g_strdup_printf ("activation::%p", (void *)self);
nm_device_add_pending_action (device, priv->pending_activation_id);
......@@ -457,7 +479,6 @@ master_state_cb (NMActiveConnection *master,
gpointer user_data)
{
NMActiveConnection *self = NM_ACTIVE_CONNECTION (user_data);
NMActiveConnectionState self_state = nm_active_connection_get_state (self);
NMActiveConnectionState master_state = nm_active_connection_get_state (master);
check_master_ready (self);
......@@ -465,15 +486,9 @@ master_state_cb (NMActiveConnection *master,
nm_log_dbg (LOGD_DEVICE, "(%p): master ActiveConnection [%p] state now '%s' (%d)",
self, master, state_to_string (master_state), master_state);
/* Master is deactivating, so this active connection must also deactivate */
if (self_state < NM_ACTIVE_CONNECTION_STATE_DEACTIVATING &&
master_state >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) {
nm_log_dbg (LOGD_DEVICE, "(%p): master ActiveConnection [%p] '%s' failed",
self, master, nm_active_connection_get_name (master));
g_signal_handlers_disconnect_by_func (master,
(GCallback) master_state_cb,
self);
if (master_state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATING &&
nm_active_connection_get_device (master) == NULL) {
/* Master failed without ever creating its device */
if (NM_ACTIVE_CONNECTION_GET_CLASS (self)->master_failed)
NM_ACTIVE_CONNECTION_GET_CLASS (self)->master_failed (self);
}
......@@ -761,24 +776,28 @@ get_property (GObject *object, guint prop_id,
}
static void
_device_cleanup (NMActiveConnectionPrivate *priv)
_device_cleanup (NMActiveConnection *self)
{
if (priv->device_state_id) {
g_assert (priv->device);
g_signal_handler_disconnect (priv->device, priv->device_state_id);
priv->device_state_id = 0;
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self);
if (priv->device) {
g_signal_handlers_disconnect_by_func (priv->device, G_CALLBACK (device_state_changed), self);
g_signal_handlers_disconnect_by_func (priv->device, G_CALLBACK (device_master_changed), self);
}
if (priv->pending_activation_id) {
nm_device_remove_pending_action (priv->device, priv->pending_activation_id);
g_clear_pointer (&priv->pending_activation_id, g_free);
}
g_clear_object (&priv->device);
}
static void
dispose (GObject *object)
{
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object);
NMActiveConnection *self = NM_ACTIVE_CONNECTION (object);
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self);
if (priv->chain) {
nm_auth_chain_unref (priv->chain);
......@@ -792,12 +811,12 @@ dispose (GObject *object)
g_clear_object (&priv->connection);
_device_cleanup (priv);
_device_cleanup (self);
if (priv->master) {
g_signal_handlers_disconnect_by_func (priv->master,
(GCallback) master_state_cb,
NM_ACTIVE_CONNECTION (object));
self);
}
g_clear_object (&priv->master);
g_clear_object (&priv->subject);
......
......@@ -41,15 +41,6 @@ nm_connection_provider_get_connections (NMConnectionProvider *self)
return NULL;
}
gboolean
nm_connection_provider_has_connections_loaded (NMConnectionProvider *self)
{
g_return_val_if_fail (NM_IS_CONNECTION_PROVIDER (self), FALSE);
g_assert (NM_CONNECTION_PROVIDER_GET_INTERFACE (self)->has_connections_loaded);
return NM_CONNECTION_PROVIDER_GET_INTERFACE (self)->has_connections_loaded (self);
}
/**
* nm_connection_provider_add_connection:
* @self: the #NMConnectionProvider
......@@ -131,14 +122,6 @@ nm_connection_provider_init (gpointer g_iface)
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, G_TYPE_OBJECT);
g_signal_new (NM_CP_SIGNAL_CONNECTIONS_LOADED,
iface_type,
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMConnectionProvider, connections_loaded),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
GType
......
......@@ -29,7 +29,6 @@ typedef struct _NMConnectionProvider NMConnectionProvider;
#define NM_CP_SIGNAL_CONNECTION_ADDED "cp-connection-added"
#define NM_CP_SIGNAL_CONNECTION_UPDATED "cp-connection-updated"
#define NM_CP_SIGNAL_CONNECTION_REMOVED "cp-connection-removed"
#define NM_CP_SIGNAL_CONNECTIONS_LOADED "cp-connections-loaded"
/**
......@@ -58,8 +57,6 @@ struct _NMConnectionProvider {
const GSList * (*get_connections) (NMConnectionProvider *self);
gboolean (*has_connections_loaded) (NMConnectionProvider *self);
NMConnection * (*add_connection) (NMConnectionProvider *self,
NMConnection *connection,
gboolean save_to_disk,
......@@ -75,7 +72,6 @@ struct _NMConnectionProvider {
void (*connection_removed) (NMConnectionProvider *self, NMConnection *connection);
void (*connections_loaded) (NMConnectionProvider *self);
};
GType nm_connection_provider_get_type (void);
......@@ -113,19 +109,6 @@ GSList *nm_connection_provider_get_best_connections (NMConnectionProvider *self,
*/
const GSList *nm_connection_provider_get_connections (NMConnectionProvider *self);
/**
* nm_connection_provider_has_connections_loaded:
* @self: the #NMConnectionProvider
*
* Returns: TRUE or FALSE indicating whether the connections of the provider are already
* loaded. If they are not yet loaded, the provider will not emit the signals
* NM_CP_SIGNAL_CONNECTION_ADDED, NM_CP_SIGNAL_CONNECTION_UPDATED and
* NM_CP_SIGNAL_CONNECTION_REMOVED until NM_CP_SIGNAL_CONNECTIONS_LOADED gets
* emited.
*/
gboolean nm_connection_provider_has_connections_loaded (NMConnectionProvider *self);
/**
* nm_connection_provider_add_connection:
* @self: the #NMConnectionProvider
......
......@@ -249,9 +249,6 @@ typedef struct {
guint timestamp_update_id;
/* Track auto-activation for software devices */
GHashTable *noauto_sw_devices;
gboolean startup;
gboolean disposed;
} NMManagerPrivate;
......@@ -1214,21 +1211,11 @@ system_create_virtual_devices (NMManager *self)
connections = nm_settings_get_connections (priv->settings);
for (iter = connections; iter; iter = g_slist_next (iter)) {
NMConnection *connection = iter->data;
NMSettingConnection *s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (connection_needs_virtual_device (connection)) {
char *iface = get_virtual_iface_name (self, connection, NULL);
/* We only create a virtual interface if the connection can autoconnect
* and the interface was not manually disconnected before.
*/
if ( nm_setting_connection_get_autoconnect (s_con)
&& iface
&& nm_manager_can_device_auto_connect (self, iface))
system_create_virtual_device (self, connection);
g_free (iface);
}
/* We only create a virtual interface if the connection can autoconnect */
if ( connection_needs_virtual_device (connection)
&& nm_settings_connection_can_autoconnect (NM_SETTINGS_CONNECTION (connection)))
system_create_virtual_device (self, connection);
}
g_slist_free (connections);
}
......@@ -2720,31 +2707,8 @@ _internal_activate_device (NMManager *self, NMActiveConnection *active, GError *
device = nm_active_connection_get_device (active);
if (!device) {
char *iface;
g_assert (connection_needs_virtual_device (connection));
iface = get_virtual_iface_name (self, connection, NULL);
g_assert (iface);
/* Create the software device. Only exception is when:
* - this is an auto-activation *and* the device denies auto-activation
* at this time (the device was manually disconnected/deleted before)
*/
if (!nm_manager_can_device_auto_connect (self, iface)) {
if (nm_active_connection_get_user_requested (active)) {
/* Manual activation - allow device auto-activation again */
nm_manager_prevent_device_auto_connect (self, iface, FALSE);
} else {
g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_AUTOCONNECT_NOT_ALLOWED,
"Automatic activation of '%s' not allowed for connection '%s'",
iface, nm_connection_get_id (connection));
g_free (iface);
return FALSE;
}
}
g_free (iface);
device = system_create_virtual_device (self, connection);
if (!device) {
g_set_error_literal (error,
......@@ -2978,6 +2942,22 @@ _new_active_connection (NMManager *self,
device);
}
static void
_internal_activation_failed (NMManager *self,
NMActiveConnection *active,
const char *error_desc)
{
nm_log_warn (LOGD_CORE, "Failed to activate '%s': %s",
nm_connection_get_id (nm_active_connection_get_connection (active)),
error_desc);
if (nm_active_connection_get_state (active) <= NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
nm_active_connection_set_state (active, NM_ACTIVE_CONNECTION_STATE_DEACTIVATING);
nm_active_connection_set_state (active, NM_ACTIVE_CONNECTION_STATE_DEACTIVATED);
}
active_connection_remove (self, active);
}
static void
_internal_activation_auth_done (NMActiveConnection *active,
gboolean success,
......@@ -2992,12 +2972,9 @@ _internal_activation_auth_done (NMActiveConnection *active,
if (_internal_activate_generic (self, active, &error))
return;
}
g_assert (error_desc || error);
active_connection_remove (self, active);
nm_log_warn (LOGD_CORE, "Failed to activate '%s': %s",
nm_connection_get_id (nm_active_connection_get_connection (active)),
error_desc ? error_desc : error->message);
g_assert (error_desc || error);
_internal_activation_failed (self, active, error_desc ? error_desc : error->message);
g_clear_error (&error);
}
......@@ -3166,8 +3143,8 @@ activation_auth_done (NMActiveConnection *active,
error_desc);
}
active_connection_remove (self, active);
dbus_g_method_return_error (context, error);
_internal_activation_failed (self, active, error->message);
g_error_free (error);
}
......@@ -3311,10 +3288,8 @@ activation_add_done (NMSettings *self,
error = local;
}
active_connection_remove (info->manager, info->active);
if (error)
dbus_g_method_return_error (context, error);
_internal_activation_failed (info->manager, info->active, error->message);
dbus_g_method_return_error (context, error);
g_clear_error (&local);
done:
......@@ -3489,9 +3464,8 @@ nm_manager_deactivate_connection (NMManager *manager,
"The VPN connection was not active.");
} else {
g_assert (NM_IS_ACT_REQUEST (active));
/* FIXME: use DEACTIVATING state */
nm_device_state_changed (nm_active_connection_get_device (active),
NM_DEVICE_STATE_DISCONNECTED,
NM_DEVICE_STATE_DEACTIVATING,
reason);
success = TRUE;
}
......@@ -3618,33 +3592,6 @@ done:
g_clear_error (&error);
}
/*
* Track (software) devices that cannot auto activate.
* It is needed especially for software devices, that can be removed and added
* again. So we can't simply use a flag inside the device.
*/
void
nm_manager_prevent_device_auto_connect (NMManager *manager, const char *ifname, gboolean prevent)
{
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
if (prevent)
g_hash_table_add (priv->noauto_sw_devices, g_strdup (ifname));
else
g_hash_table_remove (priv->noauto_sw_devices, ifname);
}
gboolean
nm_manager_can_device_auto_connect (NMManager *manager, const char *ifname)
{
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
if (!ifname)
return FALSE;
return !g_hash_table_contains (priv->noauto_sw_devices, ifname);
}
static void
do_sleep_wake (NMManager *self)
{
......@@ -4720,8 +4667,6 @@ dispose (GObject *object)
g_object_unref (priv->fw_monitor);
}
g_hash_table_unref (priv->noauto_sw_devices);
g_slist_free (priv->factories);
if (priv->timestamp_update_id) {
......@@ -5086,9 +5031,6 @@ nm_manager_init (NMManager *manager)
KERNEL_FIRMWARE_DIR);
}
/* Hash table storing software devices that should not auto activate */
priv->noauto_sw_devices = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
load_device_factories (manager);
/* Update timestamps in active connections */
......
......@@ -128,12 +128,6 @@ gboolean nm_manager_deactivate_connection (NMManager *manager,
NMDeviceStateReason reason,
GError **error);
void nm_manager_prevent_device_auto_connect (NMManager *manager,
const char *ifname,
gboolean prevent);
gboolean nm_manager_can_device_auto_connect (NMManager *manager,
const char *ifname);
/* State handling */
NMState nm_manager_get_state (NMManager *manager);
......
This diff is collapsed.
......@@ -124,6 +124,11 @@ typedef struct {
guint64 timestamp; /* Up-to-date timestamp of connection use */
gboolean timestamp_set;
GHashTable *seen_bssids; /* Up-to-date BSSIDs that's been seen for the connection */
int autoconnect_retries;
time_t autoconnect_retry_time;
NMDeviceStateReason autoconnect_blocked_reason;
} NMSettingsConnectionPrivate;
/**************************************************************/
......@@ -1899,6 +1904,78 @@ nm_settings_connection_read_and_fill_seen_bssids (NMSettingsConnection *connecti
}
}
#define AUTOCONNECT_RETRIES_DEFAULT 4
#define AUTOCONNECT_RESET_RETRIES_TIMER 300
int
nm_settings_connection_get_autoconnect_retries (NMSettingsConnection *connection)
{
return NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->autoconnect_retries;
}
void
nm_settings_connection_set_autoconnect_retries (NMSettingsConnection *connection,
int retries)
{
NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection);
priv->autoconnect_retries = retries;
if (retries)
priv->autoconnect_retry_time = 0;
else
priv->autoconnect_retry_time = time (NULL) + AUTOCONNECT_RESET_RETRIES_TIMER;
}
void
nm_settings_connection_reset_autoconnect_retries (NMSettingsConnection *connection)
{
nm_settings_connection_set_autoconnect_retries (connection, AUTOCONNECT_RETRIES_DEFAULT);
}
time_t
nm_settings_connection_get_autoconnect_retry_time (NMSettingsConnection *connection)
{
return NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->autoconnect_retry_time;
}
NMDeviceStateReason
nm_settings_connection_get_autoconnect_blocked_reason (NMSettingsConnection *connection)
{
return NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->autoconnect_blocked_reason;
}
void
nm_settings_connection_set_autoconnect_blocked_reason (NMSettingsConnection *connection,
NMDeviceStateReason reason)
{
NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->autoconnect_blocked_reason = reason;
}
gboolean
nm_settings_connection_can_autoconnect (NMSettingsConnection *connection)
{
NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection);
NMSettingConnection *s_con;
const char *permission;
if ( !priv->visible
|| priv->autoconnect_retries == 0
|| priv->autoconnect_blocked_reason != NM_DEVICE_STATE_REASON_NONE)
return FALSE;
s_con = nm_connection_get_setting_connection (NM_CONNECTION (connection));
if (!nm_setting_connection_get_autoconnect (s_con))
return FALSE;
permission = nm_utils_get_shared_wifi_permission (NM_CONNECTION (connection));
if (permission) {
if (nm_settings_connection_check_permission (connection, permission) == FALSE)
return FALSE;
}
return TRUE;
}
/**************************************************************/
static void
......@@ -1918,6 +1995,9 @@ nm_settings_connection_init (NMSettingsConnection *self)
priv->seen_bssids = g_hash_table_new_full (mac_hash, mac_equal, g_free, g_free);
priv->autoconnect_retries = AUTOCONNECT_RETRIES_DEFAULT;
priv->autoconnect_blocked_reason = NM_DEVICE_STATE_REASON_NONE;
g_signal_connect (self, NM_CONNECTION_SECRETS_CLEARED, G_CALLBACK (secrets_cleared_cb), NULL);
g_signal_connect (self, NM_CONNECTION_CHANGED, G_CALLBACK (changed_cb), GUINT_TO_POINTER (TRUE));
}
......
......@@ -149,6 +149,19 @@ void nm_settings_connection_add_seen_bssid (NMSettingsConnection *connection,
void nm_settings_connection_read_and_fill_seen_bssids (NMSettingsConnection *connection);
int nm_settings_connection_get_autoconnect_retries (NMSettingsConnection *connection);
void nm_settings_connection_set_autoconnect_retries (NMSettingsConnection *connection,
int retries);
void nm_settings_connection_reset_autoconnect_retries (NMSettingsConnection *connection);
time_t nm_settings_connection_get_autoconnect_retry_time (NMSettingsConnection *connection);
NMDeviceStateReason nm_settings_connection_get_autoconnect_blocked_reason (NMSettingsConnection *connection);
void nm_settings_connection_set_autoconnect_blocked_reason (NMSettingsConnection *connection,
NMDeviceStateReason reason);
gboolean nm_settings_connection_can_autoconnect (NMSettingsConnection *connection);
G_END_DECLS
#endif /* NM_SETTINGS_CONNECTION_H */
......@@ -152,7 +152,6 @@ enum {
CONNECTION_UPDATED_BY_USER,
CONNECTION_REMOVED,
CONNECTION_VISIBILITY_CHANGED,
CONNECTIONS_LOADED,
AGENT_REGISTERED,
NEW_CONNECTION, /* exported, not used internally */
......@@ -183,9 +182,6 @@ load_connections (NMSettings *self)
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
GSList *iter;
if (priv->connections_loaded)
return;
for (iter = priv->plugins; iter; iter = g_slist_next (iter)) {
NMSystemConfigInterface *plugin = NM_SYSTEM_CONFIG_INTERFACE (iter->data);
GSList *plugin_connections;
......@@ -214,9 +210,6 @@ load_connections (NMSettings *self)
unmanaged_specs_changed (NULL, self);
unrecognized_specs_changed (NULL, self);
g_signal_emit (self, signals[CONNECTIONS_LOADED], 0);
g_signal_emit_by_name (self, NM_CP_SIGNAL_CONNECTIONS_LOADED);
}
void
......@@ -233,8 +226,6 @@ nm_settings_for_each_connection (NMSettings *self,
priv = NM_SETTINGS_GET_PRIVATE (self);
load_connections (self);
g_hash_table_iter_init (&iter, priv->connections);
while (g_hash_table_iter_next (&iter, NULL, &data))
for_each_func (self, NM_SETTINGS_CONNECTION (data), user_data);
......@@ -249,8 +240,6 @@ impl_settings_list_connections (NMSettings *self,
GHashTableIter iter;
gpointer key;
load_connections (self);
*connections = g_ptr_array_sized_new (g_hash_table_size (priv->connections) + 1);
g_hash_table_iter_init (&iter, priv->connections);
while (g_hash_table_iter_next (&iter, &key, NULL))
......@@ -270,8 +259,6 @@ nm_settings_get_connection_by_uuid (NMSettings *self, const char *uuid)
priv = NM_SETTINGS_GET_PRIVATE (self);
load_connections (self);
g_hash_table_iter_init (&iter, priv->connections);
while (g_hash_table_iter_next (&iter, NULL, (gpointer) &candidate)) {
if (g_strcmp0 (uuid, nm_connection_get_uuid (NM_CONNECTION (candidate))) == 0)
......@@ -361,8 +348,6 @@ nm_settings_get_connection_by_path (NMSettings *self, const char *path)
priv = NM_SETTINGS_GET_PRIVATE (self);
load_connections (self);
return (NMSettingsConnection *) g_hash_table_lookup (priv->connections, path);
}
......@@ -416,7 +401,6 @@ nm_settings_get_unmanaged_specs (NMSettings *self)
{
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
load_connections (self);
return priv->unmanaged_specs;
}
......@@ -861,9 +845,7 @@ claim_connection (NMSettings *self,
g_object_ref (connection));
/* Only emit the individual connection-added signal after connections
* have been initially loaded. While getting the first list of connections
* we suppress it, then send the connections-loaded signal after we're all
* done to minimize processing.
* have been initially loaded.
*/
if (priv->connections_loaded) {
/* Internal added signal */
......@@ -1314,14 +1296,10 @@ impl_settings_reload_connections (NMSettings *self,
if (!ensure_root (priv->dbus_mgr, context))
return;