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. */
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;
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;
+}
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);