mirror of
https://github.com/systemd/systemd.git
synced 2026-08-05 07:30:30 +00:00
Merge pull request #22400 from poettering/resolved-single-invalid-list
resolved: maintain only a single list of "dont-resolve" domain names
This commit is contained in:
@@ -624,14 +624,8 @@ DnsScopeMatch dns_scope_good_domain(
|
||||
dns_name_equal(domain, "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa") > 0)
|
||||
return DNS_SCOPE_NO;
|
||||
|
||||
/* Never respond to some of the domains listed in RFC6303 */
|
||||
if (dns_name_endswith(domain, "0.in-addr.arpa") > 0 ||
|
||||
dns_name_equal(domain, "255.255.255.255.in-addr.arpa") > 0 ||
|
||||
dns_name_equal(domain, "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa") > 0)
|
||||
return DNS_SCOPE_NO;
|
||||
|
||||
/* Never respond to some of the domains listed in RFC6761 */
|
||||
if (dns_name_endswith(domain, "invalid") > 0)
|
||||
/* Never respond to some of the domains listed in RFC6303 + RFC6761 */
|
||||
if (dns_name_dont_resolve(domain))
|
||||
return DNS_SCOPE_NO;
|
||||
|
||||
/* Never go to network for the _gateway or _outbound domain — they're something special, synthesized locally. */
|
||||
|
||||
@@ -397,11 +397,8 @@ int dns_synthesize_answer(
|
||||
if (dns_name_is_empty(name)) {
|
||||
/* Do nothing. */
|
||||
|
||||
} else if (dns_name_endswith(name, "0.in-addr.arpa") > 0 ||
|
||||
dns_name_equal(name, "255.255.255.255.in-addr.arpa") > 0 ||
|
||||
dns_name_equal(name, "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa") > 0 ||
|
||||
dns_name_endswith(name, "invalid") > 0) {
|
||||
|
||||
} else if (dns_name_dont_resolve(name)) {
|
||||
/* Synthesize NXDOMAIN for some of the domains in RFC6303 + RFC6761 */
|
||||
nxdomain = true;
|
||||
continue;
|
||||
|
||||
|
||||
@@ -1415,3 +1415,18 @@ int dns_name_dot_suffixed(const char *name) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool dns_name_dont_resolve(const char *name) {
|
||||
|
||||
/* Never respond to some of the domains listed in RFC6303 */
|
||||
if (dns_name_endswith(name, "0.in-addr.arpa") > 0 ||
|
||||
dns_name_equal(name, "255.255.255.255.in-addr.arpa") > 0 ||
|
||||
dns_name_equal(name, "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa") > 0)
|
||||
return true;
|
||||
|
||||
/* Never respond to some of the domains listed in RFC6761 */
|
||||
if (dns_name_endswith(name, "invalid") > 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -103,3 +103,5 @@ int dns_name_apply_idna(const char *name, char **ret);
|
||||
int dns_name_is_valid_or_address(const char *name);
|
||||
|
||||
int dns_name_dot_suffixed(const char *name);
|
||||
|
||||
bool dns_name_dont_resolve(const char *name);
|
||||
|
||||
Reference in New Issue
Block a user