erldns_resolver (erldns v13.0.0)
View SourceResolve a DNS query.
Assumes that the DNS message contains exactly one query.
Referrals
A name at or below a zone cut is answered with a referral (RFC 1034 §4.3.2): the delegation's NS
RRset in the authority section, the CNAMEs followed to get there in the answer section, and nothing
from below the cut. The delegation is put in the pipeline opts as zonecut, the labels of its name
or none for an authoritative answer, so that later pipes such as erldns_dnssec know what the
response refers to without inferring it from the message. A DS query for the delegation name itself
is answered by this zone, whose data the DS RRset is (RFC 4035 §3.1.4.1).
Additional section
The A and AAAA records of the NS and MX targets in the answer and authority sections go in the additional section (RFC 1034 §4.3.2 step 6), for targets at or below the apex of the zone that answers only: its own records and glue, or those of a zone hosted below it. A target outside the apex gets none, even from another zone in the cache, as a resolver would drop them (RFC 5452 §6).
Minimal answers to ANY
ANY at a name that owns records is answered as RFC 8482 §4.2 describes, with a single
HINFO "RFC8482" "" and Extended DNS Error 21 (Not Supported), instead of every record at the
name. A name that owns a CNAME is still answered with it, and one that owns an HINFO RRset with
that RRset (§6). erldns_dnssec signs the HINFO when the query sets DO.
By default this applies over UDP only: a TCP client cannot spoof its address, so it cannot turn an ANY query into an amplification attack.
{erldns, [
{minimal_any, #{
udp => true, %% Answer ANY minimally over UDP (default: true)
tcp => false, %% Answer ANY minimally over TCP (default: false)
hinfo_ttl => 3600 %% TTL of the HINFO (default: 3600)
}}
]}Telemetry events
[erldns, pipeline, resolver, error]
Emitted when the resolver pipe catches an error: either a thrown {error, rcode, RCODE}
or an exception (mapped to SERVFAIL).
- Measurements:
#{count => 1} - Metadata:
#{rc => dns:rcode()}
Summary
Functions
erldns_pipeline:call/2 callback.
erldns_pipeline:deps/0 callback.
erldns_pipeline:prepare/1 callback.
Types
-type zonecut() :: none | dns:labels().
The delegation a response refers to, as the labels of its name, or none.
Functions
-spec call(dns:message(), erldns_pipeline:opts()) -> erldns_pipeline:return().
erldns_pipeline:call/2 callback.
-spec deps() -> erldns_pipeline:deps().
erldns_pipeline:deps/0 callback.
-spec prepare(erldns_pipeline:opts()) -> erldns_pipeline:opts().
erldns_pipeline:prepare/1 callback.