Skip to content

Consider entries in /etc/hosts for hostname resolution

Beniamino Galvani requested to merge bg/hostname-fallback-hosts into main

Summary

Before introducing the hostname lookup via nm-daemon-helper and systemd-resolved in 27eae404, we used GLib's GResolver which internally relies on the libc resolver and generally also returns results from /etc/hosts.

With the new mechanism we only ask to systemd-resolved (with NO_SYNTHESIZE) or perform the lookup via the "dns" NSS module. In both ways, /etc/hosts is not evaluated.

Since users relied on having the hostname resolved via /etc/hosts, restore that behavior.

CI test: NetworkManager-ci!1710

Checklist

Please read https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/main/CONTRIBUTING.md before opening the merge request. In particular, check that:

  • the subject for all commits is concise and explicative
  • the message for all commits explains the reason for the change
  • the source is properly formatted
  • any relevant documentation is up to date
  • you have added unit tests if applicable
  • the NEWS file is updated when the change deserves to be mentioned, for example for new features, behavior changes, API deprecations, etc.

Resolves: https://issues.redhat.com/browse/RHEL-33435

Edited by Beniamino Galvani

Merge request reports