Skip to content

core: better handle sd-resolved errors when resolving hostnames

Beniamino Galvani requested to merge bg/hostnamed-errors into main

If NM tries to resolve a link-local address, systemd-resolved returns error "org.freedesktop.resolve1.NoNameServers" because those addresses can only be resolved via other protocols like LLMNR or mDNS.

Previously NM would fall back to spawning the helper, which would ask again to systemd-resolved via /etc/resolv.conf. In this way, a synthetic result (or one obtained not from DNS) would be returned.

We must avoid non-DNS results. When systemd-resolved returns an error that is not a D-Bus one (as MethodNotFound) but is a "org.fd.resolve1.*" [1], we can assume that systemd-resolved is running properly and we shall never fall back to spawning the helper.

[1] https://www.freedesktop.org/wiki/Software/systemd/resolved/#commonerrors

#833 (closed)

Merge request reports