Blame SOURCES/1007-platform-workaround-for-preserving-ipv6-address-rhbz2094715.patch

c94432
From 43b27ab2c4735e35d84e6f5c90b8a79e23c05587 Mon Sep 17 00:00:00 2001
c94432
From: Thomas Haller <thaller@redhat.com>
c94432
Date: Thu, 9 Jun 2022 10:00:47 +0200
c94432
Subject: [PATCH 1/1] platform: workaround for preserving IPv6 address order
c94432
c94432
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/ ## 1021
c94432
---
c94432
 src/libnm-platform/nm-platform.c | 25 ++++++++++++++++++++-----
c94432
 1 file changed, 20 insertions(+), 5 deletions(-)
c94432
c94432
diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c
c94432
index f264ed7a45b2..45534dd96a46 100644
c94432
--- a/src/libnm-platform/nm-platform.c
c94432
+++ b/src/libnm-platform/nm-platform.c
c94432
@@ -3978,11 +3978,26 @@ nm_platform_ip_address_sync(NMPlatform *self,
c94432
     /* @plat_addresses for IPv6 must be sorted in decreasing priority order (highest priority addresses first).
c94432
      * IPv4 are probably unsorted or sorted with lowest priority first, but their order doesn't matter because
c94432
      * we check the "secondary" flag. */
c94432
-    plat_addresses = nm_platform_lookup_clone(
c94432
-        self,
c94432
-        nmp_lookup_init_object(&lookup, NMP_OBJECT_TYPE_IP_ADDRESS(IS_IPv4), ifindex),
c94432
-        NULL,
c94432
-        NULL);
c94432
+    if (IS_IPv4) {
c94432
+        plat_addresses = nm_platform_lookup_clone(
c94432
+            self,
c94432
+            nmp_lookup_init_object(&lookup, NMP_OBJECT_TYPE_IP_ADDRESS(IS_IPv4), ifindex),
c94432
+            NULL,
c94432
+            NULL);
c94432
+    } else {
c94432
+        /* HACK: early 1.36 versions had a bug of not actually reordering the IPv6 addresses.
c94432
+         * This was fixed by commit cd4601802de5 ('platform: fix address order in
c94432
+         * nm_platform_ip_address_sync()').
c94432
+         *
c94432
+         * However, also in 1.36, the actually implemented order of IPv6 addresses is not
c94432
+         * the one we want ([1]). So disable the fix again, to not reorder IPv6 addresses.
c94432
+         *
c94432
+         * The effect is, that DHCPv6 addresses end up being preferred over SLAAC, because
c94432
+         * they get added later during activation. Of course, if any address gets added
c94432
+         * even later (like a new router appearing), then the order will be wrong again.
c94432
+         *
c94432
+         * [1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1021 */
c94432
+    }
c94432
 
c94432
     if (nm_g_ptr_array_len(plat_addresses) > 0) {
c94432
         /* Delete addresses that interfere with our intended order. */
c94432
-- 
c94432
2.36.1