Marek Vavruša [Tue, 24 Nov 2015 19:00:11 +0000 (20:00 +0100)]
lib/nsrep: do not penalize name failures, no empty NSLIST leaders
if the NSLIST already has a candidate with addresses, never replace
current leader with an empty one. otherwise if the former leader address
was tried and failed, new empty leader would be blamed for this and
penalized
Marek Vavruša [Wed, 18 Nov 2015 16:12:47 +0000 (17:12 +0100)]
lib/resolve: root zone is always encloser
bad control flow, the zone cut should be checked for root, as the second
condition checks if SNAME is at/below cut so the outcome is the same for
root query
Marek Vavruša [Thu, 12 Nov 2015 18:16:18 +0000 (19:16 +0100)]
daemon: fast retransmit address selection
instead of single I/O request per step, the daemon now retries
all addresses in the selection with 300ms timeout between tries.
there are len(list) + len(list)/2 tries
the idea is to reduce latency when UDP request doesn't punch through,
or some NSs are overwhelmed/faulty
Marek Vavruša [Fri, 13 Nov 2015 14:55:12 +0000 (15:55 +0100)]
lib/iterate: always copy to final answer
RRs may be touched after resolution completion, this copies RR from
temporary per-recv buffer to answer, which is persistent for the whole
duration of request
Marek Vavruša [Fri, 13 Nov 2015 12:42:55 +0000 (13:42 +0100)]
lib/daemon: address sanitizer annotated poisoning
if the library or daemon is compiled with address sanitizer, objects in
freelists are poisoned to detect use-after-recycle errors
it is not currently used in the library, as there are no freelists
Marek Vavruša [Wed, 28 Oct 2015 15:33:27 +0000 (16:33 +0100)]
lib/resolve: stub resolution with predefined address
the library is able to resolve query in stub mode (no referral chasing,
zone cut lookup) if asked to
validator turns off for stub queries, validating stub is NYI
Marek Vavruša [Tue, 27 Oct 2015 23:10:36 +0000 (00:10 +0100)]
dnssec/nsec: fixed name non-existence check
the RFC4035 M < S < N stands if the S isn’t after the last name in the zone, this is indicated by M > N, proving that the next of the last name is the first name; if the S is after M, then it proves it’s non-existence
thanks to Pieter Lexis and Peter van Dijk from PowerDNS for discovering this!
Marek Vavruša [Tue, 27 Oct 2015 23:07:37 +0000 (00:07 +0100)]
daemon/lua: qry:resolved() and qry:final()
resolved() returns true if current query is resolved (i.e. authoritative)
final() returns true if current query is resolved and is not a subrequest (has no parent)
Marek Vavruša [Tue, 27 Oct 2015 09:06:53 +0000 (10:06 +0100)]
lib: request holds authority/additional RRs for finalization
as the libknot packet interface disallows out-of-order packet
writes, authority and additional records must be written after
the answer is complete; records in the rr arrays will be written to final answer during finalization
Marek Vavruša [Fri, 23 Oct 2015 20:31:35 +0000 (22:31 +0200)]
lib/resolve: minim=off when there is NODATA between cached target/cut
when resolver finds a zone cut from cache, it checks whether there is an empty non-terminal between target QNAME and cached zone cut.
this is indicated by presence of NODATA/NXDOMAIN in packet cache.
if it finds one, it turns off qname minimisation and continues,
this saves one query for empty non-term zones like ‘co.jp’
caveat: only direct child of the cut can be considered (e.g. ‘co.jp’ for ‘jp’), otherwise we would leak information to parent if the zone cut fell out of cache and NODATA existed
Marek Vavruša [Fri, 23 Oct 2015 20:33:21 +0000 (22:33 +0200)]
lib/zonecut: shuffle root NS list to lower a.root preference
reason: a root gives consistently unpredictable performance, which
we cannot take into consideration for the first start. j,k roots
moved to the front as they're everywhere and less loaded than a
swamped with requests from legacy tools
Marek Vavruša [Thu, 22 Oct 2015 13:13:01 +0000 (15:13 +0200)]
iterator+rrcache: do not follow CNAME chains (if not DNSSEC-secured)
[1] shows an attack using spoofed CNAME targets to replace legitimate
entries in resolver cache by speeding up once-per-TTL attack opportunity
as a defense, the resolver almost always requeries CNAME targets and
doesn't store them in cache. the only exception is when the CNAME target
is within current authority, and the answer is DNSSEC-secured
thanks to Toshinori Maeno (@beyondDNS) for pointing this out [2]