|
|
ab7d06 |
From 2e6d8e23b7ee032217d94c7d2dad2a57ace42ba1 Mon Sep 17 00:00:00 2001
|
|
|
ab7d06 |
From: Thomas Haller <thaller@redhat.com>
|
|
|
ab7d06 |
Date: Thu, 1 Oct 2015 16:41:09 +0200
|
|
|
ab7d06 |
Subject: [PATCH 1/3] macros: add nm_clear_g_signal_handler() helper
|
|
|
ab7d06 |
|
|
|
ab7d06 |
(cherry picked from commit 720c53f9f14ee3d12cb0a2bf68da938949544275)
|
|
|
ab7d06 |
---
|
|
|
ab7d06 |
include/nm-macros-internal.h | 14 ++++++++++++++
|
|
|
ab7d06 |
1 file changed, 14 insertions(+)
|
|
|
ab7d06 |
|
|
|
ab7d06 |
diff --git a/include/nm-macros-internal.h b/include/nm-macros-internal.h
|
|
|
ab7d06 |
index 170fb46..c4a60fa 100644
|
|
|
ab7d06 |
--- a/include/nm-macros-internal.h
|
|
|
ab7d06 |
+++ b/include/nm-macros-internal.h
|
|
|
ab7d06 |
@@ -24,6 +24,7 @@
|
|
|
ab7d06 |
|
|
|
ab7d06 |
|
|
|
ab7d06 |
#include <glib.h>
|
|
|
ab7d06 |
+#include <glib-object.h>
|
|
|
ab7d06 |
|
|
|
ab7d06 |
/********************************************************/
|
|
|
ab7d06 |
|
|
|
ab7d06 |
@@ -256,6 +257,19 @@ nm_clear_g_source (guint *id)
|
|
|
ab7d06 |
return FALSE;
|
|
|
ab7d06 |
}
|
|
|
ab7d06 |
|
|
|
ab7d06 |
+static inline gboolean
|
|
|
ab7d06 |
+nm_clear_g_signal_handler (gpointer self, guint *id)
|
|
|
ab7d06 |
+{
|
|
|
ab7d06 |
+ g_return_val_if_fail (G_IS_OBJECT (self), FALSE);
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
+ if (id && *id) {
|
|
|
ab7d06 |
+ g_signal_handler_disconnect (self, *id);
|
|
|
ab7d06 |
+ *id = 0;
|
|
|
ab7d06 |
+ return TRUE;
|
|
|
ab7d06 |
+ }
|
|
|
ab7d06 |
+ return FALSE;
|
|
|
ab7d06 |
+}
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
/*****************************************************************************/
|
|
|
ab7d06 |
|
|
|
ab7d06 |
/* Determine whether @x is a power of two (@x being an integer type).
|
|
|
ab7d06 |
--
|
|
|
ab7d06 |
2.4.3
|
|
|
ab7d06 |
|
|
|
ab7d06 |
|
|
|
ab7d06 |
From 5167b6a409ee7b150be181aef7a88f8162118902 Mon Sep 17 00:00:00 2001
|
|
|
ab7d06 |
From: Thomas Haller <thaller@redhat.com>
|
|
|
ab7d06 |
Date: Thu, 1 Oct 2015 16:43:06 +0200
|
|
|
ab7d06 |
Subject: [PATCH 2/3] device: use nm_clear_g_signal_handler() to clear
|
|
|
ab7d06 |
master-ready signal handler
|
|
|
ab7d06 |
|
|
|
ab7d06 |
(cherry picked from commit 86b6b6ed32c5128a4879238e10a7a1e9cda18be5)
|
|
|
ab7d06 |
---
|
|
|
ab7d06 |
src/devices/nm-device.c | 10 ++--------
|
|
|
ab7d06 |
1 file changed, 2 insertions(+), 8 deletions(-)
|
|
|
ab7d06 |
|
|
|
ab7d06 |
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
|
|
|
ab7d06 |
index 36603a6..4c2ac97 100644
|
|
|
ab7d06 |
--- a/src/devices/nm-device.c
|
|
|
ab7d06 |
+++ b/src/devices/nm-device.c
|
|
|
ab7d06 |
@@ -2679,10 +2679,7 @@ master_ready_cb (NMActiveConnection *active,
|
|
|
ab7d06 |
_LOGD (LOGD_DEVICE, "master connection ready; master device %s",
|
|
|
ab7d06 |
nm_device_get_iface (priv->master));
|
|
|
ab7d06 |
|
|
|
ab7d06 |
- if (priv->master_ready_id) {
|
|
|
ab7d06 |
- g_signal_handler_disconnect (active, priv->master_ready_id);
|
|
|
ab7d06 |
- priv->master_ready_id = 0;
|
|
|
ab7d06 |
- }
|
|
|
ab7d06 |
+ nm_clear_g_signal_handler (active, &priv->master_ready_id);
|
|
|
ab7d06 |
|
|
|
ab7d06 |
nm_device_activate_schedule_stage2_device_config (self);
|
|
|
ab7d06 |
}
|
|
|
ab7d06 |
@@ -6031,10 +6028,7 @@ clear_act_request (NMDevice *self)
|
|
|
ab7d06 |
|
|
|
ab7d06 |
nm_active_connection_set_default (NM_ACTIVE_CONNECTION (priv->act_request), FALSE);
|
|
|
ab7d06 |
|
|
|
ab7d06 |
- if (priv->master_ready_id) {
|
|
|
ab7d06 |
- g_signal_handler_disconnect (priv->act_request, priv->master_ready_id);
|
|
|
ab7d06 |
- priv->master_ready_id = 0;
|
|
|
ab7d06 |
- }
|
|
|
ab7d06 |
+ nm_clear_g_signal_handler (priv->act_request, &priv->master_ready_id);
|
|
|
ab7d06 |
|
|
|
ab7d06 |
g_clear_object (&priv->act_request);
|
|
|
ab7d06 |
g_object_notify (G_OBJECT (self), NM_DEVICE_ACTIVE_CONNECTION);
|
|
|
ab7d06 |
--
|
|
|
ab7d06 |
2.4.3
|
|
|
ab7d06 |
|
|
|
ab7d06 |
|
|
|
ab7d06 |
From b3a02417af7f66e228b970f7306a9865e146ba06 Mon Sep 17 00:00:00 2001
|
|
|
ab7d06 |
From: Thomas Haller <thaller@redhat.com>
|
|
|
ab7d06 |
Date: Thu, 1 Oct 2015 16:48:32 +0200
|
|
|
ab7d06 |
Subject: [PATCH 3/3] device: fix activating slave device when stage1 delays
|
|
|
ab7d06 |
action
|
|
|
ab7d06 |
|
|
|
ab7d06 |
When activating for example a team device which is to be enslaved to a
|
|
|
ab7d06 |
bridge, nm_device_activate_stage1_device_prepare() will postpone
|
|
|
ab7d06 |
stage 2.
|
|
|
ab7d06 |
|
|
|
ab7d06 |
In that case, we didn't register the "master-ready" of the team
|
|
|
ab7d06 |
device and thus never progressed the slave from stage2.
|
|
|
ab7d06 |
|
|
|
ab7d06 |
Reproduce:
|
|
|
ab7d06 |
|
|
|
ab7d06 |
# nmcli connection delete t-br0
|
|
|
ab7d06 |
# nmcli connection delete t-team0
|
|
|
ab7d06 |
nmcli connection add type bridge con-name t-br0 autoconnect no ifname i-br0 ip4 192.168.177.100/24 gw4 192.168.177.1
|
|
|
ab7d06 |
nmcli connection add type team con-name t-team0 autoconnect no ifname i-team0
|
|
|
ab7d06 |
nmcli connection modify id t-team0 connection.master i-br0 connection.slave-type bridge
|
|
|
ab7d06 |
nmcli connection up t-team0
|
|
|
ab7d06 |
|
|
|
ab7d06 |
(cherry picked from commit 5f8aa51e6358a200feb83378877a4e9cd12cb222)
|
|
|
ab7d06 |
---
|
|
|
ab7d06 |
src/devices/nm-device.c | 63 +++++++++++++++++++++++++++++++------------------
|
|
|
ab7d06 |
1 file changed, 40 insertions(+), 23 deletions(-)
|
|
|
ab7d06 |
|
|
|
ab7d06 |
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
|
|
|
ab7d06 |
index 4c2ac97..148bef4 100644
|
|
|
ab7d06 |
--- a/src/devices/nm-device.c
|
|
|
ab7d06 |
+++ b/src/devices/nm-device.c
|
|
|
ab7d06 |
@@ -343,6 +343,7 @@ typedef struct {
|
|
|
ab7d06 |
/* master interface for bridge/bond/team slave */
|
|
|
ab7d06 |
NMDevice * master;
|
|
|
ab7d06 |
gboolean enslaved;
|
|
|
ab7d06 |
+ gboolean master_ready_handled;
|
|
|
ab7d06 |
guint master_ready_id;
|
|
|
ab7d06 |
|
|
|
ab7d06 |
/* slave management */
|
|
|
ab7d06 |
@@ -2658,19 +2659,22 @@ get_ip_config_may_fail (NMDevice *self, int family)
|
|
|
ab7d06 |
}
|
|
|
ab7d06 |
|
|
|
ab7d06 |
static void
|
|
|
ab7d06 |
-master_ready_cb (NMActiveConnection *active,
|
|
|
ab7d06 |
- GParamSpec *pspec,
|
|
|
ab7d06 |
- NMDevice *self)
|
|
|
ab7d06 |
+master_ready (NMDevice *self,
|
|
|
ab7d06 |
+ NMActiveConnection *active)
|
|
|
ab7d06 |
{
|
|
|
ab7d06 |
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
|
|
ab7d06 |
NMActiveConnection *master;
|
|
|
ab7d06 |
|
|
|
ab7d06 |
- g_assert (priv->state == NM_DEVICE_STATE_PREPARE);
|
|
|
ab7d06 |
+ g_return_if_fail (priv->state == NM_DEVICE_STATE_PREPARE);
|
|
|
ab7d06 |
+ g_return_if_fail (!priv->master_ready_handled);
|
|
|
ab7d06 |
|
|
|
ab7d06 |
/* Notify a master device that it has a new slave */
|
|
|
ab7d06 |
- g_assert (nm_active_connection_get_master_ready (active));
|
|
|
ab7d06 |
+ g_return_if_fail (nm_active_connection_get_master_ready (active));
|
|
|
ab7d06 |
master = nm_active_connection_get_master (active);
|
|
|
ab7d06 |
|
|
|
ab7d06 |
+ priv->master_ready_handled = TRUE;
|
|
|
ab7d06 |
+ nm_clear_g_signal_handler (active, &priv->master_ready_id);
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
priv->master = g_object_ref (nm_active_connection_get_device (master));
|
|
|
ab7d06 |
nm_device_master_add_slave (priv->master,
|
|
|
ab7d06 |
self,
|
|
|
ab7d06 |
@@ -2679,8 +2683,14 @@ master_ready_cb (NMActiveConnection *active,
|
|
|
ab7d06 |
_LOGD (LOGD_DEVICE, "master connection ready; master device %s",
|
|
|
ab7d06 |
nm_device_get_iface (priv->master));
|
|
|
ab7d06 |
|
|
|
ab7d06 |
- nm_clear_g_signal_handler (active, &priv->master_ready_id);
|
|
|
ab7d06 |
+}
|
|
|
ab7d06 |
|
|
|
ab7d06 |
+static void
|
|
|
ab7d06 |
+master_ready_cb (NMActiveConnection *active,
|
|
|
ab7d06 |
+ GParamSpec *pspec,
|
|
|
ab7d06 |
+ NMDevice *self)
|
|
|
ab7d06 |
+{
|
|
|
ab7d06 |
+ master_ready (self, active);
|
|
|
ab7d06 |
nm_device_activate_schedule_stage2_device_config (self);
|
|
|
ab7d06 |
}
|
|
|
ab7d06 |
|
|
|
ab7d06 |
@@ -2728,23 +2738,7 @@ nm_device_activate_stage1_device_prepare (gpointer user_data)
|
|
|
ab7d06 |
g_assert (ret == NM_ACT_STAGE_RETURN_SUCCESS);
|
|
|
ab7d06 |
}
|
|
|
ab7d06 |
|
|
|
ab7d06 |
- if (nm_active_connection_get_master (active)) {
|
|
|
ab7d06 |
- /* If the master connection is ready for slaves, attach ourselves */
|
|
|
ab7d06 |
- if (nm_active_connection_get_master_ready (active))
|
|
|
ab7d06 |
- master_ready_cb (active, NULL, self);
|
|
|
ab7d06 |
- else {
|
|
|
ab7d06 |
- _LOGD (LOGD_DEVICE, "waiting for master connection to become ready");
|
|
|
ab7d06 |
-
|
|
|
ab7d06 |
- /* Attach a signal handler and wait for the master connection to begin activating */
|
|
|
ab7d06 |
- g_assert (priv->master_ready_id == 0);
|
|
|
ab7d06 |
- priv->master_ready_id = g_signal_connect (active,
|
|
|
ab7d06 |
- "notify::" NM_ACTIVE_CONNECTION_INT_MASTER_READY,
|
|
|
ab7d06 |
- (GCallback) master_ready_cb,
|
|
|
ab7d06 |
- self);
|
|
|
ab7d06 |
- /* Postpone */
|
|
|
ab7d06 |
- }
|
|
|
ab7d06 |
- } else
|
|
|
ab7d06 |
- nm_device_activate_schedule_stage2_device_config (self);
|
|
|
ab7d06 |
+ nm_device_activate_schedule_stage2_device_config (self);
|
|
|
ab7d06 |
|
|
|
ab7d06 |
out:
|
|
|
ab7d06 |
_LOGD (LOGD_DEVICE, "Activation: Stage 1 of 5 (Device Prepare) complete.");
|
|
|
ab7d06 |
@@ -2798,6 +2792,28 @@ nm_device_activate_stage2_device_config (gpointer user_data)
|
|
|
ab7d06 |
NMActiveConnection *active = NM_ACTIVE_CONNECTION (priv->act_request);
|
|
|
ab7d06 |
GSList *iter;
|
|
|
ab7d06 |
|
|
|
ab7d06 |
+ if (!priv->master_ready_handled) {
|
|
|
ab7d06 |
+ if (!nm_active_connection_get_master (active))
|
|
|
ab7d06 |
+ priv->master_ready_handled = TRUE;
|
|
|
ab7d06 |
+ else {
|
|
|
ab7d06 |
+ /* If the master connection is ready for slaves, attach ourselves */
|
|
|
ab7d06 |
+ if (nm_active_connection_get_master_ready (active))
|
|
|
ab7d06 |
+ master_ready (self, active);
|
|
|
ab7d06 |
+ else {
|
|
|
ab7d06 |
+ _LOGD (LOGD_DEVICE, "waiting for master connection to become ready");
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
+ if (priv->master_ready_id == 0) {
|
|
|
ab7d06 |
+ priv->master_ready_id = g_signal_connect (active,
|
|
|
ab7d06 |
+ "notify::" NM_ACTIVE_CONNECTION_INT_MASTER_READY,
|
|
|
ab7d06 |
+ (GCallback) master_ready_cb,
|
|
|
ab7d06 |
+ self);
|
|
|
ab7d06 |
+ }
|
|
|
ab7d06 |
+ /* Postpone */
|
|
|
ab7d06 |
+ return FALSE;
|
|
|
ab7d06 |
+ }
|
|
|
ab7d06 |
+ }
|
|
|
ab7d06 |
+ }
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
/* Clear the activation source ID now that this stage has run */
|
|
|
ab7d06 |
activation_source_clear (self, FALSE, 0);
|
|
|
ab7d06 |
|
|
|
ab7d06 |
@@ -6028,6 +6044,7 @@ clear_act_request (NMDevice *self)
|
|
|
ab7d06 |
|
|
|
ab7d06 |
nm_active_connection_set_default (NM_ACTIVE_CONNECTION (priv->act_request), FALSE);
|
|
|
ab7d06 |
|
|
|
ab7d06 |
+ priv->master_ready_handled = FALSE;
|
|
|
ab7d06 |
nm_clear_g_signal_handler (priv->act_request, &priv->master_ready_id);
|
|
|
ab7d06 |
|
|
|
ab7d06 |
g_clear_object (&priv->act_request);
|
|
|
ab7d06 |
--
|
|
|
ab7d06 |
2.4.3
|
|
|
ab7d06 |
|