From: Kees Monshouwer Date: Thu, 3 Jun 2021 07:11:19 +0000 (+0200) Subject: pdns: remove randombackend X-Git-Tag: dnsdist-1.7.0-alpha1~32^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F10484%2Fhead;p=thirdparty%2Fpdns.git pdns: remove randombackend --- diff --git a/.circleci/config.yml b/.circleci/config.yml index e52d2307fe..27c2a1d9fd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -596,7 +596,7 @@ jobs: CXXFLAGS="-O1 -Werror=vla -Werror=shadow -Wformat=2 -Werror=format-security -Werror=string-plus-int -Wp,-D_GLIBCXX_ASSERTIONS" \ ./configure \ --enable-option-checking=fatal \ - --with-modules='bind geoip gmysql godbc gpgsql gsqlite3 ldap lmdb lua2 pipe random remote tinydns' \ + --with-modules='bind geoip gmysql godbc gpgsql gsqlite3 ldap lmdb lua2 pipe remote tinydns' \ --enable-systemd \ --enable-tools \ --enable-unit-tests \ @@ -1491,7 +1491,7 @@ jobs: ./configure \ --enable-option-checking=fatal \ --disable-systemd \ - --with-modules='bind lmdb ldap gmysql gsqlite3 gpgsql godbc random tinydns' \ + --with-modules='bind lmdb ldap gmysql gsqlite3 gpgsql godbc tinydns' \ --enable-tools \ --with-lmdb=/usr \ --with-libsodium \ diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4223620ecd..a035dbd8de 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -99,7 +99,7 @@ jobs: if: matrix.product == 'auth' run: | autoreconf -vfi - ./configure --with-modules='bind geoip gmysql godbc gpgsql gsqlite3 ldap lmdb lua2 pipe random remote tinydns' --enable-tools --enable-ixfrdist --enable-dns-over-tls --enable-experimental-pkcs11 --with-libsodium --enable-lua-records CFLAGS='-O0' CXXFLAGS='-O0' + ./configure --with-modules='bind geoip gmysql godbc gpgsql gsqlite3 ldap lmdb lua2 pipe remote tinydns' --enable-tools --enable-ixfrdist --enable-dns-over-tls --enable-experimental-pkcs11 --with-libsodium --enable-lua-records CFLAGS='-O0' CXXFLAGS='-O0' make -j8 -C ext make -j8 -C modules make -j8 -C pdns diff --git a/Dockerfile-auth b/Dockerfile-auth index 8ba2945f49..268c779e02 100644 --- a/Dockerfile-auth +++ b/Dockerfile-auth @@ -50,7 +50,7 @@ RUN mkdir /build && \ --with-lua=${LUAVER} \ --sysconfdir=/etc/powerdns \ --enable-option-checking=fatal \ - --with-dynmodules='bind geoip gmysql godbc gpgsql gsqlite3 ldap lmdb lua2 pipe random remote tinydns' \ + --with-dynmodules='bind geoip gmysql godbc gpgsql gsqlite3 ldap lmdb lua2 pipe remote tinydns' \ --enable-tools \ --enable-ixfrdist \ --with-unixodbc-lib=/usr/lib/$(dpkg-architecture -q DEB_BUILD_GNU_TYPE) && \ diff --git a/builder-support/debian/authoritative/debian-buster/pdns-server.install b/builder-support/debian/authoritative/debian-buster/pdns-server.install index 74350bd627..480243ecc2 100644 --- a/builder-support/debian/authoritative/debian-buster/pdns-server.install +++ b/builder-support/debian/authoritative/debian-buster/pdns-server.install @@ -3,5 +3,4 @@ usr/bin/pdns_control usr/bin/pdnsutil usr/bin/zone2json usr/bin/zone2sql -usr/lib/*/pdns/librandombackend.so* usr/sbin/pdns_server diff --git a/builder-support/debian/authoritative/debian-buster/rules b/builder-support/debian/authoritative/debian-buster/rules index 50d6ffe033..5dd51f643b 100755 --- a/builder-support/debian/authoritative/debian-buster/rules +++ b/builder-support/debian/authoritative/debian-buster/rules @@ -10,7 +10,7 @@ include /usr/share/dpkg/default.mk export PDNS_TEST_NO_IPV6=1 # Backends -backends := bind ldap lmdb lua2 pipe gmysql godbc gpgsql gsqlite3 geoip remote random tinydns +backends := bind ldap lmdb lua2 pipe gmysql godbc gpgsql gsqlite3 geoip remote tinydns %: diff --git a/builder-support/specs/pdns.spec b/builder-support/specs/pdns.spec index 3dc25bcfec..e0b29c15fd 100644 --- a/builder-support/specs/pdns.spec +++ b/builder-support/specs/pdns.spec @@ -190,7 +190,7 @@ export CPPFLAGS="-DLDAP_DEPRECATED" --disable-silent-rules \ --with-modules='' \ --with-lua=%{lua_implementation} \ - --with-dynmodules='%{backends} random' \ + --with-dynmodules='%{backends}' \ --enable-tools \ --with-libsodium \ %if 0%{?amzn} != 2 @@ -265,7 +265,6 @@ systemctl daemon-reload ||: %{_bindir}/zone2json %{_bindir}/zone2sql %{_libdir}/%{name}/libbindbackend.so -%{_libdir}/%{name}/librandombackend.so %{_mandir}/man1/pdns-zone2ldap.1.gz %{_mandir}/man1/pdns_control.1.gz %{_mandir}/man1/pdns_server.1.gz diff --git a/configure.ac b/configure.ac index af50e9927f..249f2cdb39 100644 --- a/configure.ac +++ b/configure.ac @@ -169,9 +169,9 @@ AC_ARG_WITH([socketdir], [socketdir="$withval"] ) -modules="bind gmysql random" +modules="bind gmysql" AC_ARG_WITH([modules], - [AS_HELP_STRING([--with-modules], [which backends to compile with @<:@default=bind gmysql random@:>@])], + [AS_HELP_STRING([--with-modules], [which backends to compile with @<:@default=bind gmysql@:>@])], [modules="$withval"] ) @@ -350,7 +350,6 @@ AC_CONFIG_FILES([ modules/lmdbbackend/Makefile modules/lua2backend/Makefile modules/pipebackend/Makefile - modules/randombackend/Makefile modules/remotebackend/Makefile modules/tinydnsbackend/Makefile ]) diff --git a/docs/appendices/backend-writers-guide.rst b/docs/appendices/backend-writers-guide.rst index 79bd11fba7..6659a3124e 100644 --- a/docs/appendices/backend-writers-guide.rst +++ b/docs/appendices/backend-writers-guide.rst @@ -263,10 +263,6 @@ The third part registers the RandomFactory with PowerDNS. This is a simple C++ trick which makes sure that this function is called on execution of the binary or when loading the dynamic module. -Please note that a RandomBackend is actually in most PowerDNS releases. -By default it lives on random.example.com, but you can change that by -setting :ref:`setting-random-hostname`. - .. note:: This simple backend neglects to handle case properly! diff --git a/docs/backends/random.rst b/docs/backends/random.rst index 6f7af49907..1fe945a61f 100644 --- a/docs/backends/random.rst +++ b/docs/backends/random.rst @@ -1,6 +1,9 @@ Random Backend ============== +.. deprecated:: 4.6.0 + This backend has been removed in 4.6.0 + - Native: Yes - Master: No - Slave: No diff --git a/modules/Makefile.am b/modules/Makefile.am index bc4782ccad..1c51fb6438 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -11,6 +11,5 @@ DIST_SUBDIRS = \ lmdbbackend \ lua2backend \ pipebackend \ - randombackend \ remotebackend \ tinydnsbackend diff --git a/modules/randombackend/Makefile.am b/modules/randombackend/Makefile.am deleted file mode 100644 index 2da4bbde4a..0000000000 --- a/modules/randombackend/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -pkglib_LTLIBRARIES = librandombackend.la - -EXTRA_DIST = OBJECTFILES OBJECTLIBS - -librandombackend_la_SOURCES = randombackend.cc -librandombackend_la_LDFLAGS = -module -avoid-version diff --git a/modules/randombackend/OBJECTFILES b/modules/randombackend/OBJECTFILES deleted file mode 100644 index 012f607381..0000000000 --- a/modules/randombackend/OBJECTFILES +++ /dev/null @@ -1 +0,0 @@ -randombackend.lo diff --git a/modules/randombackend/OBJECTLIBS b/modules/randombackend/OBJECTLIBS deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/modules/randombackend/randombackend.cc b/modules/randombackend/randombackend.cc deleted file mode 100644 index 01839e94fd..0000000000 --- a/modules/randombackend/randombackend.cc +++ /dev/null @@ -1,139 +0,0 @@ -/* - * This file is part of PowerDNS or dnsdist. - * Copyright -- PowerDNS.COM B.V. and its contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * In addition, for the avoidance of any doubt, permission is granted to - * link this program with OpenSSL and to (re)distribute the binaries - * produced as the result of such linking. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "pdns/dnsbackend.hh" -#include "pdns/dns.hh" -#include "pdns/dnsbackend.hh" -#include "pdns/dnspacket.hh" -#include "pdns/dns_random.hh" -#include "pdns/pdnsexception.hh" -#include "pdns/logger.hh" -#include "pdns/version.hh" -#include - -/* FIRST PART */ -class RandomBackend : public DNSBackend -{ -public: - RandomBackend(const string& suffix = "") - { - setArgPrefix("random" + suffix); - d_ourname = DNSName(getArg("hostname")); - d_ourdomain = d_ourname; - d_ourdomain.chopOff(); - } - - bool list(const DNSName& target, int id, bool include_disabled) override - { - return false; // we don't support AXFR - } - - void lookup(const QType& type, const DNSName& qdomain, int zoneId, DNSPacket* p) override - { - if (qdomain == d_ourdomain) { - if (type.getCode() == QType::SOA || type.getCode() == QType::ANY) { - d_answer = "ns1." + d_ourdomain.toString() + " hostmaster." + d_ourdomain.toString() + " 1234567890 86400 7200 604800 300"; - } - else { - d_answer.clear(); - ; - } - } - else if (qdomain == d_ourname) { - if (type.getCode() == QType::A || type.getCode() == QType::ANY) { - ostringstream os; - os << dns_random(256) << "." << dns_random(256) << "." << dns_random(256) << "." << dns_random(256); - d_answer = os.str(); // our random ip address - } - else { - d_answer = ""; - } - } - else { - d_answer = ""; - } - } - - bool get(DNSResourceRecord& rr) override - { - if (d_answer.empty()) - return false; - - if (d_answer.find("ns1.") == 0) { - rr.qname = d_ourdomain; - rr.qtype = QType::SOA; - } - else { - rr.qname = d_ourname; - rr.qtype = QType::A; - } - rr.qclass = QClass::IN; // Internet class randomness. - rr.ttl = 5; // 5 seconds - rr.auth = true; // it may be random.. but it is auth! - rr.content = d_answer; - - d_answer.clear(); // this was the last answer - return true; - } - -private: - string d_answer; - DNSName d_ourname; - DNSName d_ourdomain; -}; - -/* SECOND PART */ - -class RandomFactory : public BackendFactory -{ -public: - RandomFactory() : - BackendFactory("random") {} - void declareArguments(const string& suffix = "") override - { - declare(suffix, "hostname", "Hostname which is to be random", "random.example.com"); - } - DNSBackend* make(const string& suffix = "") override - { - return new RandomBackend(suffix); - } -}; - -/* THIRD PART */ - -class RandomLoader -{ -public: - RandomLoader() - { - BackendMakers().report(new RandomFactory); - g_log << Logger::Info << "[randombackend] This is the random backend version " VERSION -#ifndef REPRODUCIBLE - << " (" __DATE__ " " __TIME__ ")" -#endif - << " reporting" << endl; - } -}; - -static RandomLoader randomLoader; diff --git a/regression-tests.nobackend/counters/command b/regression-tests.nobackend/counters/command index 7f77e457fe..a11822a2fb 100755 --- a/regression-tests.nobackend/counters/command +++ b/regression-tests.nobackend/counters/command @@ -9,31 +9,31 @@ port=5600 rm -f pdns*.pid $PDNS --daemon=no --local-address=127.0.0.1,::1 \ - --local-port=$port --socket-dir=./ --no-shuffle --launch=random --no-config \ - --module-dir=../regression-tests/modules --zone-cache-refresh-interval=0 & + --local-port=$port --socket-dir=./ --no-shuffle --launch=bind --no-config \ + --module-dir=../regression-tests/modules --bind-config=counters/named.conf & sleep 2 -$SDIG 127.0.0.1 $port random.example.com A >&2 >/dev/null -$SDIG 127.0.0.1 $port example.com SOA >&2 >/dev/null +$SDIG 127.0.0.1 $port server1.test.com A >&2 >/dev/null +$SDIG 127.0.0.1 $port test.com SOA >&2 >/dev/null -$SDIG 127.0.0.1 $port random.example.com A tcp >&2 >/dev/null -$SDIG 127.0.0.1 $port example.com SOA tcp >&2 >/dev/null +$SDIG 127.0.0.1 $port server1.test.com A tcp >&2 >/dev/null +$SDIG 127.0.0.1 $port test.com SOA tcp >&2 >/dev/null -$SDIG ::1 $port random.example.com A >&2 >/dev/null -$SDIG ::1 $port random.example.com A tcp >&2 >/dev/null +$SDIG ::1 $port server1.test.com A >&2 >/dev/null +$SDIG ::1 $port server1.com A tcp >&2 >/dev/null -$SDIG ::1 $port example.com SOA >&2 >/dev/null -$SDIG ::1 $port example.com SOA tcp >&2 >/dev/null +$SDIG ::1 $port test.com SOA >&2 >/dev/null +$SDIG ::1 $port test.com SOA tcp >&2 >/dev/null # NXDOMAIN -$SDIG 127.0.0.1 $port nx.example.com A >&2 >/dev/null +$SDIG 127.0.0.1 $port nx.test.com A >&2 >/dev/null # NOERROR -$SDIG 127.0.0.1 $port example.com SRV >&2 >/dev/null +$SDIG 127.0.0.1 $port test.com SRV >&2 >/dev/null # unauth -$SDIG 127.0.0.1 $port example.invalid MX >&2 >/dev/null +$SDIG 127.0.0.1 $port test.com.invalid MX >&2 >/dev/null $PDNSCONTROL --config-name= --no-config --socket-dir=./ 'show *' | \ tr ',' '\n'| grep -v -E '(user-msec|sys-msec|cpu-iowait|cpu-steal|uptime|udp-noport-errors|udp-in-errors|real-memory-usage|special-memory-usage|udp-recvbuf-errors|udp-sndbuf-errors|-hit|-miss|fd-usage|latency|backend-queries)' | LC_ALL=C sort diff --git a/regression-tests.nobackend/counters/expected_result b/regression-tests.nobackend/counters/expected_result index 6ae3c5e88a..452465d290 100644 --- a/regression-tests.nobackend/counters/expected_result +++ b/regression-tests.nobackend/counters/expected_result @@ -15,9 +15,9 @@ noerror-packets=1 nxdomain-packets=1 open-tcp-connections=0 overload-drops=0 -packetcache-size=7 +packetcache-size=8 qsize-q=0 -query-cache-size=10 +query-cache-size=4 rd-queries=0 recursing-answers=0 recursing-questions=0 @@ -44,26 +44,26 @@ security-status=0 servfail-packets=0 signature-cache-size=0 signatures=0 -tcp-answers-bytes=264 +tcp-answers-bytes=235 tcp-answers=4 tcp-queries=4 -tcp4-answers-bytes=132 +tcp4-answers-bytes=128 tcp4-answers=2 tcp4-queries=2 -tcp6-answers-bytes=132 +tcp6-answers-bytes=107 tcp6-answers=2 tcp6-queries=2 timedout-packets=0 -udp-answers-bytes=460 +udp-answers-bytes=449 udp-answers=7 udp-do-queries=0 udp-queries=7 -udp4-answers-bytes=328 +udp4-answers-bytes=321 udp4-answers=5 udp4-queries=5 -udp6-answers-bytes=132 +udp6-answers-bytes=128 udp6-answers=2 udp6-queries=2 -unauth-packets=1 +unauth-packets=2 xfr-queue=0 -zone-cache-size=0 +zone-cache-size=1 diff --git a/regression-tests.nobackend/counters/named.conf b/regression-tests.nobackend/counters/named.conf new file mode 100644 index 0000000000..110e91523c --- /dev/null +++ b/regression-tests.nobackend/counters/named.conf @@ -0,0 +1,14 @@ +options { + directory "../regression-tests/zones/"; + recursion no; + listen-on port 5300 { + 127.0.0.1; + }; + version "Meow!Meow!"; + minimal-responses yes; +}; + +zone "test.com"{ + type master; + file "./test.com"; +}; diff --git a/tasks.py b/tasks.py index 3db92b8b18..aafa977514 100644 --- a/tasks.py +++ b/tasks.py @@ -208,7 +208,7 @@ def ci_auth_configure(c): CC='clang-11' \ CXX='clang++-11' \ --enable-option-checking=fatal \ - --with-modules='bind geoip gmysql godbc gpgsql gsqlite3 ldap lmdb lua2 pipe random remote tinydns' \ + --with-modules='bind geoip gmysql godbc gpgsql gsqlite3 ldap lmdb lua2 pipe remote tinydns' \ --enable-systemd \ --enable-tools \ --enable-unit-tests \