mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 16:10:11 +01:00
core: merge branch 'th/wait-carrier-rh1079353'
The wait-for-carrier patches from rh#1079353 had several issues. With this, the feature should work mostly. https://bugzilla.redhat.com/show_bug.cgi?id=1079353
This commit is contained in:
commit
e5f7fa314c
2 changed files with 14 additions and 15 deletions
|
|
@ -1341,9 +1341,7 @@ nm_device_set_carrier (NMDevice *self, gboolean carrier)
|
|||
link_disconnect_action_cancel (self);
|
||||
klass->carrier_changed (self, TRUE);
|
||||
|
||||
if (priv->carrier_wait_id) {
|
||||
g_source_remove (priv->carrier_wait_id);
|
||||
priv->carrier_wait_id = 0;
|
||||
if (nm_clear_g_source (&priv->carrier_wait_id)) {
|
||||
nm_device_remove_pending_action (self, "carrier wait", TRUE);
|
||||
_carrier_wait_check_queued_act_request (self);
|
||||
}
|
||||
|
|
@ -6624,7 +6622,7 @@ _carrier_wait_check_queued_act_request (NMDevice *self)
|
|||
priv->queued_act_request_is_waiting_for_carrier = FALSE;
|
||||
if (!priv->carrier) {
|
||||
_LOGD (LOGD_DEVICE, "Cancel queued activation request as we have no carrier after timeout");
|
||||
g_clear_object (&priv->queued_act_request);
|
||||
_clear_queued_act_request (priv);
|
||||
} else {
|
||||
_LOGD (LOGD_DEVICE, "Activate queued activation request as we now have carrier");
|
||||
queued_req = priv->queued_act_request;
|
||||
|
|
@ -6648,6 +6646,8 @@ _carrier_wait_check_act_request_must_queue (NMDevice *self, NMActRequest *req)
|
|||
return FALSE;
|
||||
|
||||
connection = nm_act_request_get_applied_connection (req);
|
||||
if (!connection_requires_carrier (connection))
|
||||
return FALSE;
|
||||
|
||||
if (!nm_device_check_connection_available (self, connection, NM_DEVICE_CHECK_CON_AVAILABLE_ALL, NULL)) {
|
||||
/* We passed all @flags we have, and no @specific_object.
|
||||
|
|
@ -7430,9 +7430,7 @@ nm_device_bring_up (NMDevice *self, gboolean block, gboolean *no_firmware)
|
|||
* a timeout is reached.
|
||||
*/
|
||||
if (nm_device_has_capability (self, NM_DEVICE_CAP_CARRIER_DETECT)) {
|
||||
if (priv->carrier_wait_id)
|
||||
g_source_remove (priv->carrier_wait_id);
|
||||
else
|
||||
if (!nm_clear_g_source (&priv->carrier_wait_id))
|
||||
nm_device_add_pending_action (self, "carrier wait", TRUE);
|
||||
priv->carrier_wait_id = g_timeout_add_seconds (5, carrier_wait_timeout, self);
|
||||
}
|
||||
|
|
@ -9746,10 +9744,7 @@ dispose (GObject *object)
|
|||
|
||||
g_hash_table_remove_all (priv->available_connections);
|
||||
|
||||
if (priv->carrier_wait_id) {
|
||||
g_source_remove (priv->carrier_wait_id);
|
||||
priv->carrier_wait_id = 0;
|
||||
}
|
||||
nm_clear_g_source (&priv->carrier_wait_id);
|
||||
|
||||
_clear_queued_act_request (priv);
|
||||
|
||||
|
|
|
|||
|
|
@ -2030,20 +2030,24 @@ nm_manager_get_connection_device (NMManager *self,
|
|||
|
||||
static NMDevice *
|
||||
nm_manager_get_best_device_for_connection (NMManager *self,
|
||||
NMConnection *connection)
|
||||
NMConnection *connection,
|
||||
gboolean for_user_request)
|
||||
{
|
||||
const GSList *devices, *iter;
|
||||
NMDevice *act_device = nm_manager_get_connection_device (self, connection);
|
||||
NMDeviceCheckConAvailableFlags flags;
|
||||
|
||||
if (act_device)
|
||||
return act_device;
|
||||
|
||||
flags = for_user_request ? NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST : NM_DEVICE_CHECK_CON_AVAILABLE_NONE;
|
||||
|
||||
/* Pick the first device that's compatible with the connection. */
|
||||
devices = nm_manager_get_devices (self);
|
||||
for (iter = devices; iter; iter = g_slist_next (iter)) {
|
||||
NMDevice *device = NM_DEVICE (iter->data);
|
||||
|
||||
if (nm_device_check_connection_available (device, connection, NM_DEVICE_CHECK_CON_AVAILABLE_NONE, NULL))
|
||||
if (nm_device_check_connection_available (device, connection, flags, NULL))
|
||||
return device;
|
||||
}
|
||||
|
||||
|
|
@ -2530,7 +2534,7 @@ autoconnect_slaves (NMManager *manager,
|
|||
nm_manager_activate_connection (manager,
|
||||
slave_connection,
|
||||
NULL,
|
||||
nm_manager_get_best_device_for_connection (manager, NM_CONNECTION (slave_connection)),
|
||||
nm_manager_get_best_device_for_connection (manager, NM_CONNECTION (slave_connection), FALSE),
|
||||
subject,
|
||||
&local_err);
|
||||
if (local_err) {
|
||||
|
|
@ -3051,7 +3055,7 @@ validate_activation_request (NMManager *self,
|
|||
goto error;
|
||||
}
|
||||
} else
|
||||
device = nm_manager_get_best_device_for_connection (self, connection);
|
||||
device = nm_manager_get_best_device_for_connection (self, connection, TRUE);
|
||||
|
||||
if (!device) {
|
||||
gboolean is_software = nm_connection_is_virtual (connection);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue