resolved: turn off that a search domain is derived from the host's fqdn

If the hostname of a system is set to an fqdn, glibc traditionally
derives a search domain from it if none is explicitly configured.

This is a bit weird, and we currently don't do that in our own search
path logic.

Following #17193 let's turn this behaviour off for now.

Yes, this has a slight chance of pissing people off who think this
behaviour is good. If this is indeed an issue, we can revisit the issue
but in that case if we readd the concept we should do it properly:
derive the search domain from the fqdn in our codebase too and report it
in resolvectl, and in our generated stub files. But I have the suspicion
most people who set the hostname to an fqdn aren#t even aware of this
behaviour nor want it, so let's wait until people complain.

Fixes: #17193
This commit is contained in:
Lennart Poettering 2020-09-29 16:10:40 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent 5ced292d10
commit b3ffa2b5f3
2 changed files with 9 additions and 2 deletions

View File

@ -16,3 +16,4 @@
nameserver 127.0.0.53
options edns0 trust-ad
search .

View File

@ -271,7 +271,10 @@ static int write_uplink_resolv_conf_contents(FILE *f, OrderedSet *dns, OrderedSe
write_resolv_conf_server(s, f, &count);
}
if (!ordered_set_isempty(domains))
if (ordered_set_isempty(domains))
fputs("search .", f); /* Make sure that if the local hostname is chosen as fqdn this does not
* imply a search domain */
else
write_resolv_conf_search(domains, f);
return fflush_and_check(f);
@ -297,7 +300,10 @@ static int write_stub_resolv_conf_contents(FILE *f, OrderedSet *dns, OrderedSet
"nameserver 127.0.0.53\n"
"options edns0 trust-ad\n", f);
if (!ordered_set_isempty(domains))
if (ordered_set_isempty(domains))
fputs("search .", f); /* Make sure that if the local hostname is chosen as fqdn this does not
* imply a search domain */
else
write_resolv_conf_search(domains, f);
return fflush_and_check(f);