|
|
7b922c |
From 8775e71d12bf26f4153d12dcb20e8e92ba6f0189 Mon Sep 17 00:00:00 2001
|
|
|
7b922c |
From: Beniamino Galvani <bgalvani@redhat.com>
|
|
|
7b922c |
Date: Mon, 29 Jul 2019 16:13:27 +0200
|
|
|
7b922c |
Subject: [PATCH 1/3] ovs: don't release slaves on quit
|
|
|
7b922c |
|
|
|
7b922c |
An OVS bridge and its slaves can continue to work even after NM has
|
|
|
7b922c |
quit. Keep the interface enslaved when the @configure argument of
|
|
|
7b922c |
device->release_slave() is FALSE, which happens on quit and in other
|
|
|
7b922c |
circumstances when we don't really want to release the slave from its
|
|
|
7b922c |
master.
|
|
|
7b922c |
|
|
|
7b922c |
https://bugzilla.redhat.com/show_bug.cgi?id=1733709
|
|
|
7b922c |
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/215
|
|
|
7b922c |
(cherry picked from commit ccd4be4014f9f4cfdd0d298ff387ee7558d5f3a5)
|
|
|
7b922c |
(cherry picked from commit a1f39b69e0b09b7ab02513e34bd41276808ad778)
|
|
|
7b922c |
---
|
|
|
7b922c |
src/devices/ovs/nm-device-ovs-port.c | 19 ++++++++++++-------
|
|
|
7b922c |
1 file changed, 12 insertions(+), 7 deletions(-)
|
|
|
7b922c |
|
|
|
7b922c |
diff --git a/src/devices/ovs/nm-device-ovs-port.c b/src/devices/ovs/nm-device-ovs-port.c
|
|
|
7b922c |
index 35eb739f9..8a93a5a9d 100644
|
|
|
7b922c |
--- a/src/devices/ovs/nm-device-ovs-port.c
|
|
|
7b922c |
+++ b/src/devices/ovs/nm-device-ovs-port.c
|
|
|
7b922c |
@@ -140,13 +140,18 @@ del_iface_cb (GError *error, gpointer user_data)
|
|
|
7b922c |
static void
|
|
|
7b922c |
release_slave (NMDevice *device, NMDevice *slave, gboolean configure)
|
|
|
7b922c |
{
|
|
|
7b922c |
- nm_ovsdb_del_interface (nm_ovsdb_get (), nm_device_get_iface (slave),
|
|
|
7b922c |
- del_iface_cb, g_object_ref (slave));
|
|
|
7b922c |
-
|
|
|
7b922c |
- /* Open VSwitch is going to delete this one. We must ignore what happens
|
|
|
7b922c |
- * next with the interface. */
|
|
|
7b922c |
- if (NM_IS_DEVICE_OVS_INTERFACE (slave))
|
|
|
7b922c |
- nm_device_update_from_platform_link (slave, NULL);
|
|
|
7b922c |
+ NMDeviceOvsPort *self = NM_DEVICE_OVS_PORT (device);
|
|
|
7b922c |
+
|
|
|
7b922c |
+ if (configure) {
|
|
|
7b922c |
+ _LOGI (LOGD_DEVICE, "releasing ovs interface %s", nm_device_get_ip_iface (slave));
|
|
|
7b922c |
+ nm_ovsdb_del_interface (nm_ovsdb_get (), nm_device_get_iface (slave),
|
|
|
7b922c |
+ del_iface_cb, g_object_ref (slave));
|
|
|
7b922c |
+ /* Open VSwitch is going to delete this one. We must ignore what happens
|
|
|
7b922c |
+ * next with the interface. */
|
|
|
7b922c |
+ if (NM_IS_DEVICE_OVS_INTERFACE (slave))
|
|
|
7b922c |
+ nm_device_update_from_platform_link (slave, NULL);
|
|
|
7b922c |
+ } else
|
|
|
7b922c |
+ _LOGI (LOGD_DEVICE, "ovs interface %s was released", nm_device_get_ip_iface (slave));
|
|
|
7b922c |
}
|
|
|
7b922c |
|
|
|
7b922c |
/*****************************************************************************/
|
|
|
7b922c |
--
|
|
|
7b922c |
2.21.0
|
|
|
7b922c |
|
|
|
7b922c |
From 846a67ab95bc5f3e36099a45b0f2131c6346ef6a Mon Sep 17 00:00:00 2001
|
|
|
7b922c |
From: Beniamino Galvani <bgalvani@redhat.com>
|
|
|
7b922c |
Date: Tue, 30 Jul 2019 11:03:59 +0200
|
|
|
7b922c |
Subject: [PATCH 2/3] device: check platform link compatibility when setting
|
|
|
7b922c |
nm-owned flag
|
|
|
7b922c |
|
|
|
7b922c |
We set nm-owned to indicate whether a software device was created by
|
|
|
7b922c |
NM or it was pre-existing. When checking the existence, we must verify
|
|
|
7b922c |
also whether the link type is compatible with the device, otherwise it
|
|
|
7b922c |
is possible to match unrelated interfaces. For example, when checking
|
|
|
7b922c |
for the existence of an ovs-bridge (which is not compatible with any
|
|
|
7b922c |
platform link) we could match a unrelated platform link with the same
|
|
|
7b922c |
name.
|
|
|
7b922c |
|
|
|
7b922c |
https://bugzilla.redhat.com/show_bug.cgi?id=1733709
|
|
|
7b922c |
(cherry picked from commit 3cb4b36261684aa3d2676f922c6d53bc31085153)
|
|
|
7b922c |
(cherry picked from commit cb20d0791a6daf20d64f4cd57d6bd4b60e35a9a0)
|
|
|
7b922c |
(cherry picked from commit 511ef27d5eaf6fd0577b867d9d31de3bee0440fe)
|
|
|
7b922c |
---
|
|
|
7b922c |
src/devices/nm-device.c | 7 ++++---
|
|
|
7b922c |
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
|
7b922c |
|
|
|
7b922c |
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
|
|
|
7b922c |
index 9ad69998b..eaf72a7a0 100644
|
|
|
7b922c |
--- a/src/devices/nm-device.c
|
|
|
7b922c |
+++ b/src/devices/nm-device.c
|
|
|
7b922c |
@@ -4106,13 +4106,14 @@ nm_device_create_and_realize (NMDevice *self,
|
|
|
7b922c |
{
|
|
|
7b922c |
nm_auto_nmpobj const NMPObject *plink_keep_alive = NULL;
|
|
|
7b922c |
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
|
|
7b922c |
- const NMPlatformLink *plink = NULL;
|
|
|
7b922c |
+ const NMPlatformLink *plink;
|
|
|
7b922c |
|
|
|
7b922c |
/* Must be set before device is realized */
|
|
|
7b922c |
- priv->nm_owned = !nm_platform_link_get_by_ifname (nm_device_get_platform (self), priv->iface);
|
|
|
7b922c |
-
|
|
|
7b922c |
+ plink = nm_platform_link_get_by_ifname (nm_device_get_platform (self), priv->iface);
|
|
|
7b922c |
+ priv->nm_owned = !plink || !link_type_compatible (self, plink->type, NULL, NULL);
|
|
|
7b922c |
_LOGD (LOGD_DEVICE, "create (is %snm-owned)", priv->nm_owned ? "" : "not ");
|
|
|
7b922c |
|
|
|
7b922c |
+ plink = NULL;
|
|
|
7b922c |
/* Create any resources the device needs */
|
|
|
7b922c |
if (NM_DEVICE_GET_CLASS (self)->create_and_realize) {
|
|
|
7b922c |
if (!NM_DEVICE_GET_CLASS (self)->create_and_realize (self, connection, parent, &plink, error))
|
|
|
7b922c |
--
|
|
|
7b922c |
2.21.0
|
|
|
7b922c |
|
|
|
7b922c |
From 70ada1a2c9e936ec5abe737e1eb80463ff4fba60 Mon Sep 17 00:00:00 2001
|
|
|
7b922c |
From: Beniamino Galvani <bgalvani@redhat.com>
|
|
|
7b922c |
Date: Wed, 31 Jul 2019 11:40:35 +0200
|
|
|
7b922c |
Subject: [PATCH 3/3] device: fix releasing slaves
|
|
|
7b922c |
|
|
|
7b922c |
Not all masters type have a platform link and so it's wrong to check
|
|
|
7b922c |
for it to decide whether the slave should be really released. Move the
|
|
|
7b922c |
check to master devices that need it (bond, bridge and team).
|
|
|
7b922c |
|
|
|
7b922c |
OVS ports don't need the check because they don't call to platform to
|
|
|
7b922c |
remove a slave.
|
|
|
7b922c |
|
|
|
7b922c |
https://bugzilla.redhat.com/show_bug.cgi?id=1733709
|
|
|
7b922c |
(cherry picked from commit 57e3734b6cc1bb453216c7e2150a698114507a46)
|
|
|
7b922c |
(cherry picked from commit ec1b5fb019929441fdcdf6bf7c54a2856ad61976)
|
|
|
7b922c |
(cherry picked from commit f6a90b899ab01d6dc2635faf6bc8d72839a9064c)
|
|
|
7b922c |
---
|
|
|
7b922c |
src/devices/nm-device-bond.c | 6 ++++++
|
|
|
7b922c |
src/devices/nm-device-bridge.c | 6 ++++++
|
|
|
7b922c |
src/devices/nm-device.c | 7 +------
|
|
|
7b922c |
src/devices/team/nm-device-team.c | 6 ++++++
|
|
|
7b922c |
4 files changed, 19 insertions(+), 6 deletions(-)
|
|
|
7b922c |
|
|
|
7b922c |
diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c
|
|
|
7b922c |
index 37159fca8..790f00d44 100644
|
|
|
7b922c |
--- a/src/devices/nm-device-bond.c
|
|
|
7b922c |
+++ b/src/devices/nm-device-bond.c
|
|
|
7b922c |
@@ -413,6 +413,12 @@ release_slave (NMDevice *device,
|
|
|
7b922c |
NMDeviceBond *self = NM_DEVICE_BOND (device);
|
|
|
7b922c |
gboolean success;
|
|
|
7b922c |
gs_free char *address = NULL;
|
|
|
7b922c |
+ int ifindex;
|
|
|
7b922c |
+
|
|
|
7b922c |
+ ifindex = nm_device_get_ifindex (device);
|
|
|
7b922c |
+ if ( ifindex <= 0
|
|
|
7b922c |
+ || !nm_platform_link_get (nm_device_get_platform (device), ifindex))
|
|
|
7b922c |
+ configure = FALSE;
|
|
|
7b922c |
|
|
|
7b922c |
if (configure) {
|
|
|
7b922c |
/* When the last slave is released the bond MAC will be set to a random
|
|
|
7b922c |
diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c
|
|
|
7b922c |
index 4275af912..e81bcd5d2 100644
|
|
|
7b922c |
--- a/src/devices/nm-device-bridge.c
|
|
|
7b922c |
+++ b/src/devices/nm-device-bridge.c
|
|
|
7b922c |
@@ -625,6 +625,12 @@ release_slave (NMDevice *device,
|
|
|
7b922c |
{
|
|
|
7b922c |
NMDeviceBridge *self = NM_DEVICE_BRIDGE (device);
|
|
|
7b922c |
gboolean success;
|
|
|
7b922c |
+ int ifindex;
|
|
|
7b922c |
+
|
|
|
7b922c |
+ ifindex = nm_device_get_ifindex (device);
|
|
|
7b922c |
+ if ( ifindex <= 0
|
|
|
7b922c |
+ || !nm_platform_link_get (nm_device_get_platform (device), ifindex))
|
|
|
7b922c |
+ configure = FALSE;
|
|
|
7b922c |
|
|
|
7b922c |
if (configure) {
|
|
|
7b922c |
success = nm_platform_link_release (nm_device_get_platform (device),
|
|
|
7b922c |
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
|
|
|
7b922c |
index eaf72a7a0..5bb7a592e 100644
|
|
|
7b922c |
--- a/src/devices/nm-device.c
|
|
|
7b922c |
+++ b/src/devices/nm-device.c
|
|
|
7b922c |
@@ -4851,7 +4851,6 @@ nm_device_master_release_slaves (NMDevice *self)
|
|
|
7b922c |
{
|
|
|
7b922c |
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
|
|
7b922c |
NMDeviceStateReason reason;
|
|
|
7b922c |
- gboolean configure = TRUE;
|
|
|
7b922c |
CList *iter, *safe;
|
|
|
7b922c |
|
|
|
7b922c |
/* Don't release the slaves if this connection doesn't belong to NM. */
|
|
|
7b922c |
@@ -4862,14 +4861,10 @@ nm_device_master_release_slaves (NMDevice *self)
|
|
|
7b922c |
if (priv->state == NM_DEVICE_STATE_FAILED)
|
|
|
7b922c |
reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED;
|
|
|
7b922c |
|
|
|
7b922c |
- if ( priv->ifindex <= 0
|
|
|
7b922c |
- || !nm_platform_link_get (nm_device_get_platform (self), priv->ifindex))
|
|
|
7b922c |
- configure = FALSE;
|
|
|
7b922c |
-
|
|
|
7b922c |
c_list_for_each_safe (iter, safe, &priv->slaves) {
|
|
|
7b922c |
SlaveInfo *info = c_list_entry (iter, SlaveInfo, lst_slave);
|
|
|
7b922c |
|
|
|
7b922c |
- nm_device_master_release_one_slave (self, info->slave, configure, reason);
|
|
|
7b922c |
+ nm_device_master_release_one_slave (self, info->slave, TRUE, reason);
|
|
|
7b922c |
}
|
|
|
7b922c |
}
|
|
|
7b922c |
|
|
|
7b922c |
diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c
|
|
|
7b922c |
index 4ae276dbf..7afd18606 100644
|
|
|
7b922c |
--- a/src/devices/team/nm-device-team.c
|
|
|
7b922c |
+++ b/src/devices/team/nm-device-team.c
|
|
|
7b922c |
@@ -774,6 +774,12 @@ release_slave (NMDevice *device,
|
|
|
7b922c |
NMDeviceTeam *self = NM_DEVICE_TEAM (device);
|
|
|
7b922c |
NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (self);
|
|
|
7b922c |
gboolean success;
|
|
|
7b922c |
+ int ifindex;
|
|
|
7b922c |
+
|
|
|
7b922c |
+ ifindex = nm_device_get_ifindex (device);
|
|
|
7b922c |
+ if ( ifindex <= 0
|
|
|
7b922c |
+ || !nm_platform_link_get (nm_device_get_platform (device), ifindex))
|
|
|
7b922c |
+ configure = FALSE;
|
|
|
7b922c |
|
|
|
7b922c |
if (configure) {
|
|
|
7b922c |
success = nm_platform_link_release (nm_device_get_platform (device),
|
|
|
7b922c |
--
|
|
|
7b922c |
2.21.0
|
|
|
7b922c |
|