diff options
author | Simon Kelley <simon@thekelleys.org.uk> | 2021-07-19 00:10:49 +0100 |
---|---|---|
committer | Simon Kelley <simon@thekelleys.org.uk> | 2021-07-19 09:38:48 +0100 |
commit | c068b3ae2f5efdea018c52252eed630315260484 (patch) | |
tree | 955b9daec87e07d531c7d5c19731cf146a1fc134 | |
parent | adf9dec1e6be3ef56412b7e556b2dd47ac7fee51 (diff) | |
download | dnsmasq-c068b3ae2f5efdea018c52252eed630315260484.tar.gz |
--synth-domain now works in auth mode.
-rw-r--r-- | CHANGELOG | 3 | ||||
-rw-r--r-- | man/dnsmasq.8 | 4 | ||||
-rw-r--r-- | src/auth.c | 22 |
3 files changed, 29 insertions, 0 deletions
@@ -79,6 +79,9 @@ version 2.86 Allow smaller then 64 prefix lengths in synth-domain, with caveats. --synth-domain=1234:4567::/56,example.com is now valid. + Make domains generated by --synth-domain appear in replies + when in authoritative mode. + version 2.85 Fix problem with DNS retries in 2.83/2.84. diff --git a/man/dnsmasq.8 b/man/dnsmasq.8 index b3c335e..75b5599 100644 --- a/man/dnsmasq.8 +++ b/man/dnsmasq.8 @@ -2419,6 +2419,10 @@ following data is used to populate the authoritative zone. .B --mx-host, --srv-host, --dns-rr, --txt-record, --naptr-record, --caa-record, as long as the record names are in the authoritative domain. .PP +.B --synth-domain +as long as the domain is in the authoritative zone and, for +reverse (PTR) queries, the address is in the relevant subnet. +.PP .B --cname as long as the record name is in the authoritative domain. If the target of the CNAME is unqualified, then it is qualified with the @@ -253,6 +253,17 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n } while ((crecp = cache_find_by_addr(crecp, &addr, now, flag))); + if (!found && is_rev_synth(flag, &addr, name) && (local_query || in_zone(zone, name, NULL))) + { + log_query(F_CONFIG | F_REVERSE | flag, name, &addr, NULL); + found = 1; + + if (add_resource_record(header, limit, &trunc, nameoffset, &ansp, + daemon->auth_ttl, NULL, + T_PTR, C_IN, "d", name)) + anscount++; + } + if (found) nxdomain = 0; else @@ -400,6 +411,17 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n anscount++; } } + + if (!found && is_name_synthetic(flag, name, &addr) ) + { + found = 1; + nxdomain = 0; + + log_query(F_FORWARD | F_CONFIG | flag, name, &addr, NULL); + if (add_resource_record(header, limit, &trunc, nameoffset, &ansp, + daemon->auth_ttl, NULL, qtype, C_IN, qtype == T_A ? "4" : "6", &addr)) + anscount++; + } if (!cut) { |