import NetworkManager-1.42.2-1.el9

This commit is contained in:
CentOS Sources 2023-05-09 05:36:10 +00:00 committed by Stepan Oksanichenko
parent 60c0feb2ed
commit 2c491ae1ca
4 changed files with 98 additions and 307 deletions

View File

@ -1 +1 @@
eba3800b6308c38916f22e8515fb415730a4e89a SOURCES/NetworkManager-1.40.0.tar.xz
83eaa880bb7d4d8f178e426c30d17895e117fb79 SOURCES/NetworkManager-1.42.2.tar.xz

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/NetworkManager-1.40.0.tar.xz
SOURCES/NetworkManager-1.42.2.tar.xz

View File

@ -1,287 +0,0 @@
From 9374ad20c02bd43d3b4a56bfd9538ffea5beab25 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Tue, 20 Sep 2022 14:05:42 +0200
Subject: [PATCH] ovs: wait that links disappear during initial cleanup
At startup, we remove from ovsdb any existing interface created by NM
and later an interface with the same name might be readded. This can
cause race conditions. Consider this series of events:
1. at startup NM removes the entry from ovsdb;
2. ovsdb reports success;
3. NM inserts an interface with the same name again;
4. ovs-vswitch monitors ovsdb changes, and gets events for removal and
insertion. Depending on how those events are split in different
batches, it might decide:
4a. to delete the link and add it back, or
4b. to keep the existing link because the delete and insertion
cancel out each other.
When NM sees the link staying in platform, it doesn't know if it's
because of 4b or because 4a will happen eventually.
To avoid this ambiguity, after ovsdb reports the successful deletion
NM should also wait that the link disappears from platform.
Unfortunately, this means that ovsdb gets a dependency to the platform
code.
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1386
(cherry picked from commit 4f60fe293cd5461c47d218b632753ecdfb50cbab)
(cherry picked from commit f702be2992f0f34c82e96b420947f9056a4cb24e)
---
src/core/devices/ovs/nm-ovsdb.c | 155 +++++++++++++++++++++++++++-----
1 file changed, 132 insertions(+), 23 deletions(-)
diff --git a/src/core/devices/ovs/nm-ovsdb.c b/src/core/devices/ovs/nm-ovsdb.c
index e7c96852406b..d3e858a19c13 100644
--- a/src/core/devices/ovs/nm-ovsdb.c
+++ b/src/core/devices/ovs/nm-ovsdb.c
@@ -18,6 +18,7 @@
#include "nm-manager.h"
#include "nm-setting-ovs-external-ids.h"
#include "nm-priv-helper-call.h"
+#include "libnm-platform/nm-platform.h"
/*****************************************************************************/
@@ -120,6 +121,7 @@ enum {
static guint signals[LAST_SIGNAL] = {0};
typedef struct {
+ NMPlatform *platform;
GSocketConnection *conn;
GCancellable *conn_cancellable;
char buf[4096]; /* Input buffer */
@@ -135,8 +137,14 @@ typedef struct {
GHashTable *bridges; /* bridge uuid => OpenvswitchBridge */
char *db_uuid;
guint num_failures;
- guint num_pending_deletions;
bool ready : 1;
+ struct {
+ GPtrArray *interfaces; /* Interface names we are waiting to go away */
+ GSource *timeout_source; /* After all deletions complete, wait this
+ * timeout for interfaces to disappear */
+ gulong link_changed_id; /* Platform link-changed signal handle */
+ guint num_pending_del; /* Number of ovsdb deletions pending */
+ } cleanup;
} NMOvsdbPrivate;
struct _NMOvsdb {
@@ -161,6 +169,7 @@ static void ovsdb_disconnect(NMOvsdb *self, gboolean retry, gboolean is_disposin
static void ovsdb_read(NMOvsdb *self);
static void ovsdb_write(NMOvsdb *self);
static void ovsdb_next_command(NMOvsdb *self);
+static void cleanup_check_ready(NMOvsdb *self);
/*****************************************************************************/
@@ -2283,21 +2292,114 @@ ovsdb_disconnect(NMOvsdb *self, gboolean retry, gboolean is_disposing)
}
static void
-_check_ready(NMOvsdb *self)
+cleanup_emit_ready(NMOvsdb *self, const char *reason)
+{
+ NMOvsdbPrivate *priv = NM_OVSDB_GET_PRIVATE(self);
+
+ _LOGT("cleanup: ready (%s)", reason);
+
+ nm_clear_pointer(&priv->cleanup.interfaces, g_ptr_array_unref);
+ nm_clear_g_source_inst(&priv->cleanup.timeout_source);
+ nm_clear_g_signal_handler(priv->platform, &priv->cleanup.link_changed_id);
+
+ priv->ready = TRUE;
+ g_signal_emit(self, signals[READY], 0);
+ nm_manager_unblock_failed_ovs_interfaces(nm_manager_get());
+}
+
+static gboolean
+cleanup_timeout(NMOvsdb *self)
+{
+ cleanup_emit_ready(self, "timeout");
+ return G_SOURCE_CONTINUE;
+}
+
+static void
+cleanup_link_cb(NMPlatform *platform,
+ int obj_type_i,
+ int ifindex,
+ NMPlatformLink *plink,
+ int change_type_i,
+ gpointer user_data)
+{
+ const NMPlatformSignalChangeType change_type = change_type_i;
+
+ if (change_type != NM_PLATFORM_SIGNAL_REMOVED)
+ return;
+
+ cleanup_check_ready(user_data);
+}
+
+static void
+cleanup_check_ready(NMOvsdb *self)
{
NMOvsdbPrivate *priv = NM_OVSDB_GET_PRIVATE(self);
+ guint i = 0;
nm_assert(!priv->ready);
- if (priv->num_pending_deletions == 0) {
- priv->ready = TRUE;
- g_signal_emit(self, signals[READY], 0);
- nm_manager_unblock_failed_ovs_interfaces(nm_manager_get());
+ if (priv->cleanup.num_pending_del > 0)
+ return;
+
+ /* After we have deleted an interface from ovsdb, the link will stay
+ * in platform until ovs-vswitch removes it. To avoid race conditions,
+ * we need to wait until the link goes away; otherwise, after adding the
+ * interface again, these race conditions can happen:
+ * 1) we see the link in platform, and proceed with activation. But after
+ * that, ovs-vswitchd reads the updates from ovsdb-server and deletes/recreates
+ * the link.
+ * 2) ovs-vswitch combines the delete/insert of the interface to a no-op. NM sees
+ * the link staying in platform, but doesn't know whether the link is ready
+ * or we are again in case 1)
+ * In other words, it's necessary to wait that the link goes away before inserting
+ * the interface again.
+ */
+ while (i < nm_g_ptr_array_len(priv->cleanup.interfaces)) {
+ const char *ifname;
+ const NMDedupMultiHeadEntry *pl_links_head_entry;
+ NMDedupMultiIter pliter;
+ const NMPlatformLink *link;
+ gboolean found = FALSE;
+
+ ifname = priv->cleanup.interfaces->pdata[i];
+ pl_links_head_entry = nm_platform_lookup_link_by_ifname(priv->platform, ifname);
+ nmp_cache_iter_for_each_link (&pliter, pl_links_head_entry, &link) {
+ if (link->type == NM_LINK_TYPE_OPENVSWITCH
+ && nmp_object_is_visible(NMP_OBJECT_UP_CAST(link))) {
+ found = TRUE;
+ break;
+ }
+ }
+
+ if (!found) {
+ g_ptr_array_remove_index_fast(priv->cleanup.interfaces, i);
+ continue;
+ }
+ i++;
}
+
+ if (nm_g_ptr_array_len(priv->cleanup.interfaces) == 0) {
+ cleanup_emit_ready(self, "all interfaces deleted");
+ return;
+ }
+
+ _LOGT("cleanup: still waiting for %d interfaces", priv->cleanup.interfaces->len);
+
+ if (priv->cleanup.timeout_source) {
+ /* We already registered the timeout/change-callback */
+ return;
+ }
+
+ priv->cleanup.timeout_source =
+ nm_g_timeout_add_seconds_source(6, G_SOURCE_FUNC(cleanup_timeout), self);
+ priv->cleanup.link_changed_id = g_signal_connect(priv->platform,
+ NM_PLATFORM_SIGNAL_LINK_CHANGED,
+ G_CALLBACK(cleanup_link_cb),
+ self);
}
static void
-_del_initial_iface_cb(GError *error, gpointer user_data)
+cleanup_del_iface_cb(GError *error, gpointer user_data)
{
NMOvsdb *self;
gs_free char *ifname = NULL;
@@ -2309,18 +2411,18 @@ _del_initial_iface_cb(GError *error, gpointer user_data)
return;
priv = NM_OVSDB_GET_PRIVATE(self);
- nm_assert(priv->num_pending_deletions > 0);
- priv->num_pending_deletions--;
+ nm_assert(priv->cleanup.num_pending_del > 0);
+ priv->cleanup.num_pending_del--;
- _LOGD("delete initial interface '%s': %s %s%s%s, pending %u",
+ _LOGD("cleanup: deleted interface '%s': %s %s%s%s, pending %u",
ifname,
error ? "error" : "success",
error ? "(" : "",
error ? error->message : "",
error ? ")" : "",
- priv->num_pending_deletions);
+ priv->cleanup.num_pending_del);
- _check_ready(self);
+ cleanup_check_ready(self);
}
static void
@@ -2331,7 +2433,7 @@ ovsdb_cleanup_initial_interfaces(NMOvsdb *self)
NMUtilsUserData *data;
GHashTableIter iter;
- if (priv->ready || priv->num_pending_deletions != 0)
+ if (priv->ready || priv->cleanup.num_pending_del > 0 || priv->cleanup.interfaces)
return;
/* Delete OVS interfaces added by NM. Bridges and ports and
@@ -2339,17 +2441,22 @@ ovsdb_cleanup_initial_interfaces(NMOvsdb *self)
* when no interface is present. */
g_hash_table_iter_init(&iter, self->_priv.interfaces);
while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &interface)) {
- if (interface->connection_uuid) {
- priv->num_pending_deletions++;
- _LOGD("deleting initial interface '%s' (pending: %u)",
- interface->name,
- priv->num_pending_deletions);
- data = nm_utils_user_data_pack(self, g_strdup(interface->name));
- nm_ovsdb_del_interface(self, interface->name, _del_initial_iface_cb, data);
+ if (!interface->connection_uuid) {
+ /* not created by NM, ignore */
+ continue;
}
+
+ if (!priv->cleanup.interfaces)
+ priv->cleanup.interfaces = g_ptr_array_new_with_free_func(g_free);
+ g_ptr_array_add(priv->cleanup.interfaces, g_strdup(interface->name));
+
+ _LOGD("cleanup: deleting interface '%s'", interface->name);
+ priv->cleanup.num_pending_del++;
+ data = nm_utils_user_data_pack(self, g_strdup(interface->name));
+ nm_ovsdb_del_interface(self, interface->name, cleanup_del_iface_cb, data);
}
- _check_ready(self);
+ cleanup_check_ready(self);
}
static void
@@ -2622,8 +2729,9 @@ nm_ovsdb_init(NMOvsdb *self)
c_list_init(&priv->calls_lst_head);
- priv->input = g_string_new(NULL);
- priv->output = g_string_new(NULL);
+ priv->platform = g_object_ref(NM_PLATFORM_GET);
+ priv->input = g_string_new(NULL);
+ priv->output = g_string_new(NULL);
priv->bridges =
g_hash_table_new_full(nm_pstr_hash, nm_pstr_equal, (GDestroyNotify) _free_bridge, NULL);
priv->ports =
@@ -2653,6 +2761,7 @@ dispose(GObject *object)
priv->output = NULL;
}
+ g_clear_object(&priv->platform);
nm_clear_pointer(&priv->bridges, g_hash_table_destroy);
nm_clear_pointer(&priv->ports, g_hash_table_destroy);
nm_clear_pointer(&priv->interfaces, g_hash_table_destroy);
--
2.38.1

View File

@ -4,12 +4,13 @@
%global glib2_version %(pkg-config --modversion glib-2.0 2>/dev/null || echo bad)
%global epoch_version 1
%global real_version 1.40.0
%global real_version 1.42.2
%global rpm_version %{real_version}
%global release_version 2
%global release_version 1
%global snapshot %{nil}
%global git_sha %{nil}
%global bcond_default_debug 0
%global bcond_default_lto %{nil}
%global bcond_default_test 0
%global obsoletes_device_plugins 1:0.9.9.95-1
@ -60,11 +61,19 @@
%else
%bcond_with test
%endif
%if "%{?bcond_default_lto}" == ""
%if 0%{?fedora} >= 33 || 0%{?rhel} >= 9
%bcond_without lto
%else
%bcond_with lto
%endif
%else
%if %{bcond_default_lto}
%bcond_without lto
%else
%bcond_with lto
%endif
%endif
%bcond_with sanitizer
%if 0%{?fedora}
%bcond_without connectivity_fedora
@ -193,7 +202,7 @@ Source7: readme-ifcfg-rh.txt
# Patch0001: 0001-some.patch
# Bugfixes that are only relevant until next rebase of the package.
Patch1001: 1001-ovs-wait-that-links-disappear-during-initial-cleanup-rh2153430.patch
# Patch1001: 1001-some.patch
Requires(post): systemd
%if 0%{?fedora} || 0%{?rhel} >= 8
@ -255,7 +264,6 @@ BuildRequires: gnutls-devel >= 2.12
%else
BuildRequires: nss-devel >= 3.11.7
%endif
BuildRequires: dhclient
BuildRequires: readline-devel
BuildRequires: audit-libs-devel
%if %{with regen_docs}
@ -294,6 +302,10 @@ BuildRequires: python2
BuildRequires: pygobject3-base
BuildRequires: dbus-python
BuildRequires: pexpect
%if 0%{?rhel} >= 7 && %{with meson}
BuildRequires: python36-dbus
BuildRequires: python36-gobject
%endif
%endif
BuildRequires: libselinux-devel
BuildRequires: polkit-devel
@ -610,8 +622,9 @@ Preferably use nmcli instead.
%if %{with test}
--werror \
%endif
-Dnft=/usr/sbin/nft \
-Diptables=/usr/sbin/iptables \
-Dnft=%{_sbindir}/nft \
-Diptables=%{_sbindir}/iptables \
-Ddhclient=%{_sbindir}/dhclient \
-Ddhcpcanon=no \
-Ddhcpcd=no \
-Dconfig_dhcp_default=%{dhcp_default} \
@ -676,6 +689,7 @@ Preferably use nmcli instead.
%else
-Ddocs=false \
%endif
-Dqt=false \
%if %{with team}
-Dteamdctl=true \
%else
@ -703,6 +717,7 @@ Preferably use nmcli instead.
%endif
-Dsession_tracking=systemd \
-Dsuspend_resume=systemd \
-Dsystemdsystemunitdir=%{_unitdir} \
-Dsystem_ca_path=/etc/pki/tls/cert.pem \
-Ddbus_conf_dir=%{dbus_sys_dir} \
-Dtests=yes \
@ -710,8 +725,11 @@ Preferably use nmcli instead.
-Difcfg_rh=true \
-Difupdown=false \
%if %{with ppp}
-Dpppd_plugin_dir=%{_libdir}/pppd/%{ppp_version} \
-Dpppd_plugin_dir="%{_libdir}/pppd/%{ppp_version}" \
-Dpppd="%{_sbindir}/pppd" \
-Dppp=true \
%else
-Dppp=false \
%endif
%if %{with firewalld_zone}
-Dfirewalld_zone=true \
@ -739,9 +757,9 @@ autoreconf --install --force
--with-runstatedir=%{_rundir} \
--enable-silent-rules=no \
--enable-static=no \
--with-nft=/usr/sbin/nft \
--with-iptables=/usr/sbin/iptables \
--with-dhclient=yes \
--with-nft=%{_sbindir}/nft \
--with-iptables=%{_sbindir}/iptables \
--with-dhclient=%{_sbindir}/dhclient \
--with-dhcpcd=no \
--with-dhcpcanon=no \
--with-config-dhcp-default=%{dhcp_default} \
@ -839,6 +857,7 @@ autoreconf --install --force
--with-ebpf=%{ebpf_enabled} \
--with-session-tracking=systemd \
--with-suspend-resume=systemd \
--with-systemdsystemunitdir=%{_unitdir} \
--with-system-ca-path=/etc/pki/tls/cert.pem \
--with-dbus-sys-dir=%{dbus_sys_dir} \
--with-tests=yes \
@ -851,8 +870,11 @@ autoreconf --install --force
--enable-ifcfg-rh=yes \
--enable-ifupdown=no \
%if %{with ppp}
--with-pppd-plugin-dir=%{_libdir}/pppd/%{ppp_version} \
--enable-ppp=yes \
--with-pppd="%{_sbindir}/pppd" \
--with-pppd-plugin-dir="%{_libdir}/pppd/%{ppp_version}" \
%else
--enable-ppp=no \
%endif
%if %{with firewalld_zone}
--enable-firewalld-zone=yes \
@ -910,7 +932,7 @@ rm -f %{buildroot}%{nmplugindir}/*.la
# Ensure the documentation timestamps are constant to avoid multilib conflicts
find %{buildroot}%{_datadir}/gtk-doc -exec touch --reference configure.ac '{}' \+
%if 0%{?__debug_package}
%if 0%{?__debug_package} && ! 0%{?flatpak}
mkdir -p %{buildroot}%{_prefix}/src/debug/NetworkManager-%{real_version}
cp valgrind.suppressions %{buildroot}%{_prefix}/src/debug/NetworkManager-%{real_version}
%endif
@ -1067,10 +1089,10 @@ fi
%{_mandir}/man1/*
%{_mandir}/man5/*
%{_mandir}/man7/nmcli-examples.7*
%{_mandir}/man8/nm-initrd-generator.8.gz
%{_mandir}/man8/NetworkManager.8.gz
%{_mandir}/man8/NetworkManager-dispatcher.8.gz
%{_mandir}/man8/NetworkManager-wait-online.service.8.gz
%{_mandir}/man8/nm-initrd-generator.8*
%{_mandir}/man8/NetworkManager.8*
%{_mandir}/man8/NetworkManager-dispatcher.8*
%{_mandir}/man8/NetworkManager-wait-online.service.8*
%dir %{_localstatedir}/lib/NetworkManager
%dir %{_sysconfdir}/sysconfig/network-scripts
%{_datadir}/dbus-1/system-services/org.freedesktop.nm_dispatcher.service
@ -1229,8 +1251,64 @@ fi
%changelog
* Mon Mar 27 2023 Thomas Haller <thaller@redhat.com> - 1:1.40.0-2
- ovs: wait that links disappear during initial cleanup (rh #2182049)
* Thu Feb 23 2023 Beniamino Galvani <bgalvani@redhat.com> - 1:1.42.2-1
- Update to 1.42.2 release
- fix hostname lookup from IPv6 address (rh #2167816)
- add new connection property to remove the autogenerated local route rule (rh #2167805)
- fix race condition while setting the MAC of a OVS interface (rh #2168477)
- expose the DHCP IAID in the lease information (rh #2169869)
* Fri Feb 10 2023 Thomas Haller <thaller@redhat.com> - 1:1.42.0-1
- Update to 1.42.0 release
* Thu Jan 26 2023 Lubomir Rintel <lkundrak@v3.sk> - - 1:1.41.91-1
- Update to 1.41.91 release (release candidate)
- core: retry if a rtnetlink socket runs out of buffer space (rh #2154350)
- dns: allow changing resolv.conf options alone via global-dns (rh #2019306)
* Fri Jan 20 2023 Fernando Fernandez Mancera <ferferna@redhat.com> - 1:1.41.90-1
- Update to 1.41.90 release (release candidate)
- l3cfg: schedule an update after every commit-type/config-data register/unregister (rh #2158394)
- all: add support for ovs-dpdk n-rxq-desc and n-txq-desc (rh #2156385)
- core: fix consistency for internal cache for IPv6 routes (rh #2060684)
* Wed Jan 11 2023 Beniamino Galvani <bgalvani@redhat.com> - 1:1.41.8-1
- Update to 1.41.8 release (development)
- core: add support for equal-cost multi-path (ECMP) routes (rh #2081302)
- device: preserve the DHCP lease during reapply (rh #2117352)
- ovs: add support for 'other_config' settings (rh #2151455)
* Wed Dec 21 2022 Thomas Haller <thaller@redhat.com> - 1:1.41.7-2
- core: avoid infinite autoconnect with multi-connect profiles (rh #2150000)
* Thu Dec 15 2022 Lubomir Rintel <lkundrak@v3.sk> - 1:1.41.7-1
- Update to 1.41.7 release (development)
- macsec: fix tracking of parent ifindex (rh #2122564)
- cloud-setup: set preserve-external-ip flag during reapply (rh #2132754)
* Wed Nov 30 2022 Thomas Haller <thaller@redhat.com> - 1:1.41.6-1
- Update to 1.41.6 release (development)
- add support for loopback interfaces (rh #2073512)
- ovs: support VLAN trunks for OVS port (rh #2111959)
* Fri Nov 18 2022 Thomas Haller <thaller@redhat.com> - 1:1.41.5-1
- Update to 1.41.5 release (development)
* Thu Nov 3 2022 Thomas Haller <thaller@redhat.com> - 1:1.41.4-2
- fix generating stable UUIDs for keyfile (gitlab#1130)
* Wed Nov 2 2022 Wen Liang <wenliang@redhat.com> - 1:1.41.4-1
- Update to 1.41.4 release (development)
- device: don't emit recheck-assume if there is a queued activation request (rh #2092215)
- device: allow configuration of VLAN on an unmanaged interface (rh #2110307)
* Fri Oct 14 2022 Beniamino Galvani <bgalvani@redhat.com> - 1:1.41.3-1
- Update to 1.41.3 release (development)
- core: fix reapply of mptcp-flags (rh #2120471)
- core: fix autoconnection for devices with a unrealized parent (rh #2101317)
- device: fix hanging port devices when controller goes down (rh #2130287)
- bond: add "balance-slb" option which implements source load balancing (rh #2128216)
- bond: fix setting primary option when the interface is missing (rh #2126347)
* Fri Aug 26 2022 Ana Cabral <acabral@redhat.com> - 1:1.40.0-1
- Update to 1.40.0 release