e9658e42ed
Resolves: RHEL-8423
91 lines
4.4 KiB
Diff
91 lines
4.4 KiB
Diff
From a7005248bbd8d563962c6a68ed7f1ead58e9df26 Mon Sep 17 00:00:00 2001
|
|
From: Beniamino Galvani <bgalvani@redhat.com>
|
|
Date: Tue, 28 Mar 2023 09:32:13 +0200
|
|
Subject: [PATCH] core: fix l3cd comparison
|
|
|
|
NM_CMP_SELF(a, b) returns immediately if the objects are the same.
|
|
|
|
Fixes: cb29244552af ('core: support compare flags in nm_l3_config_data_cmp_full()')
|
|
Fixes-test: @dracut_NM_iSCSI_ibft_table
|
|
|
|
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1583
|
|
(cherry picked from commit 0a02995175e06e62924705393121a1c5efc3822d)
|
|
(cherry picked from commit 5d95c20787077a91d684259d67f2e0ff3a1d7a1a)
|
|
(cherry picked from commit 1395171326e84eafbf2f372c232bf27a4ed79481)
|
|
---
|
|
src/core/nm-l3-config-data.c | 55 ++++++++++++++++++------------------
|
|
1 file changed, 28 insertions(+), 27 deletions(-)
|
|
|
|
diff --git a/src/core/nm-l3-config-data.c b/src/core/nm-l3-config-data.c
|
|
index d4c7f0c5fb..afdd53920d 100644
|
|
--- a/src/core/nm-l3-config-data.c
|
|
+++ b/src/core/nm-l3-config-data.c
|
|
@@ -2278,36 +2278,37 @@ nm_l3_config_data_cmp_full(const NML3ConfigData *a,
|
|
const NMPObject *def_route_a = a->best_default_route_x[IS_IPv4];
|
|
const NMPObject *def_route_b = b->best_default_route_x[IS_IPv4];
|
|
|
|
- NM_CMP_SELF(def_route_a, def_route_b);
|
|
-
|
|
- if (NM_FLAGS_HAS(flags, NM_L3_CONFIG_CMP_FLAGS_ROUTES)) {
|
|
- NM_CMP_RETURN(nmp_object_cmp_full(def_route_a,
|
|
- def_route_b,
|
|
- NM_FLAGS_HAS(flags, NM_L3_CONFIG_CMP_FLAGS_IFINDEX)
|
|
- ? NMP_OBJECT_CMP_FLAGS_NONE
|
|
- : NMP_OBJECT_CMP_FLAGS_IGNORE_IFINDEX));
|
|
- } else if (NM_FLAGS_HAS(flags, NM_L3_CONFIG_CMP_FLAGS_ROUTES_ID)) {
|
|
- if (NM_FLAGS_HAS(flags, NM_L3_CONFIG_CMP_FLAGS_IFINDEX)) {
|
|
- NM_CMP_DIRECT(def_route_a->obj_with_ifindex.ifindex,
|
|
- def_route_b->obj_with_ifindex.ifindex);
|
|
- }
|
|
+ if (def_route_a != def_route_b) {
|
|
+ if (NM_FLAGS_HAS(flags, NM_L3_CONFIG_CMP_FLAGS_ROUTES)) {
|
|
+ NM_CMP_RETURN(
|
|
+ nmp_object_cmp_full(def_route_a,
|
|
+ def_route_b,
|
|
+ NM_FLAGS_HAS(flags, NM_L3_CONFIG_CMP_FLAGS_IFINDEX)
|
|
+ ? NMP_OBJECT_CMP_FLAGS_NONE
|
|
+ : NMP_OBJECT_CMP_FLAGS_IGNORE_IFINDEX));
|
|
+ } else if (NM_FLAGS_HAS(flags, NM_L3_CONFIG_CMP_FLAGS_ROUTES_ID)) {
|
|
+ if (NM_FLAGS_HAS(flags, NM_L3_CONFIG_CMP_FLAGS_IFINDEX)) {
|
|
+ NM_CMP_DIRECT(def_route_a->obj_with_ifindex.ifindex,
|
|
+ def_route_b->obj_with_ifindex.ifindex);
|
|
+ }
|
|
|
|
- if (IS_IPv4) {
|
|
- NMPlatformIP4Route ra = def_route_a->ip4_route;
|
|
- NMPlatformIP4Route rb = def_route_b->ip4_route;
|
|
+ if (IS_IPv4) {
|
|
+ NMPlatformIP4Route ra = def_route_a->ip4_route;
|
|
+ NMPlatformIP4Route rb = def_route_b->ip4_route;
|
|
|
|
- NM_CMP_DIRECT(ra.metric, rb.metric);
|
|
- NM_CMP_DIRECT(ra.plen, rb.plen);
|
|
- NM_CMP_RETURN_DIRECT(
|
|
- nm_utils_ip4_address_same_prefix_cmp(ra.network, rb.network, ra.plen));
|
|
- } else {
|
|
- NMPlatformIP6Route ra = def_route_a->ip6_route;
|
|
- NMPlatformIP6Route rb = def_route_b->ip6_route;
|
|
+ NM_CMP_DIRECT(ra.metric, rb.metric);
|
|
+ NM_CMP_DIRECT(ra.plen, rb.plen);
|
|
+ NM_CMP_RETURN_DIRECT(
|
|
+ nm_utils_ip4_address_same_prefix_cmp(ra.network, rb.network, ra.plen));
|
|
+ } else {
|
|
+ NMPlatformIP6Route ra = def_route_a->ip6_route;
|
|
+ NMPlatformIP6Route rb = def_route_b->ip6_route;
|
|
|
|
- NM_CMP_DIRECT(ra.metric, rb.metric);
|
|
- NM_CMP_DIRECT(ra.plen, rb.plen);
|
|
- NM_CMP_RETURN_DIRECT(
|
|
- nm_utils_ip6_address_same_prefix_cmp(&ra.network, &rb.network, ra.plen));
|
|
+ NM_CMP_DIRECT(ra.metric, rb.metric);
|
|
+ NM_CMP_DIRECT(ra.plen, rb.plen);
|
|
+ NM_CMP_RETURN_DIRECT(
|
|
+ nm_utils_ip6_address_same_prefix_cmp(&ra.network, &rb.network, ra.plen));
|
|
+ }
|
|
}
|
|
}
|
|
|
|
--
|
|
2.41.0
|
|
|