summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2017-05-25 18:22:44 +0200
committerLubomir Rintel <lkundrak@v3.sk>2017-05-31 20:18:12 +0200
commitb866a12667224bbed3029897a873126f499807bb (patch)
tree0665392753d7f80189a090fa7cf95410c8764cd9
parent805d3240f9363f5ea5d57000f2920234bf6cd152 (diff)
downloadNetworkManager-b866a12667224bbed3029897a873126f499807bb.tar.gz
device: retry autoactivation upon a component addition
It might have changed circumstances that were blocking the autoactivation.
-rw-r--r--src/devices/bluetooth/nm-device-bt.c2
-rw-r--r--src/devices/nm-device.c14
2 files changed, 14 insertions, 2 deletions
diff --git a/src/devices/bluetooth/nm-device-bt.c b/src/devices/bluetooth/nm-device-bt.c
index 3402532fca..16630996a7 100644
--- a/src/devices/bluetooth/nm-device-bt.c
+++ b/src/devices/bluetooth/nm-device-bt.c
@@ -647,7 +647,7 @@ component_added (NMDevice *device, GObject *component)
NMDeviceState state;
NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_NONE;
- if (!NM_IS_MODEM (component))
+ if (!component || !NM_IS_MODEM (component))
return FALSE;
modem = NM_MODEM (component);
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index ca816ec1e4..e11b7158fb 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -3291,13 +3291,25 @@ gboolean
nm_device_notify_component_added (NMDevice *self, GObject *component)
{
NMDeviceClass *klass;
+ NMDevicePrivate *priv;
g_return_val_if_fail (NM_IS_DEVICE (self), FALSE);
- g_return_val_if_fail (G_IS_OBJECT (component), FALSE);
+ priv = NM_DEVICE_GET_PRIVATE (self);
klass = NM_DEVICE_GET_CLASS (self);
+
+ if (priv->state == NM_DEVICE_STATE_DISCONNECTED) {
+ /* A device could have stayed disconnected because it would
+ * want to register with a network server that now become
+ * available. */
+ nm_device_recheck_available_connections (self);
+ if (g_hash_table_size (priv->available_connections) > 0)
+ nm_device_emit_recheck_auto_activate (self);
+ }
+
if (klass->component_added)
return klass->component_added (self, component);
+
return FALSE;
}