]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: turn off that a search domain is derived from the host's fqdn
authorLennart Poettering <lennart@poettering.net>
Tue, 29 Sep 2020 14:10:40 +0000 (16:10 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 30 Sep 2020 08:37:59 +0000 (10:37 +0200)
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
src/resolve/resolv.conf
src/resolve/resolved-resolv-conf.c

index dc5ac05532abceb358567da9a6f778be557d3fc0..b4e9a96b35a122832e997a09d64d5923cfe74ddd 100644 (file)
@@ -16,3 +16,4 @@
 
 nameserver 127.0.0.53
 options edns0 trust-ad
+search .
index 0de504636770e44eadecee35fbbe242bc867b61f..7f48c0b9a759f887f60e08bd62ac5cf8ef9b4556 100644 (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);