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
Ruben Kerkhof [Sun, 28 Feb 2016 12:29:58 +0000 (13:29 +0100)]
m4_esyscmd_s only exists in Autoconf 2.64 or newer
Since we like to be able to keep building on RHEL6, which
has autoconf 2.61, use the older m4_esyscmd macro and strip
the newline in the version ourself.
Resolves #3471
Fixes the following error:
$ autoreconf -vif
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
libtoolize: copying file `build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
autoreconf: running: /usr/bin/autoconf --force
configure.ac:3: error: possibly undefined macro: m4_esyscmd_s
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1
Remi Gacogne [Mon, 8 Feb 2016 11:38:59 +0000 (12:38 +0100)]
dnsdist: Add an optional reuseport param to {add,set}Local()
If set to true, this parameter sets SO_REUSEPORT on platforms
supporting for this option, allowing multiple servers to
bind to the same port.
The same parameter is also added to addDNSCryptBind().
Remi Gacogne [Thu, 25 Feb 2016 17:58:46 +0000 (18:58 +0100)]
dnsdist: Fix str-only server not being added to the default pool
As reported by @pieterlexis, server defined with the "string-only"
syntax were not correctly added to the default pool. This should
fix #3456.
In addition to that, this commit adds some Lua bindings for server
objects:
- member functions `getName()` and `getNameWithAddr()`
- member data `name`
Remi Gacogne [Thu, 25 Feb 2016 16:51:24 +0000 (17:51 +0100)]
dnsdist: Fix cache tests. Clean tests backends.
Several issues:
- the cache tests used a vey small cache, not large enough for the
number of responses we expected to cache during the test suite
- this was hidden by the default response from the backends
matching what the test expected
- and by the backends not counting properly what looked like a
health check but wasn't.
Remi Gacogne [Thu, 25 Feb 2016 14:46:22 +0000 (15:46 +0100)]
dnsdist: Prevent the cache ptr from being altered under our feet
Make sure we hold the Lua mutex before getting the packet cache
shared_ptr, so that we don't have a thread reading it at the
exact same time it is altered by another.
We could have used atomic_load/atomic_store but libstdc++ uses
a pool of mutex for that anyway.
This might fix #3396.
bert hubert [Thu, 25 Feb 2016 12:03:29 +0000 (13:03 +0100)]
this commit uglifies DNSName escaped representation parsing for tremendous speedup (2x) during bulk zone loading from disk or database.
Part of the uglification is that we now special case unescaped names, which are the vast majority of cases.
Simultaneously, this moves us back to DNSName boost::container::string on non-Apple platforms, which delivered another 15% speedup on general operations
Finally, an additional unit test is added.