Remi Gacogne [Wed, 16 Mar 2016 11:15:09 +0000 (12:15 +0100)]
dnsdist: Split DNSCrypt encryption from sendResponse. Fix flags.
Splitting DNSCrypt encryption from the sendResponse functions to
avoid the ugly #ifdef'ed definitions.
Flags were not correctly restored for self-generated responses.
Ruben Kerkhof [Sat, 12 Mar 2016 11:59:22 +0000 (12:59 +0100)]
pdns: Fix build on OSX
Using OpenSSL from Homebrew, by doing
./configure --with-openssl=/Users/ruben/homebrew/Cellar/openssl/1.0.2g
Results in:
Making all in pdns
/Library/Developer/CommandLineTools/usr/bin/make all-am
CXX base64.o
base64.cc:7:10: fatal error: 'openssl/bio.h' file not found
^
1 error generated.
Remi Gacogne [Fri, 11 Mar 2016 15:31:24 +0000 (16:31 +0100)]
dnsdist: Add an option to limit the number of queued TCP connections
By default, if all TCP threads are busy we will queue incoming TCP
connections until the communication pipes are full.
In some setup, we might run out of file descriptors quickly,
causing new TCP connections but also health checks, web requests,
console connections to fail.
This new `setMaxTCPQueuedConnections()` option limits the number of
queued connections, dropping new ones when the threshold is
reached.
Ruben Kerkhof [Fri, 11 Mar 2016 12:07:27 +0000 (13:07 +0100)]
Dnsdist: include <sys/endian.h> on FreeBSD
Fixes:
In file included from dnsdist.hh:6:0,
from dnsdist.cc:23:
iputils.hh: In member function 'NetmaskTree<T>::node_type& NetmaskTree<T>::insert(const key_type&)':
iputils.hh:532:73: error: there are no arguments to 'be32toh' that depend on a template parameter, so a declaration of 'be32toh' must be available [-fpermissive]
std::bitset<32> addr(be32toh(key.getNetwork().sin4.sin_addr.s_addr));
^
Ruben Kerkhof [Fri, 11 Mar 2016 10:57:05 +0000 (11:57 +0100)]
Dnsdist: Fix build failure on FreeBSD
YaHTTP needs Boost headers, and those are in /usr/local/include on FreeBSD.
Append BOOST_CPPFLAGS to AM_CPPFLAGS in configure.ac, so every Makefile uses them.
Also set the compiler flags globally, so that we compile yahttp with the same settings.
Fixes "/reqresp.hpp:7:10: fatal error: 'boost/function.hpp' file not found"
Remi Gacogne [Wed, 9 Mar 2016 07:49:00 +0000 (08:49 +0100)]
dnsdist: Add API regression tests
So we'll notice if we break the web server or the API.
This commit also cleans up the responses counter usage.
Because the counters are written to by the responder threads,
they are updated at the class level. We do not want to alter
them at the instance level, because that would create a new variable
at this level, disconnected from the other one, but we can still
read them from the instance level using 'self'.
Remi Gacogne [Fri, 4 Mar 2016 17:12:32 +0000 (18:12 +0100)]
dnsdist: Check response validity over TCP, more cache fixes
- Add `unsetCache()` to remove the cache from a pool
- Check the response size before caching it, and make no
assumption when getting it from the cache
- Check that the response is larger than sizeof(dnsheader) over
TCP too
- Check that the response matches the query over TCP too, because
we reuse downstream connections
Remi Gacogne [Fri, 4 Mar 2016 14:32:17 +0000 (15:32 +0100)]
dnsdist: Add statistics and config to API to make pdnscontrol happy
This is a very rough implementation to unify dnsdist with auth and
rec as far as pdnscontrol is concerned, by adding:
- /api/v1/servers/localhost/config
- /api/v1/servers/localhost/statistics
We'll need to refactor this at some point, maybe by merging with
ws-api.
Remi Gacogne [Thu, 3 Mar 2016 17:35:01 +0000 (18:35 +0100)]
dnsdist: Allow accessing the API with an optional API key
The API key can be specified as an additional, optional parameter
to `webserver()`. If present in a X-API-Key header, it allows
access to the API URLs:
- /api/v1/servers/localhost
- /jsonstat
Others URLs are still only allowed through basic authentication.
Remi Gacogne [Wed, 2 Mar 2016 15:57:02 +0000 (16:57 +0100)]
Fix end computation in DNSName::packetParser
end was computed by
end = qpos + offset + len
but the offset is already included in len, as seen in the way
label compression is handled, by calling packetParser with the
same original position and len but an updated offset.
bert hubert [Tue, 1 Mar 2016 22:47:22 +0000 (23:47 +0100)]
we prevent an authoritative server to keep its nameservers alive even though they had changed the parent, but this code had a bug which set the TTL of nameserver entries to negative numbers, leading to overly frequent requerying. Closes #3489.
Remi Gacogne [Mon, 29 Feb 2016 14:32:35 +0000 (15:32 +0100)]
dnsdist: Add/fix cache cleaning options
The function to remove expired entries was broken, and we were
missing a way to nuke a lot of valid entries at once.
We can now:
- remove entries by qname and qtype
- remove n expired entries
- remove n entries