]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: fix single-label resolution over DNS
authorJacek Migacz <jmigacz@redhat.com>
Wed, 27 Jul 2022 16:38:12 +0000 (18:38 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 2 Aug 2022 17:21:46 +0000 (19:21 +0200)
Fixes: #23494 (when ResolveUnicastSingleLabel=yes)
src/resolve/resolved-dns-scope.c

index 473e397013bb6c1f2fed696db828088cd25010a8..8fd987bd824d05b7b872d894974cd035673ace74 100644 (file)
@@ -692,6 +692,11 @@ DnsScopeMatch dns_scope_good_domain(
                 if (has_search_domains && dns_name_is_single_label(domain))
                         return DNS_SCOPE_YES_BASE + 1;
 
+                /* If ResolveUnicastSingleLabel=yes and the query is single-label, then bump match result
+                   to prevent LLMNR monopoly among candidates. */
+                if (s->manager->resolve_unicast_single_label && dns_name_is_single_label(domain))
+                        return DNS_SCOPE_YES_BASE + 1;
+
                 /* Let's return the number of labels in the best matching result */
                 if (n_best >= 0) {
                         assert(n_best <= DNS_SCOPE_YES_END - DNS_SCOPE_YES_BASE);