|
|
ab7d06 |
From 2b62887a170766241826ae8747c46d9b74c399ca Mon Sep 17 00:00:00 2001
|
|
|
ab7d06 |
From: Thomas Haller <thaller@redhat.com>
|
|
|
ab7d06 |
Date: Mon, 19 Oct 2015 14:14:17 +0200
|
|
|
ab7d06 |
Subject: [PATCH 1/4] manager: fix activation without specified device
|
|
|
ab7d06 |
|
|
|
ab7d06 |
For an explicit user-request, we relax some checks when searching for a suitable
|
|
|
ab7d06 |
device; such as requiring-carrier.
|
|
|
ab7d06 |
|
|
|
ab7d06 |
Without this patch, a connection-up while the device has no carrier yet,
|
|
|
ab7d06 |
would fail right away with "No suitable device found for this connection."
|
|
|
ab7d06 |
|
|
|
ab7d06 |
https://bugzilla.redhat.com/show_bug.cgi?id=1079353
|
|
|
ab7d06 |
Fixes: 0bfe635119facb8514e8f5824f599f4c4c3514e2
|
|
|
ab7d06 |
(cherry picked from commit cff3e93527b589138efa4beb829e5ed875e40973)
|
|
|
ab7d06 |
(cherry picked from commit 31b594561c08be233ef1e91734d9efe979d65954)
|
|
|
ab7d06 |
---
|
|
|
ab7d06 |
src/nm-manager.c | 12 ++++++++----
|
|
|
ab7d06 |
1 file changed, 8 insertions(+), 4 deletions(-)
|
|
|
ab7d06 |
|
|
|
ab7d06 |
diff --git a/src/nm-manager.c b/src/nm-manager.c
|
|
|
ab7d06 |
index d91a0d7..a6c23b1 100644
|
|
|
ab7d06 |
--- a/src/nm-manager.c
|
|
|
ab7d06 |
+++ b/src/nm-manager.c
|
|
|
ab7d06 |
@@ -2088,20 +2088,24 @@ nm_manager_get_connection_device (NMManager *self,
|
|
|
ab7d06 |
|
|
|
ab7d06 |
static NMDevice *
|
|
|
ab7d06 |
nm_manager_get_best_device_for_connection (NMManager *self,
|
|
|
ab7d06 |
- NMConnection *connection)
|
|
|
ab7d06 |
+ NMConnection *connection,
|
|
|
ab7d06 |
+ gboolean for_user_request)
|
|
|
ab7d06 |
{
|
|
|
ab7d06 |
const GSList *devices, *iter;
|
|
|
ab7d06 |
NMDevice *act_device = nm_manager_get_connection_device (self, connection);
|
|
|
ab7d06 |
+ NMDeviceCheckConAvailableFlags flags;
|
|
|
ab7d06 |
|
|
|
ab7d06 |
if (act_device)
|
|
|
ab7d06 |
return act_device;
|
|
|
ab7d06 |
|
|
|
ab7d06 |
+ flags = for_user_request ? NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST : NM_DEVICE_CHECK_CON_AVAILABLE_NONE;
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
/* Pick the first device that's compatible with the connection. */
|
|
|
ab7d06 |
devices = nm_manager_get_devices (self);
|
|
|
ab7d06 |
for (iter = devices; iter; iter = g_slist_next (iter)) {
|
|
|
ab7d06 |
NMDevice *device = NM_DEVICE (iter->data);
|
|
|
ab7d06 |
|
|
|
ab7d06 |
- if (nm_device_check_connection_available (device, connection, NM_DEVICE_CHECK_CON_AVAILABLE_NONE, NULL))
|
|
|
ab7d06 |
+ if (nm_device_check_connection_available (device, connection, flags, NULL))
|
|
|
ab7d06 |
return device;
|
|
|
ab7d06 |
}
|
|
|
ab7d06 |
|
|
|
ab7d06 |
@@ -2581,7 +2585,7 @@ autoconnect_slaves (NMManager *manager,
|
|
|
ab7d06 |
nm_manager_activate_connection (manager,
|
|
|
ab7d06 |
slave_connection,
|
|
|
ab7d06 |
NULL,
|
|
|
ab7d06 |
- nm_manager_get_best_device_for_connection (manager, slave_connection),
|
|
|
ab7d06 |
+ nm_manager_get_best_device_for_connection (manager, slave_connection, FALSE),
|
|
|
ab7d06 |
subject,
|
|
|
ab7d06 |
&local_err);
|
|
|
ab7d06 |
if (local_err) {
|
|
|
ab7d06 |
@@ -3092,7 +3096,7 @@ validate_activation_request (NMManager *self,
|
|
|
ab7d06 |
goto error;
|
|
|
ab7d06 |
}
|
|
|
ab7d06 |
} else
|
|
|
ab7d06 |
- device = nm_manager_get_best_device_for_connection (self, connection);
|
|
|
ab7d06 |
+ device = nm_manager_get_best_device_for_connection (self, connection, TRUE);
|
|
|
ab7d06 |
|
|
|
ab7d06 |
if (!device) {
|
|
|
ab7d06 |
gboolean is_software = nm_connection_is_virtual (connection);
|
|
|
ab7d06 |
--
|
|
|
ab7d06 |
2.4.3
|
|
|
ab7d06 |
|
|
|
ab7d06 |
|
|
|
ab7d06 |
From 0ffd074d4ef555984542ce05f93c839487acfaca Mon Sep 17 00:00:00 2001
|
|
|
ab7d06 |
From: Thomas Haller <thaller@redhat.com>
|
|
|
ab7d06 |
Date: Mon, 19 Oct 2015 14:26:52 +0200
|
|
|
ab7d06 |
Subject: [PATCH 2/4] device: refactor using nm_clear_g_source() for
|
|
|
ab7d06 |
priv->carrier_wait_id
|
|
|
ab7d06 |
|
|
|
ab7d06 |
(cherry picked from commit c89fd1ea76421ab63bbc227e4c12924f197e6585)
|
|
|
ab7d06 |
(cherry picked from commit 971a7611bdab8da2c1f6f3ef199f99999202b93a)
|
|
|
ab7d06 |
---
|
|
|
ab7d06 |
src/devices/nm-device.c | 13 +++----------
|
|
|
ab7d06 |
1 file changed, 3 insertions(+), 10 deletions(-)
|
|
|
ab7d06 |
|
|
|
ab7d06 |
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
|
|
|
ab7d06 |
index 5e413ba..8b2fa33 100644
|
|
|
ab7d06 |
--- a/src/devices/nm-device.c
|
|
|
ab7d06 |
+++ b/src/devices/nm-device.c
|
|
|
ab7d06 |
@@ -1325,9 +1325,7 @@ nm_device_set_carrier (NMDevice *self, gboolean carrier)
|
|
|
ab7d06 |
link_disconnect_action_cancel (self);
|
|
|
ab7d06 |
klass->carrier_changed (self, TRUE);
|
|
|
ab7d06 |
|
|
|
ab7d06 |
- if (priv->carrier_wait_id) {
|
|
|
ab7d06 |
- g_source_remove (priv->carrier_wait_id);
|
|
|
ab7d06 |
- priv->carrier_wait_id = 0;
|
|
|
ab7d06 |
+ if (nm_clear_g_source (&priv->carrier_wait_id)) {
|
|
|
ab7d06 |
nm_device_remove_pending_action (self, "carrier wait", TRUE);
|
|
|
ab7d06 |
_carrier_wait_check_queued_act_request (self);
|
|
|
ab7d06 |
}
|
|
|
ab7d06 |
@@ -7113,9 +7111,7 @@ nm_device_bring_up (NMDevice *self, gboolean block, gboolean *no_firmware)
|
|
|
ab7d06 |
* a timeout is reached.
|
|
|
ab7d06 |
*/
|
|
|
ab7d06 |
if (nm_device_has_capability (self, NM_DEVICE_CAP_CARRIER_DETECT)) {
|
|
|
ab7d06 |
- if (priv->carrier_wait_id)
|
|
|
ab7d06 |
- g_source_remove (priv->carrier_wait_id);
|
|
|
ab7d06 |
- else
|
|
|
ab7d06 |
+ if (!nm_clear_g_source (&priv->carrier_wait_id))
|
|
|
ab7d06 |
nm_device_add_pending_action (self, "carrier wait", TRUE);
|
|
|
ab7d06 |
priv->carrier_wait_id = g_timeout_add_seconds (5, carrier_wait_timeout, self);
|
|
|
ab7d06 |
}
|
|
|
ab7d06 |
@@ -9245,10 +9241,7 @@ dispose (GObject *object)
|
|
|
ab7d06 |
|
|
|
ab7d06 |
g_hash_table_remove_all (priv->available_connections);
|
|
|
ab7d06 |
|
|
|
ab7d06 |
- if (priv->carrier_wait_id) {
|
|
|
ab7d06 |
- g_source_remove (priv->carrier_wait_id);
|
|
|
ab7d06 |
- priv->carrier_wait_id = 0;
|
|
|
ab7d06 |
- }
|
|
|
ab7d06 |
+ nm_clear_g_source (&priv->carrier_wait_id);
|
|
|
ab7d06 |
|
|
|
ab7d06 |
_clear_queued_act_request (priv);
|
|
|
ab7d06 |
|
|
|
ab7d06 |
--
|
|
|
ab7d06 |
2.4.3
|
|
|
ab7d06 |
|
|
|
ab7d06 |
|
|
|
ab7d06 |
From 3b25f451e30a89c5a136f1644fc761934c97b556 Mon Sep 17 00:00:00 2001
|
|
|
ab7d06 |
From: Thomas Haller <thaller@redhat.com>
|
|
|
ab7d06 |
Date: Mon, 19 Oct 2015 14:44:38 +0200
|
|
|
ab7d06 |
Subject: [PATCH 3/4] device: don't wait for carrier when activating static
|
|
|
ab7d06 |
connection
|
|
|
ab7d06 |
|
|
|
ab7d06 |
When the connection to be activated doesn't require carrier,
|
|
|
ab7d06 |
don't queue it to wait for it.
|
|
|
ab7d06 |
|
|
|
ab7d06 |
https://bugzilla.redhat.com/show_bug.cgi?id=1079353
|
|
|
ab7d06 |
Fixes: 0bfe635119facb8514e8f5824f599f4c4c3514e2
|
|
|
ab7d06 |
(cherry picked from commit 118de885eab0a161db291f1c2fb14690b891b00e)
|
|
|
ab7d06 |
(cherry picked from commit be3aee8b32b448e61b87d1e050f6c1a9d6a61afc)
|
|
|
ab7d06 |
---
|
|
|
ab7d06 |
src/devices/nm-device.c | 2 ++
|
|
|
ab7d06 |
1 file changed, 2 insertions(+)
|
|
|
ab7d06 |
|
|
|
ab7d06 |
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
|
|
|
ab7d06 |
index 8b2fa33..c2a2b8a 100644
|
|
|
ab7d06 |
--- a/src/devices/nm-device.c
|
|
|
ab7d06 |
+++ b/src/devices/nm-device.c
|
|
|
ab7d06 |
@@ -6379,6 +6379,8 @@ _carrier_wait_check_act_request_must_queue (NMDevice *self, NMActRequest *req)
|
|
|
ab7d06 |
return FALSE;
|
|
|
ab7d06 |
|
|
|
ab7d06 |
connection = nm_act_request_get_connection (req);
|
|
|
ab7d06 |
+ if (!connection_requires_carrier (connection))
|
|
|
ab7d06 |
+ return FALSE;
|
|
|
ab7d06 |
|
|
|
ab7d06 |
if (!nm_device_check_connection_available (self, connection, NM_DEVICE_CHECK_CON_AVAILABLE_ALL, NULL)) {
|
|
|
ab7d06 |
/* We passed all @flags we have, and no @specific_object.
|
|
|
ab7d06 |
--
|
|
|
ab7d06 |
2.4.3
|
|
|
ab7d06 |
|
|
|
ab7d06 |
|
|
|
ab7d06 |
From 6287e99516aa822cdd546f57093197ebe962bf1c Mon Sep 17 00:00:00 2001
|
|
|
ab7d06 |
From: Thomas Haller <thaller@redhat.com>
|
|
|
ab7d06 |
Date: Mon, 19 Oct 2015 15:16:20 +0200
|
|
|
ab7d06 |
Subject: [PATCH 4/4] device: properly cancel queued activation request
|
|
|
ab7d06 |
|
|
|
ab7d06 |
We would leak the NMActivationRequest when carrier didn't
|
|
|
ab7d06 |
come within timeout. We must properly set the state of the
|
|
|
ab7d06 |
activation request.
|
|
|
ab7d06 |
|
|
|
ab7d06 |
https://bugzilla.redhat.com/show_bug.cgi?id=1079353
|
|
|
ab7d06 |
Fixes: 0bfe635119facb8514e8f5824f599f4c4c3514e2
|
|
|
ab7d06 |
(cherry picked from commit 839330cd39df8bb1c54cb35ce81f7c381b9090d1)
|
|
|
ab7d06 |
(cherry picked from commit d65897222acbda41442b4968d004a60c7cec57a4)
|
|
|
ab7d06 |
---
|
|
|
ab7d06 |
src/devices/nm-device.c | 2 +-
|
|
|
ab7d06 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
ab7d06 |
|
|
|
ab7d06 |
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
|
|
|
ab7d06 |
index c2a2b8a..d4627ec 100644
|
|
|
ab7d06 |
--- a/src/devices/nm-device.c
|
|
|
ab7d06 |
+++ b/src/devices/nm-device.c
|
|
|
ab7d06 |
@@ -6355,7 +6355,7 @@ _carrier_wait_check_queued_act_request (NMDevice *self)
|
|
|
ab7d06 |
priv->queued_act_request_is_waiting_for_carrier = FALSE;
|
|
|
ab7d06 |
if (!priv->carrier) {
|
|
|
ab7d06 |
_LOGD (LOGD_DEVICE, "Cancel queued activation request as we have no carrier after timeout");
|
|
|
ab7d06 |
- g_clear_object (&priv->queued_act_request);
|
|
|
ab7d06 |
+ _clear_queued_act_request (priv);
|
|
|
ab7d06 |
} else {
|
|
|
ab7d06 |
_LOGD (LOGD_DEVICE, "Activate queued activation request as we now have carrier");
|
|
|
ab7d06 |
queued_req = priv->queued_act_request;
|
|
|
ab7d06 |
--
|
|
|
ab7d06 |
2.4.3
|
|
|
ab7d06 |
|