1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-10 01:17:44 +03:00

resolved: fix single-label resolution over DNS

Fixes: #23494 (when ResolveUnicastSingleLabel=yes)
(cherry picked from commit ff0a5070d4)
This commit is contained in:
Jacek Migacz 2022-07-27 18:38:12 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent 695eb67322
commit 7384d152c8

View 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);