import NetworkManager-1.36.0-7.el8_6

This commit is contained in:
CentOS Sources 2022-06-28 06:58:00 -04:00 committed by Stepan Oksanichenko
parent 1b23d305e8
commit c312ce5014
4 changed files with 2396 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,309 @@
From 3547c4d09a1d10b150a61bcbdc2418d750f7f616 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 1 Apr 2022 08:39:56 +0200
Subject: [PATCH 1/2] dhcp: set "src" for DHCPv4 routes
Let's set the "src" (RTA_PREFSRC) of DHCP routes.
This helps with source address selection.
This can matter if the interface also has static addresses
configured.
Systemd-networkd also does this ([1], [2]).
[1] https://github.com/systemd/systemd/commit/ac2dce5f36bb8b1a877ff765e6a4dfde6bfb2d49
[2] https://github.com/systemd/systemd/blob/5b89bff55f45235f72d30d90fd489fe2247ad00d/src/network/networkd-dhcp4.c#L395
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1995372
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1173
(cherry picked from commit 2dc7a3d9f9135959adf415405bdcb05a7387c1d4)
(cherry picked from commit 10b9e07bfc3ae044b35a7dc6559aa6a4583bd7e8)
(cherry picked from commit f2942d11a75e5fb0bda35f8b659d0643f1f418b2)
---
src/core/dhcp/nm-dhcp-nettools.c | 16 ++++++++++++----
src/core/dhcp/nm-dhcp-systemd.c | 4 +++-
src/core/dhcp/nm-dhcp-utils.c | 26 +++++++++++++++-----------
3 files changed, 30 insertions(+), 16 deletions(-)
diff --git a/src/core/dhcp/nm-dhcp-nettools.c b/src/core/dhcp/nm-dhcp-nettools.c
index d7fbe3561599..769b0325f23d 100644
--- a/src/core/dhcp/nm-dhcp-nettools.c
+++ b/src/core/dhcp/nm-dhcp-nettools.c
@@ -154,6 +154,7 @@ static gboolean
lease_parse_address(NDhcp4ClientLease *lease,
NML3ConfigData *l3cd,
GHashTable *options,
+ in_addr_t *out_address,
GError **error)
{
struct in_addr a_address;
@@ -268,6 +269,8 @@ lease_parse_address(NDhcp4ClientLease *lease,
.preferred = a_lifetime,
}));
+ NM_SET_OUT(out_address, a_address.s_addr);
+
return TRUE;
}
@@ -326,6 +329,7 @@ lease_parse_address_list(NDhcp4ClientLease *lease,
static void
lease_parse_routes(NDhcp4ClientLease *lease,
NML3ConfigData *l3cd,
+ in_addr_t lease_address,
GHashTable *options,
NMStrBuf *sbuf)
{
@@ -373,10 +377,11 @@ lease_parse_routes(NDhcp4ClientLease *lease,
nm_l3_config_data_add_route_4(l3cd,
&((const NMPlatformIP4Route){
+ .rt_source = NM_IP_CONFIG_SOURCE_DHCP,
.network = dest,
.plen = plen,
.gateway = gateway,
- .rt_source = NM_IP_CONFIG_SOURCE_DHCP,
+ .pref_src = lease_address,
.table_any = TRUE,
.table_coerced = 0,
.metric_any = TRUE,
@@ -416,10 +421,11 @@ lease_parse_routes(NDhcp4ClientLease *lease,
nm_l3_config_data_add_route_4(l3cd,
&((const NMPlatformIP4Route){
+ .rt_source = NM_IP_CONFIG_SOURCE_DHCP,
.network = dest,
.plen = plen,
.gateway = gateway,
- .rt_source = NM_IP_CONFIG_SOURCE_DHCP,
+ .pref_src = lease_address,
.table_any = TRUE,
.table_coerced = 0,
.metric_any = TRUE,
@@ -464,6 +470,7 @@ lease_parse_routes(NDhcp4ClientLease *lease,
&((const NMPlatformIP4Route){
.rt_source = NM_IP_CONFIG_SOURCE_DHCP,
.gateway = gateway,
+ .pref_src = lease_address,
.table_any = TRUE,
.table_coerced = 0,
.metric_any = TRUE,
@@ -547,6 +554,7 @@ lease_to_ip4_config(NMDedupMultiIndex *multi_idx,
const char *v_str;
guint16 v_u16;
in_addr_t v_inaddr;
+ in_addr_t lease_address;
struct in_addr v_inaddr_s;
int r;
@@ -556,7 +564,7 @@ lease_to_ip4_config(NMDedupMultiIndex *multi_idx,
options = nm_dhcp_option_create_options_dict();
- if (!lease_parse_address(lease, l3cd, options, error))
+ if (!lease_parse_address(lease, l3cd, options, &lease_address, error))
return NULL;
r = n_dhcp4_client_lease_get_server_identifier(lease, &v_inaddr_s);
@@ -575,7 +583,7 @@ lease_to_ip4_config(NMDedupMultiIndex *multi_idx,
v_inaddr);
}
- lease_parse_routes(lease, l3cd, options, &sbuf);
+ lease_parse_routes(lease, l3cd, lease_address, options, &sbuf);
lease_parse_address_list(lease, l3cd, NM_DHCP_OPTION_DHCP4_DOMAIN_NAME_SERVER, options, &sbuf);
diff --git a/src/core/dhcp/nm-dhcp-systemd.c b/src/core/dhcp/nm-dhcp-systemd.c
index 0884def35dc6..d17646154f67 100644
--- a/src/core/dhcp/nm-dhcp-systemd.c
+++ b/src/core/dhcp/nm-dhcp-systemd.c
@@ -309,10 +309,11 @@ lease_to_ip4_config(NMDedupMultiIndex *multi_idx,
nm_l3_config_data_add_route_4(l3cd,
&((const NMPlatformIP4Route){
+ .rt_source = NM_IP_CONFIG_SOURCE_DHCP,
.network = network_net,
.plen = r_plen,
.gateway = r_gateway.s_addr,
- .rt_source = NM_IP_CONFIG_SOURCE_DHCP,
+ .pref_src = a_address.s_addr,
.metric_any = TRUE,
.metric = m,
.table_any = TRUE,
@@ -366,6 +367,7 @@ lease_to_ip4_config(NMDedupMultiIndex *multi_idx,
&((const NMPlatformIP4Route){
.rt_source = NM_IP_CONFIG_SOURCE_DHCP,
.gateway = a_router[i].s_addr,
+ .pref_src = a_address.s_addr,
.table_any = TRUE,
.table_coerced = 0,
.metric_any = TRUE,
diff --git a/src/core/dhcp/nm-dhcp-utils.c b/src/core/dhcp/nm-dhcp-utils.c
index 4a138086b957..c71796f8bd9d 100644
--- a/src/core/dhcp/nm-dhcp-utils.c
+++ b/src/core/dhcp/nm-dhcp-utils.c
@@ -28,7 +28,8 @@ static gboolean
ip4_process_dhcpcd_rfc3442_routes(const char *iface,
const char *str,
NML3ConfigData *l3cd,
- guint32 *gwaddr)
+ in_addr_t address,
+ guint32 *out_gwaddr)
{
gs_free const char **routes = NULL;
const char **r;
@@ -79,7 +80,7 @@ ip4_process_dhcpcd_rfc3442_routes(const char *iface,
have_routes = TRUE;
if (rt_cidr == 0 && rt_addr == 0) {
/* FIXME: how to handle multiple routers? */
- *gwaddr = rt_route;
+ *out_gwaddr = rt_route;
} else {
_LOG2I(LOGD_DHCP4,
iface,
@@ -91,13 +92,13 @@ ip4_process_dhcpcd_rfc3442_routes(const char *iface,
nm_l3_config_data_add_route_4(
l3cd,
&((const NMPlatformIP4Route){
+ .rt_source = NM_IP_CONFIG_SOURCE_DHCP,
.network = nm_utils_ip4_address_clear_host_address(rt_addr, rt_cidr),
.plen = rt_cidr,
.gateway = rt_route,
- .rt_source = NM_IP_CONFIG_SOURCE_DHCP,
+ .pref_src = address,
.metric_any = TRUE,
.table_any = TRUE,
-
}));
}
}
@@ -158,7 +159,8 @@ static gboolean
ip4_process_dhclient_rfc3442_routes(const char *iface,
const char *str,
NML3ConfigData *l3cd,
- guint32 *gwaddr)
+ in_addr_t address,
+ guint32 *out_gwaddr)
{
gs_free const char **octets = NULL;
const char *const *o;
@@ -182,13 +184,14 @@ ip4_process_dhclient_rfc3442_routes(const char *iface,
have_routes = TRUE;
if (!route.plen) {
/* gateway passed as classless static route */
- *gwaddr = route.gateway;
+ *out_gwaddr = route.gateway;
} else {
char b1[INET_ADDRSTRLEN];
char b2[INET_ADDRSTRLEN];
/* normal route */
route.rt_source = NM_IP_CONFIG_SOURCE_DHCP;
+ route.pref_src = address;
route.table_any = TRUE;
route.table_coerced = 0;
route.metric_any = TRUE;
@@ -212,14 +215,15 @@ static gboolean
ip4_process_classless_routes(const char *iface,
GHashTable *options,
NML3ConfigData *l3cd,
- guint32 *gwaddr)
+ in_addr_t address,
+ guint32 *out_gwaddr)
{
const char *str, *p;
g_return_val_if_fail(options != NULL, FALSE);
g_return_val_if_fail(l3cd != NULL, FALSE);
- *gwaddr = 0;
+ *out_gwaddr = 0;
/* dhcpd/dhclient in Fedora has support for rfc3442 implemented using a
* slightly different format:
@@ -266,10 +270,10 @@ ip4_process_classless_routes(const char *iface,
if (strchr(str, '/')) {
/* dhcpcd format */
- return ip4_process_dhcpcd_rfc3442_routes(iface, str, l3cd, gwaddr);
+ return ip4_process_dhcpcd_rfc3442_routes(iface, str, l3cd, address, out_gwaddr);
}
- return ip4_process_dhclient_rfc3442_routes(iface, str, l3cd, gwaddr);
+ return ip4_process_dhclient_rfc3442_routes(iface, str, l3cd, address, out_gwaddr);
}
static void
@@ -422,7 +426,7 @@ nm_dhcp_utils_ip4_config_from_options(NMDedupMultiIndex *multi_idx,
/* Routes: if the server returns classless static routes, we MUST ignore
* the 'static_routes' option.
*/
- if (!ip4_process_classless_routes(iface, options, l3cd, &gateway))
+ if (!ip4_process_classless_routes(iface, options, l3cd, address.address, &gateway))
process_classful_routes(iface, options, l3cd);
if (gateway) {
--
2.36.1
From ebfc7c2c58e6125346baf9b530e71b2571dc0c10 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Wed, 13 Apr 2022 10:43:13 +0200
Subject: [PATCH 2/2] dhcp/dhclient: fix setting "src" attribute for certain
routes
Fixes: 2dc7a3d9f913 ('dhcp: set "src" for DHCPv4 routes')
(cherry picked from commit 197e73ac7c53556b32ff048c9720907be3217487)
(cherry picked from commit 0c6d242dc0b67b6269657acf33bf9d1f0830f0b4)
(cherry picked from commit b0a7dda2eae1493a3a285ed1d08178409266ba07)
---
src/core/dhcp/nm-dhcp-utils.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/core/dhcp/nm-dhcp-utils.c b/src/core/dhcp/nm-dhcp-utils.c
index c71796f8bd9d..35a2c6543759 100644
--- a/src/core/dhcp/nm-dhcp-utils.c
+++ b/src/core/dhcp/nm-dhcp-utils.c
@@ -277,7 +277,10 @@ ip4_process_classless_routes(const char *iface,
}
static void
-process_classful_routes(const char *iface, GHashTable *options, NML3ConfigData *l3cd)
+process_classful_routes(const char *iface,
+ GHashTable *options,
+ NML3ConfigData *l3cd,
+ in_addr_t address)
{
gs_free const char **searches = NULL;
const char **s;
@@ -325,6 +328,7 @@ process_classful_routes(const char *iface, GHashTable *options, NML3ConfigData *
route.plen = 32;
}
route.gateway = rt_route;
+ route.pref_src = address;
route.rt_source = NM_IP_CONFIG_SOURCE_DHCP;
route.table_any = TRUE;
route.table_coerced = 0;
@@ -427,7 +431,7 @@ nm_dhcp_utils_ip4_config_from_options(NMDedupMultiIndex *multi_idx,
* the 'static_routes' option.
*/
if (!ip4_process_classless_routes(iface, options, l3cd, address.address, &gateway))
- process_classful_routes(iface, options, l3cd);
+ process_classful_routes(iface, options, l3cd, address.address);
if (gateway) {
_LOG2I(LOGD_DHCP4, iface, " gateway %s", _nm_utils_inet4_ntop(gateway, sbuf));
@@ -457,6 +461,7 @@ nm_dhcp_utils_ip4_config_from_options(NMDedupMultiIndex *multi_idx,
const NMPlatformIP4Route r = {
.rt_source = NM_IP_CONFIG_SOURCE_DHCP,
.gateway = gateway,
+ .pref_src = address.address,
.table_any = TRUE,
.table_coerced = 0,
.metric_any = TRUE,
--
2.36.1

View File

@ -0,0 +1,77 @@
From 4c556203d93fdd143630431dded4e0e6ea24824e Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Thu, 9 Jun 2022 10:00:47 +0200
Subject: [PATCH 1/1] platform: workaround for preserving IPv6 address order
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/ ## 1021
---
src/libnm-platform/nm-platform.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c
index f264ed7a45b2..120e50b3c772 100644
--- a/src/libnm-platform/nm-platform.c
+++ b/src/libnm-platform/nm-platform.c
@@ -3961,45 +3961,60 @@ nm_platform_ip_address_sync(NMPlatform *self,
for (i = 0; i < addresses_prune->len; i++) {
const NMPObject *prune_obj = addresses_prune->pdata[i];
nm_assert(NM_IN_SET(NMP_OBJECT_GET_TYPE(prune_obj),
NMP_OBJECT_TYPE_IP4_ADDRESS,
NMP_OBJECT_TYPE_IP6_ADDRESS));
if (nm_g_hash_table_contains(known_addresses_idx, prune_obj))
continue;
nm_platform_ip_address_delete(self,
addr_family,
ifindex,
NMP_OBJECT_CAST_IP_ADDRESS(prune_obj));
}
}
/* @plat_addresses for IPv6 must be sorted in decreasing priority order (highest priority addresses first).
* IPv4 are probably unsorted or sorted with lowest priority first, but their order doesn't matter because
* we check the "secondary" flag. */
+ if (IS_IPv4) {
plat_addresses = nm_platform_lookup_clone(
self,
nmp_lookup_init_object(&lookup, NMP_OBJECT_TYPE_IP_ADDRESS(IS_IPv4), ifindex),
NULL,
NULL);
+ } else {
+ /* HACK: early 1.36 versions had a bug of not actually reordering the IPv6 addresses.
+ * This was fixed by commit cd4601802de5 ('platform: fix address order in
+ * nm_platform_ip_address_sync()').
+ *
+ * However, also in 1.36, the actually implemented order of IPv6 addresses is not
+ * the one we want ([1]). So disable the fix again, to not reorder IPv6 addresses.
+ *
+ * The effect is, that DHCPv6 addresses end up being preferred over SLAAC, because
+ * they get added later during activation. Of course, if any address gets added
+ * even later (like a new router appearing), then the order will be wrong again.
+ *
+ * [1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1021 */
+ }
if (nm_g_ptr_array_len(plat_addresses) > 0) {
/* Delete addresses that interfere with our intended order. */
if (IS_IPv4) {
GHashTable *known_subnets = NULL;
GHashTable *plat_subnets;
gs_free bool *plat_handled_to_free = NULL;
bool *plat_handled = NULL;
/* For IPv4, we only consider it a conflict for addresses in the same
* subnet. That's where kernel will assign a primary/secondary flag.
* For different subnets, we don't define the order. */
plat_subnets = ip4_addr_subnets_build_index(plat_addresses, TRUE, TRUE);
for (i = 0; i < plat_addresses->len; i++) {
const NMPObject *plat_obj = plat_addresses->pdata[i];
const NMPObject *known_obj;
const NMPlatformIP4Address *plat_address;
const GPtrArray *addr_list;
--
2.36.1

View File

@ -7,7 +7,7 @@
%global epoch_version 1 %global epoch_version 1
%global rpm_version 1.36.0 %global rpm_version 1.36.0
%global real_version 1.36.0 %global real_version 1.36.0
%global release_version 4 %global release_version 7
%global snapshot %{nil} %global snapshot %{nil}
%global git_sha %{nil} %global git_sha %{nil}
@ -198,6 +198,9 @@ Patch1001: 1001-wwan-dns-fix-rh2059138.patch
Patch1002: 1002-checkpoint-preserve-external-bridge-ports-rh2035519.patch Patch1002: 1002-checkpoint-preserve-external-bridge-ports-rh2035519.patch
Patch1003: 1003-fix-ovsdb-removal-ports-rhbz1935026.patch Patch1003: 1003-fix-ovsdb-removal-ports-rhbz1935026.patch
Patch1004: 1004-n-dhcp4-discard-NAKs-from-other-servers-rhbz2059673.patch Patch1004: 1004-n-dhcp4-discard-NAKs-from-other-servers-rhbz2059673.patch
Patch1005: 1005-fix-dhcp-loses-lease-when-restarting-rhbz2090280.patch
Patch1006: 1006-dhcp-routes-src-rh2092807.patch
Patch1007: 1007-platform-workaround-for-preserving-ipv6-address-rhbz2090280.patch
# The pregenerated docs contain default values and paths that depend # The pregenerated docs contain default values and paths that depend
# on the configure options when creating the source tarball. # on the configure options when creating the source tarball.
@ -1199,6 +1202,18 @@ fi
%changelog %changelog
* Thu Jun 09 2022 Fernando Fernandez Mancera <ferferna@redhat.com> - 1:1.36.0-7
- platform: workaround for preserving IPv6 address order (rh #2090280)
* Tue Jun 7 2022 Thomas Haller <thaller@redhat.com> - 1:1.36.0-6
- core: set "src" attribute for routes from DHCPv4 (rh #2092807)
* Wed May 25 2022 Fernando Fernandez Mancera <ferferna@redhat.com> - 1:1.36.0-5
- Fix DHCP loses lease when restarting (rh #2090280)
* Mon Mar 21 2022 Fernando Fernandez Mancera <ferferna@redhat.com> - 1:1.36.0-4
- n-dhcp4: discard NAKs from different servers in SELECTING (rh #2059673)
* Fri Mar 11 2022 Thomas Haller <thaller@redhat.com> - 1:1.36.0-3 * Fri Mar 11 2022 Thomas Haller <thaller@redhat.com> - 1:1.36.0-3
- core: preserve external bridge ports during checkpoint rollback (rh #2035519) - core: preserve external bridge ports during checkpoint rollback (rh #2035519)
- ovs-port: fix removal of ovsdb entry if the interface goes away (rh #1935026) - ovs-port: fix removal of ovsdb entry if the interface goes away (rh #1935026)