summaryrefslogtreecommitdiffstats
path: root/src/resolve/resolved-dns-scope.c
diff options
context:
space:
mode:
authorJacek Migacz <jmigacz@redhat.com>2022-07-27 18:38:12 +0200
committerLennart Poettering <lennart@poettering.net>2022-08-02 19:21:46 +0200
commitff0a5070d45f20df7744b1090892be797bf18365 (patch)
tree530be27f1f47bbe3654c32a626ad12e1251f60c8 /src/resolve/resolved-dns-scope.c
parentMerge pull request #24146 from poettering/efi-stub-measure-payload (diff)
downloadsystemd-ff0a5070d45f20df7744b1090892be797bf18365.tar.xz
systemd-ff0a5070d45f20df7744b1090892be797bf18365.zip
resolved: fix single-label resolution over DNS
Fixes: #23494 (when ResolveUnicastSingleLabel=yes)
Diffstat (limited to 'src/resolve/resolved-dns-scope.c')
-rw-r--r--src/resolve/resolved-dns-scope.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c
index 473e397013..8fd987bd82 100644
--- a/src/resolve/resolved-dns-scope.c
+++ b/src/resolve/resolved-dns-scope.c
@@ -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);