On Mi, 15.04.20 16:27, Florian Weimer (fweimer(a)redhat.com) wrote:
> That said, resolved has a bus API for resolving hosts too, which
gives
> a bit richer an API to do things, instead of using
> gethostbyname(). resolved parses and caches /etc/hosts for that
> natively, so that we can server the same set of names when going via
> the bus API or via NSS.
>
>> Does systemd-resolved cache /etc/hosts?
>
> Yes.
Then I don't understand why we are listing files first, before
resolve.
It should be fine to swap this around I guess. This hasn't come up
before. The /etc/hosts support in resolved was added primarily for
full compat when queries come in via dbus. It wasn't supposed to be a
better implementation of nss-files (though it effectively is, since we
parse on when the file changes and cache in memory), but I guess we
can decide it's not just compat feature now, but also and performance
improvement feature.
Lennart
--
Lennart Poettering, Berlin