From ff0a5070d45f20df7744b1090892be797bf18365 Mon Sep 17 00:00:00 2001 From: Jacek Migacz Date: Wed, 27 Jul 2022 18:38:12 +0200 Subject: resolved: fix single-label resolution over DNS Fixes: #23494 (when ResolveUnicastSingleLabel=yes) --- src/resolve/resolved-dns-scope.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/resolve/resolved-dns-scope.c') 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); -- cgit v1.2.3