]> git.ipfire.org Git - thirdparty/pdns.git/commit - regression-tests.dnsdist/dnsdisttests.py
Add EDNS Client Subnet to queries, unit tests and regression tests.
authorRemi Gacogne <rgacogne-github@coredump.fr>
Thu, 3 Dec 2015 08:28:22 +0000 (09:28 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 7 Dec 2015 08:23:59 +0000 (09:23 +0100)
commitca404e94c054df56d3f32abf66c643a1dec3b1b2
tree1bcac614e0c24cab235f2d2d09533ea780203fa6
parenta7940c06acc79dfdbe827230b18ace936a82335f
Add EDNS Client Subnet to queries, unit tests and regression tests.

The main idea is to be able to add EDNS Client Subnet information
to queries to that the downstream servers know who the real client
is. This is easy if the query already has EDNS, since we just have
to add an ECS option to the existing pseudo-RR OPT. Note that if the
query has an existing ECS option, we just leave it as it is unless
setECSOverride has been set to true.
If the original query has no ENDS support, we can easily add the
pseudo-RR OPT with an ECS option, but we need to remove EDNS from
the response, otherwise the client might choke on it. This is not too
hard it the pseudo-RR is the last one, but otherwise removing it
could cause issue with name compression (offsets), therefore we
completely rewrite the response in that case.

This implementation tries hard not to parse the query, and not
to allocate too much objects to parse the response. The huge downside
is that we do not reuse as much parsing code as we probably could.

Unit tests have been added, they are not enabled unless
--enable-unit-tests is set.

Regression tests have been added in regression-tests.dnsdist.

Unit and regression tests are enabled in travis.
29 files changed:
.travis.yml
pdns/README-dnsdist.md
pdns/dns.hh
pdns/dnsdist-ecs.cc [new file with mode: 0644]
pdns/dnsdist-ecs.hh [new file with mode: 0644]
pdns/dnsdist-lua.cc
pdns/dnsdist-tcp.cc
pdns/dnsdist.cc
pdns/dnsdist.hh
pdns/dnsdistdist/Makefile.am
pdns/dnsdistdist/configure.ac
pdns/dnsdistdist/dnsdist-ecs.cc [new symlink]
pdns/dnsdistdist/dnsdist-ecs.hh [new symlink]
pdns/dnsdistdist/dnsparser.cc [new symlink]
pdns/dnsdistdist/ednssubnet.cc [new symlink]
pdns/dnsdistdist/ednssubnet.hh [new symlink]
pdns/dnsdistdist/m4/pdns_enable_unit_tests.m4 [new symlink]
pdns/dnsdistdist/test-dnsdist_cc.cc [new symlink]
pdns/dnsdistdist/testrunner.cc [new file with mode: 0644]
pdns/dnsrulactions.hh
pdns/test-dnsdist_cc.cc [new file with mode: 0644]
regression-tests.dnsdist/.gitignore [new file with mode: 0644]
regression-tests.dnsdist/clientsubnetoption.py [new file with mode: 0644]
regression-tests.dnsdist/dnsdist.conf [new file with mode: 0644]
regression-tests.dnsdist/dnsdisttests.py [new file with mode: 0644]
regression-tests.dnsdist/requirements.txt [new file with mode: 0644]
regression-tests.dnsdist/runtests [new file with mode: 0755]
regression-tests.dnsdist/test_Basics.py [new file with mode: 0644]
regression-tests.dnsdist/test_EdnsClientSubnet.py [new file with mode: 0644]