resolve: use exact-match domain as routing domain for single-labels
With ResolveUnicastSingleLabel=yes, a scope's search domains are affixed to the query even when a routing domain matches the single-label query name, preventing the use of dotless single-label domains entirely. This changes dns_scope_name_wants_search_domain() to return false when the scope contains an exact match of the single-label name in the query, allowing lookups for dotless domains with ResolveUnicastSingleLabel enabled.
This commit is contained in:
committed by
Lennart Poettering
parent
4a5bf4896f
commit
4ca7c94e16
@@ -1365,7 +1365,17 @@ bool dns_scope_name_wants_search_domain(DnsScope *s, const char *name) {
|
||||
if (s->protocol != DNS_PROTOCOL_DNS)
|
||||
return false;
|
||||
|
||||
return dns_name_is_single_label(name);
|
||||
if (!dns_name_is_single_label(name))
|
||||
return false;
|
||||
|
||||
/* If we allow single-label domain lookups on unicast DNS, and this scope has a search domain that matches
|
||||
* _exactly_ this name, then do not use search domains. */
|
||||
if (s->manager->resolve_unicast_single_label)
|
||||
LIST_FOREACH(domains, d, dns_scope_get_search_domains(s))
|
||||
if (dns_name_equal(name, d->name) > 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dns_scope_network_good(DnsScope *s) {
|
||||
|
||||
Reference in New Issue
Block a user