diff options
author | Dan Williams <dcbw@redhat.com> | 2014-10-13 10:23:11 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2014-10-27 13:46:06 -0500 |
commit | 82d62c2c4ee8899d5e880d11d25bab891cd9e753 (patch) | |
tree | 5857ff0db2c179222c6f165e79af4530a604a675 | |
parent | 7afdd9c97960b532324c6a1208f09dea3ecb9219 (diff) | |
download | NetworkManager-82d62c2c4ee8899d5e880d11d25bab891cd9e753.tar.gz |
core: allow default unmanaged devices to have available connections when unmanaged
Default unmanaged devices become managed when the user explicitly activated
a connection on the device, but the user can't do that unless the device
has some available connections. Fix things up so that default unmanaged
devices can have available connections.
-rw-r--r-- | src/devices/nm-device.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 45bcd22a83..4b0840443d 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -6288,7 +6288,8 @@ _clear_available_connections (NMDevice *self, gboolean do_signal) static gboolean _try_add_available_connection (NMDevice *self, NMConnection *connection) { - if (nm_device_get_state (self) < NM_DEVICE_STATE_DISCONNECTED) + if ( nm_device_get_state (self) < NM_DEVICE_STATE_DISCONNECTED + && !nm_device_get_default_unmanaged (self)) return FALSE; if (nm_device_check_connection_compatible (self, connection)) { @@ -6775,8 +6776,8 @@ _set_state_full (NMDevice *self, } /* Update the available connections list when a device first becomes available */ - if ( state >= NM_DEVICE_STATE_DISCONNECTED - && old_state < NM_DEVICE_STATE_DISCONNECTED) + if ( (state >= NM_DEVICE_STATE_DISCONNECTED && old_state < NM_DEVICE_STATE_DISCONNECTED) + || nm_device_get_default_unmanaged (self)) nm_device_recheck_available_connections (self); /* Handle the new state here; but anything that could trigger @@ -7392,6 +7393,13 @@ constructed (GObject *object) G_CALLBACK (cp_connection_updated), self); + /* Update default-unmanaged device available connections immediately, + * since they don't transition from UNMANAGED (and thus the state handler + * doesn't run and update them) until something external happens. + */ + if (nm_device_get_default_unmanaged (self)) + nm_device_recheck_available_connections (self); + G_OBJECT_CLASS (nm_device_parent_class)->constructed (object); } |