Blame SOURCES/1012-prefer-IPv4-to-determine-the-hostname.patch

d94dbe
From 65ea6e97238a76386d0477abc0d22b2227f38d60 Mon Sep 17 00:00:00 2001
d94dbe
From: Beniamino Galvani <bgalvani@redhat.com>
d94dbe
Date: Thu, 17 Jun 2021 11:35:54 +0200
d94dbe
Subject: [PATCH] policy: prefer IPv4 to determine the hostname
d94dbe
d94dbe
When determining the hostname, it is preferable to evaluate devices in
d94dbe
a predictable order to avoid that the hostname changes between
d94dbe
different boots.
d94dbe
d94dbe
The current order is based first on hostname priority, then on the
d94dbe
presence of a best default route, and then on activation order.
d94dbe
d94dbe
The activation order is not a very strong condition, as it is
d94dbe
basically useless for devices that are autoactivated at boot.
d94dbe
d94dbe
As we already prefer IPv4 over IPv6 within the same connection, also
d94dbe
prefer it when 2 connections have the same priority and the same
d94dbe
default route status, to achieve better predictability.
d94dbe
d94dbe
https://bugzilla.redhat.com/show_bug.cgi?id=1970335
d94dbe
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/895
d94dbe
(cherry picked from commit 637a45e25b58afd1ac22af8657121e0956093b61)
d94dbe
(cherry picked from commit 21051dc6d8b87c48fafb44b5cde901633b0a7cd2)
d94dbe
(cherry picked from commit b793925889a3137b77fa2b8679144b1e4948d246)
d94dbe
---
d94dbe
 src/core/nm-policy.c | 1 +
d94dbe
 1 file changed, 1 insertion(+)
d94dbe
d94dbe
diff --git a/src/core/nm-policy.c b/src/core/nm-policy.c
d94dbe
index db4983f889..71aa1eceaf 100644
d94dbe
--- a/src/core/nm-policy.c
d94dbe
+++ b/src/core/nm-policy.c
d94dbe
@@ -652,6 +652,7 @@ device_hostname_info_compare(gconstpointer a, gconstpointer b)
d94dbe
 
d94dbe
     NM_CMP_FIELD(info1, info2, priority);
d94dbe
     NM_CMP_FIELD_UNSAFE(info2, info1, is_default);
d94dbe
+    NM_CMP_FIELD_UNSAFE(info2, info1, IS_IPv4);
d94dbe
 
d94dbe
     return 0;
d94dbe
 }
d94dbe
-- 
d94dbe
2.31.1
d94dbe