summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2021-06-17 11:35:54 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2021-06-21 08:53:42 +0200
commit637a45e25b58afd1ac22af8657121e0956093b61 (patch)
tree753ec3cc90c7233185344b2ab28f60636098fb64 /src
parent8f3892ba3efc8560187d59ee49b4dcba8f2bdc30 (diff)
policy: prefer IPv4 to determine the hostname
When determining the hostname, it is preferable to evaluate devices in a predictable order to avoid that the hostname changes between different boots. The current order is based first on hostname priority, then on the presence of a best default route, and then on activation order. The activation order is not a very strong condition, as it is basically useless for devices that are autoactivated at boot. As we already prefer IPv4 over IPv6 within the same connection, also prefer it when 2 connections have the same priority and the same default route status, to achieve better predictability. https://bugzilla.redhat.com/show_bug.cgi?id=1970335 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/895
Diffstat (limited to 'src')
-rw-r--r--src/core/nm-policy.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/core/nm-policy.c b/src/core/nm-policy.c
index c2ab9b2d0d..e4914acfb5 100644
--- a/src/core/nm-policy.c
+++ b/src/core/nm-policy.c
@@ -652,6 +652,7 @@ device_hostname_info_compare(gconstpointer a, gconstpointer b)
NM_CMP_FIELD(info1, info2, priority);
NM_CMP_FIELD_UNSAFE(info2, info1, is_default);
+ NM_CMP_FIELD_UNSAFE(info2, info1, IS_IPv4);
return 0;
}