diff -Nru pdns-recursor-4.1.10/configure pdns-recursor-4.1.11/configure --- pdns-recursor-4.1.10/configure 2019-01-24 10:14:57.000000000 +0000 +++ pdns-recursor-4.1.11/configure 2019-01-31 19:43:55.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for pdns-recursor 4.1.10. +# Generated by GNU Autoconf 2.69 for pdns-recursor 4.1.11. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ # Identity of this package. PACKAGE_NAME='pdns-recursor' PACKAGE_TARNAME='pdns-recursor' -PACKAGE_VERSION='4.1.10' -PACKAGE_STRING='pdns-recursor 4.1.10' +PACKAGE_VERSION='4.1.11' +PACKAGE_STRING='pdns-recursor 4.1.11' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1445,7 +1445,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures pdns-recursor 4.1.10 to adapt to many kinds of systems. +\`configure' configures pdns-recursor 4.1.11 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1515,7 +1515,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of pdns-recursor 4.1.10:";; + short | recursive ) echo "Configuration of pdns-recursor 4.1.11:";; esac cat <<\_ACEOF @@ -1677,7 +1677,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -pdns-recursor configure 4.1.10 +pdns-recursor configure 4.1.11 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2270,7 +2270,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by pdns-recursor $as_me 4.1.10, which was +It was created by pdns-recursor $as_me 4.1.11, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3133,7 +3133,7 @@ # Define the identity of the package. PACKAGE='pdns-recursor' - VERSION='4.1.10' + VERSION='4.1.11' cat >>confdefs.h <<_ACEOF @@ -21846,7 +21846,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by pdns-recursor $as_me 4.1.10, which was +This file was extended by pdns-recursor $as_me 4.1.11, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -21912,7 +21912,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -pdns-recursor config.status 4.1.10 +pdns-recursor config.status 4.1.11 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -Nru pdns-recursor-4.1.10/debian/changelog pdns-recursor-4.1.11/debian/changelog --- pdns-recursor-4.1.10/debian/changelog 2019-01-24 16:19:32.000000000 +0000 +++ pdns-recursor-4.1.11/debian/changelog 2019-02-03 15:02:43.000000000 +0000 @@ -1,3 +1,10 @@ +pdns-recursor (4.1.11-1) unstable; urgency=medium + + * New upstream version 4.1.11 + * Upstream has applied the patch introduced in 4.1.10-2, remove it. + + -- Chris Hofstaedtler Sun, 03 Feb 2019 15:02:43 +0000 + pdns-recursor (4.1.10-2) unstable; urgency=high * Apply patch from upstream to avoid timing issue in tests diff -Nru pdns-recursor-4.1.10/debian/gbp.conf pdns-recursor-4.1.11/debian/gbp.conf --- pdns-recursor-4.1.10/debian/gbp.conf 2019-01-24 16:19:32.000000000 +0000 +++ pdns-recursor-4.1.11/debian/gbp.conf 2019-02-03 15:02:43.000000000 +0000 @@ -1,4 +1,3 @@ [DEFAULT] +debian-branch = buster pristine-tar = True -multimaint-merge = True -patch-numbers = False diff -Nru pdns-recursor-4.1.10/debian/patches/7327.patch pdns-recursor-4.1.11/debian/patches/7327.patch --- pdns-recursor-4.1.10/debian/patches/7327.patch 2019-01-24 16:19:32.000000000 +0000 +++ pdns-recursor-4.1.11/debian/patches/7327.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ -From 73c165edd479b2f9838a9390b5fc6598034a6832 Mon Sep 17 00:00:00 2001 -From: Remi Gacogne -Date: Fri, 4 Jan 2019 09:40:18 +0100 -Subject: [PATCH] rec: Fix a possible timing issue w/ RRSIGs in the SyncRes - unit tests - ---- - pdns/recursordist/test-syncres_cc.cc | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/test-syncres_cc.cc b/test-syncres_cc.cc -index 3a3284d..492b677 100644 ---- a/test-syncres_cc.cc -+++ b/test-syncres_cc.cc -@@ -8991,8 +8991,9 @@ BOOST_AUTO_TEST_CASE(test_dnssec_rrsig_cache_validity) { - g_luaconfs.setState(luaconfsCopy); - - size_t queriesCount = 0; -+ const time_t tnow = sr->getNow().tv_sec; - -- sr->setAsyncCallback([target,targetAddr,&queriesCount,keys](const ComboAddress& ip, const DNSName& domain, int type, bool doTCP, bool sendRDQuery, int EDNS0Level, struct timeval* now, boost::optional& srcmask, boost::optional context, std::shared_ptr outgoingLogger, LWResult* res, bool* chained) { -+ sr->setAsyncCallback([target,targetAddr,&queriesCount,keys,tnow](const ComboAddress& ip, const DNSName& domain, int type, bool doTCP, bool sendRDQuery, int EDNS0Level, struct timeval* now, boost::optional& srcmask, boost::optional context, std::shared_ptr outgoingLogger, LWResult* res, bool* chained) { - queriesCount++; - - DNSName auth = domain; -@@ -9004,14 +9005,13 @@ BOOST_AUTO_TEST_CASE(test_dnssec_rrsig_cache_validity) { - else { - setLWResult(res, RCode::NoError, true, false, true); - addRecordToLW(res, domain, QType::A, targetAddr.toString(), DNSResourceRecord::ANSWER, 3600); -- addRRSIG(keys, res->d_records, domain, 1); -+ addRRSIG(keys, res->d_records, domain, 1, false, boost::none, boost::none, tnow); - return 1; - } - - return 0; - }); - -- const time_t now = sr->getNow().tv_sec; - vector ret; - int res = sr->beginResolve(target, QType(QType::A), QClass::IN, ret); - BOOST_CHECK_EQUAL(res, RCode::NoError); -@@ -9023,10 +9023,10 @@ BOOST_AUTO_TEST_CASE(test_dnssec_rrsig_cache_validity) { - const ComboAddress who; - vector cached; - vector> signatures; -- BOOST_REQUIRE_EQUAL(t_RC->get(now, target, QType(QType::A), true, &cached, who, &signatures), 1); -+ BOOST_REQUIRE_EQUAL(t_RC->get(tnow, target, QType(QType::A), true, &cached, who, &signatures), 1); - BOOST_REQUIRE_EQUAL(cached.size(), 1); - BOOST_REQUIRE_EQUAL(signatures.size(), 1); -- BOOST_CHECK_EQUAL((cached[0].d_ttl - now), 1); -+ BOOST_CHECK_EQUAL((cached[0].d_ttl - tnow), 1); - - /* again, to test the cache */ - ret.clear(); diff -Nru pdns-recursor-4.1.10/debian/patches/series pdns-recursor-4.1.11/debian/patches/series --- pdns-recursor-4.1.10/debian/patches/series 2019-01-24 16:19:32.000000000 +0000 +++ pdns-recursor-4.1.11/debian/patches/series 2019-02-03 15:02:43.000000000 +0000 @@ -1,3 +1,2 @@ testrunner-log-verbosity stack-size -7327.patch diff -Nru pdns-recursor-4.1.10/debian/watch pdns-recursor-4.1.11/debian/watch --- pdns-recursor-4.1.10/debian/watch 2019-01-24 16:19:32.000000000 +0000 +++ pdns-recursor-4.1.11/debian/watch 2019-02-03 15:02:43.000000000 +0000 @@ -1,3 +1,3 @@ # Site Directory Pattern Version Script version=3 -opts="pgpsigurlmangle=s/$/.asc/,versionmangle=s/-(alpha|beta|rc)/~$1/" https://downloads.powerdns.com/releases/ pdns-recursor-(.*)\.tar\.bz2 debian uupdate +opts="pgpsigurlmangle=s/$/.asc/,versionmangle=s/-(alpha|beta|rc)/~$1/" https://downloads.powerdns.com/releases/ pdns-recursor-(4\.1\..*)\.tar\.bz2 debian uupdate diff -Nru pdns-recursor-4.1.10/effective_tld_names.dat pdns-recursor-4.1.11/effective_tld_names.dat --- pdns-recursor-4.1.10/effective_tld_names.dat 2019-01-24 10:15:50.000000000 +0000 +++ pdns-recursor-4.1.11/effective_tld_names.dat 2019-01-31 19:44:45.000000000 +0000 @@ -1414,9 +1414,9 @@ tos.it toscana.it trentin-sud-tirol.it -trentin-süd-tirol.it +trentin-süd-tirol.it trentin-sudtirol.it -trentin-südtirol.it +trentin-südtirol.it trentin-sued-tirol.it trentin-suedtirol.it trentino-a-adige.it @@ -1426,9 +1426,9 @@ trentino-s-tirol.it trentino-stirol.it trentino-sud-tirol.it -trentino-süd-tirol.it +trentino-süd-tirol.it trentino-sudtirol.it -trentino-südtirol.it +trentino-südtirol.it trentino-sued-tirol.it trentino-suedtirol.it trentino.it @@ -1439,15 +1439,15 @@ trentinos-tirol.it trentinostirol.it trentinosud-tirol.it -trentinosüd-tirol.it +trentinosüd-tirol.it trentinosudtirol.it -trentinosüdtirol.it +trentinosüdtirol.it trentinosued-tirol.it trentinosuedtirol.it trentinsud-tirol.it -trentinsüd-tirol.it +trentinsüd-tirol.it trentinsudtirol.it -trentinsüdtirol.it +trentinsüdtirol.it trentinsued-tirol.it trentinsuedtirol.it tuscany.it @@ -1464,13 +1464,13 @@ valled-aosta.it valledaosta.it vallee-aoste.it -vallée-aoste.it +vallée-aoste.it vallee-d-aoste.it -vallée-d-aoste.it +vallée-d-aoste.it valleeaoste.it -valléeaoste.it +valléeaoste.it valleedaoste.it -valléedaoste.it +valléedaoste.it vao.it vda.it ven.it @@ -1504,7 +1504,7 @@ avellino.it ba.it balsan-sudtirol.it -balsan-südtirol.it +balsan-südtirol.it balsan-suedtirol.it balsan.it bari.it @@ -1523,7 +1523,7 @@ bolzano-altoadige.it bolzano.it bozen-sudtirol.it -bozen-südtirol.it +bozen-südtirol.it bozen-suedtirol.it bozen.it br.it @@ -1532,7 +1532,7 @@ bs.it bt.it bulsan-sudtirol.it -bulsan-südtirol.it +bulsan-südtirol.it bulsan-suedtirol.it bulsan.it bz.it @@ -1552,9 +1552,9 @@ cb.it ce.it cesena-forli.it -cesena-forlì.it +cesena-forlì.it cesenaforli.it -cesenaforlì.it +cesenaforlì.it ch.it chieti.it ci.it @@ -1585,9 +1585,9 @@ fm.it foggia.it forli-cesena.it -forlì-cesena.it +forlì-cesena.it forlicesena.it -forlìcesena.it +forlìcesena.it fr.it frosinone.it ge.it @@ -1718,7 +1718,7 @@ sr.it ss.it suedtirol.it -südtirol.it +südtirol.it sv.it ta.it taranto.it @@ -3790,10 +3790,18 @@ org.lr net.lr -// ls : https://en.wikipedia.org/wiki/.ls +// ls : http://www.nic.ls/ +// Confirmed by registry ls +ac.ls +biz.ls co.ls +edu.ls +gov.ls +info.ls +net.ls org.ls +sc.ls // lt : https://en.wikipedia.org/wiki/.lt lt @@ -4651,9 +4659,6 @@ // ccTLD for the Netherlands nl -// BV.nl will be a registry for dutch BV's (besloten vennootschap) -bv.nl - // no : http://www.norid.no/regelverk/index.en.html // The Norwegian registry has declined to notify us of updates. The web pages // referenced below are the official source of the data. There is also an @@ -9874,9 +9879,6 @@ // statefarm : 2015-07-30 State Farm Mutual Automobile Insurance Company statefarm -// statoil : 2014-12-04 Statoil ASA -statoil - // stc : 2014-10-09 Saudi Telecom Company stc @@ -10835,6 +10837,11 @@ // Submitted by Vincent Tseng myasustor.com +// Automattic Inc. : https://automattic.com/ +// Submitted by Alex Concha +go-vip.co +wpcomstaging.com + // AVM : https://avm.de // Submitted by Andreas Weise myfritz.net @@ -10881,6 +10888,11 @@ // Submitted by Dave Tharp browsersafetymark.io +// Bytemark Hosting : https://www.bytemark.co.uk +// Submitted by Paul Cammish +dh.bytemark.co.uk +vm.bytemark.co.uk + // callidomus : https://www.callidomus.com/ // Submitted by Marcus Popp mycd.eu @@ -11073,6 +11085,11 @@ reg.dk store.dk +// dapps.earth : https://dapps.earth/ +// Submitted by Daniil Burdakov +*.dapps.earth +*.bzz.dapps.earth + // Debian : https://www.debian.org/ // Submitted by Peter Palfrader / Debian Sysadmin Team debian.net @@ -11085,6 +11102,11 @@ // Submitted by Norbert Auler dnshome.de +// DotArai : https://www.dotarai.com/ +// Submitted by Atsadawat Netcharadsang +online.th +shop.th + // DrayTek Corp. : https://www.draytek.com/ // Submitted by Paul Fang drayddns.com @@ -11641,6 +11663,10 @@ app.os.fedoraproject.org app.os.stg.fedoraproject.org +// Fermax : https://fermax.com/ +// submitted by Koen Van Isterdael +mydobiss.com + // Filegear Inc. : https://www.filegear.com // Submitted by Jason Zhu filegear.me @@ -11706,6 +11732,8 @@ // Google, Inc. // Submitted by Eduardo Vela +run.app +a.run.app *.0emm.com appspot.com blogspot.ae @@ -11911,6 +11939,12 @@ lcube-server.de svn-repos.de +// Leadpages : https://www.leadpages.net +// Submitted by Greg Dallavalle +leadpages.co +lpages.co +lpusercontent.com + // Lightmaker Property Manager, Inc. : https://app.lmpm.com/ // Submitted by Greg Holland app.lmpm.com @@ -11928,6 +11962,15 @@ // Submitted by Victor Velchev we.bs +// LubMAN UMCS Sp. z o.o : https://lubman.pl/ +// Submitted by Ireneusz Maliszewski +krasnik.pl +leczna.pl +lubartow.pl +lublin.pl +poniatowa.pl +swidnik.pl + // Lug.org.uk : https://lug.org.uk // Submitted by Jon Spriggs uklugs.org @@ -12315,6 +12358,10 @@ chirurgiens-dentistes-en-france.fr byen.site +// Redstar Consultants : https://www.redstarconsultants.com/ +// Submitted by Jons Slemmer +instantcloud.cn + // Russian Academy of Sciences // Submitted by Tech Support ras.ru @@ -12343,6 +12390,10 @@ rackmaze.com rackmaze.net +// Read The Docs, Inc : https://www.readthedocs.org +// Submitted by David Fischer +readthedocs.io + // Red Hat, Inc. OpenShift : https://openshift.redhat.com/ // Submitted by Tim Kramer rhcloud.com @@ -12419,6 +12470,10 @@ sinaapp.com vipsinaapp.com +// Siteleaf : https://www.siteleaf.com/ +// Submitted by Skylar Challand +siteleaf.net + // Skyhat : http://www.skyhat.io // Submitted by Shante Adam bounty-full.com @@ -12484,6 +12539,12 @@ med.pl sopot.pl +// Telebit : https://telebit.cloud +// Submitted by AJ ONeal +telebit.app +telebit.io +*.telebit.xyz + // The Gwiddle Foundation : https://gwiddlefoundation.org.uk // Submitted by Joshua Bayfield gwiddle.co.uk diff -Nru pdns-recursor-4.1.10/namespaces.hh pdns-recursor-4.1.11/namespaces.hh --- pdns-recursor-4.1.10/namespaces.hh 2019-01-24 10:14:45.000000000 +0000 +++ pdns-recursor-4.1.11/namespaces.hh 2019-01-31 19:43:44.000000000 +0000 @@ -22,7 +22,6 @@ #ifndef PDNS_NAMESPACES_HH #define PDNS_NAMESPACES_HH #include - #include #include #include @@ -78,4 +77,5 @@ using boost::equals; using boost::ends_with; using boost::iends_with; + #endif diff -Nru pdns-recursor-4.1.10/pdns_recursor.1 pdns-recursor-4.1.11/pdns_recursor.1 --- pdns-recursor-4.1.10/pdns_recursor.1 2019-01-24 10:15:50.000000000 +0000 +++ pdns-recursor-4.1.11/pdns_recursor.1 2019-01-31 19:44:44.000000000 +0000 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "PDNS_RECURSOR" "1" "Jan 24, 2019" "4.1" "PowerDNS Recursor" +.TH "PDNS_RECURSOR" "1" "Jan 31, 2019" "4.1" "PowerDNS Recursor" .SH NAME pdns_recursor \- The PowerDNS Recursor binary . diff -Nru pdns-recursor-4.1.10/pdns_recursor.cc pdns-recursor-4.1.11/pdns_recursor.cc --- pdns-recursor-4.1.10/pdns_recursor.cc 2019-01-24 10:14:45.000000000 +0000 +++ pdns-recursor-4.1.11/pdns_recursor.cc 2019-01-31 19:43:44.000000000 +0000 @@ -1548,7 +1548,7 @@ if(luaconfsLocal->protobufServer) { try { - if (!luaconfsLocal->protobufTaggedOnly) { + if (!luaconfsLocal->protobufResponsesOnly && !luaconfsLocal->protobufTaggedOnly) { protobufLogQuery(luaconfsLocal->protobufServer, luaconfsLocal->protobufMaskV4, luaconfsLocal->protobufMaskV6, dc->d_uuid, conn->d_remote, dest, dc->d_ednssubnet.source, true, dh->id, conn->qlen, qname, qtype, qclass, dc->d_policyTags, dc->d_requestorId, dc->d_deviceId); } } @@ -1739,7 +1739,7 @@ #ifdef HAVE_PROTOBUF pbMessage.setServerIdentity(SyncRes::s_serverID); if(luaconfsLocal->protobufServer) { - if (!luaconfsLocal->protobufTaggedOnly || !policyTags.empty()) { + if (!luaconfsLocal->protobufResponsesOnly && (!luaconfsLocal->protobufTaggedOnly || !policyTags.empty())) { protobufLogQuery(luaconfsLocal->protobufServer, luaconfsLocal->protobufMaskV4, luaconfsLocal->protobufMaskV6, uniqueId, fromaddr, destaddr, ednssubnet.source, false, dh->id, question.size(), qname, qtype, qclass, policyTags, requestorId, deviceId); } } diff -Nru pdns-recursor-4.1.10/pubsuffix.cc pdns-recursor-4.1.11/pubsuffix.cc --- pdns-recursor-4.1.10/pubsuffix.cc 2019-01-24 10:15:50.000000000 +0000 +++ pdns-recursor-4.1.11/pubsuffix.cc 2019-01-31 19:44:45.000000000 +0000 @@ -3150,8 +3150,15 @@ "gov.lr", "org.lr", "net.lr", +"ac.ls", +"biz.ls", "co.ls", +"edu.ls", +"gov.ls", +"info.ls", +"net.ls", "org.ls", +"sc.ls", "gov.lt", "com.lv", "edu.lv", @@ -3876,7 +3883,6 @@ "nom.ni", "org.ni", "web.ni", -"bv.nl", "fhs.no", "vgs.no", "fylkesbibl.no", @@ -5574,6 +5580,8 @@ "potager.org", "sweetpepper.org", "myasustor.com", +"go-vip.co", +"wpcomstaging.com", "myfritz.net", "backplaneapp.io", "betainabox.com", @@ -5588,6 +5596,8 @@ "bplaced.net", "square7.net", "browsersafetymark.io", +"dh.bytemark.co.uk", +"vm.bytemark.co.uk", "mycd.eu", "ae.org", "ar.com", @@ -5688,6 +5698,8 @@ "debian.net", "dedyn.io", "dnshome.de", +"online.th", +"shop.th", "drayddns.com", "dreamhosters.com", "mydrobo.com", @@ -6169,6 +6181,7 @@ "cloud.fedoraproject.org", "app.os.fedoraproject.org", "app.os.stg.fedoraproject.org", +"mydobiss.com", "filegear.me", "firebaseapp.com", "flynnhub.com", @@ -6190,6 +6203,8 @@ "ro.im", "shop.ro", "goip.de", +"run.app", +"a.run.app", "appspot.com", "blogspot.ae", "blogspot.al", @@ -6330,11 +6345,20 @@ "git-repos.de", "lcube-server.de", "svn-repos.de", +"leadpages.co", +"lpages.co", +"lpusercontent.com", "app.lmpm.com", "linkitools.space", "linkyard.cloud", "linkyard-cloud.ch", "we.bs", +"krasnik.pl", +"leczna.pl", +"lubartow.pl", +"lublin.pl", +"poniatowa.pl", +"swidnik.pl", "uklugs.org", "glug.org.uk", "lug.org.uk", @@ -6580,6 +6604,7 @@ "protonet.io", "chirurgiens-dentistes-en-france.fr", "byen.site", +"instantcloud.cn", "ras.ru", "qa2.com", "dev-myqnapcloud.com", @@ -6589,6 +6614,7 @@ "vaporcloud.io", "rackmaze.com", "rackmaze.net", +"readthedocs.io", "rhcloud.com", "resindevice.io", "devices.resinstaging.io", @@ -6621,6 +6647,7 @@ "applinzi.com", "sinaapp.com", "vipsinaapp.com", +"siteleaf.net", "bounty-full.com", "alpha.bounty-full.com", "beta.bounty-full.com", @@ -6653,6 +6680,8 @@ "gdynia.pl", "med.pl", "sopot.pl", +"telebit.app", +"telebit.io", "gwiddle.co.uk", "cust.dev.thingdust.io", "cust.disrec.thingdust.io", diff -Nru pdns-recursor-4.1.10/rec_control.1 pdns-recursor-4.1.11/rec_control.1 --- pdns-recursor-4.1.10/rec_control.1 2019-01-24 10:15:50.000000000 +0000 +++ pdns-recursor-4.1.11/rec_control.1 2019-01-31 19:44:44.000000000 +0000 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "REC_CONTROL" "1" "Jan 24, 2019" "4.1" "PowerDNS Recursor" +.TH "REC_CONTROL" "1" "Jan 31, 2019" "4.1" "PowerDNS Recursor" .SH NAME rec_control \- Command line tool to control a running Recursor . diff -Nru pdns-recursor-4.1.10/rec-lua-conf.cc pdns-recursor-4.1.11/rec-lua-conf.cc --- pdns-recursor-4.1.10/rec-lua-conf.cc 2019-01-24 10:14:45.000000000 +0000 +++ pdns-recursor-4.1.11/rec-lua-conf.cc 2019-01-31 19:43:44.000000000 +0000 @@ -278,11 +278,11 @@ }); #if HAVE_PROTOBUF - Lua.writeFunction("protobufServer", [&lci](const string& server_, const boost::optional timeout, const boost::optional maxQueuedEntries, const boost::optional reconnectWaitTime, const boost::optional maskV4, boost::optional maskV6, boost::optional asyncConnect, boost::optional taggedOnly) { + Lua.writeFunction("protobufServer", [&lci](const string& server_, const boost::optional timeout, const boost::optional maxQueuedEntries, const boost::optional reconnectWaitTime, const boost::optional maskV4, boost::optional maskV6, boost::optional asyncConnect, boost::optional taggedOnly, boost::optional responsesOnly) { try { ComboAddress server(server_); if (!lci.protobufServer) { - lci.protobufServer = std::make_shared(server, timeout ? *timeout : 2, maxQueuedEntries ? *maxQueuedEntries : 100, reconnectWaitTime ? *reconnectWaitTime : 1, asyncConnect ? *asyncConnect : false); + lci.protobufServer = std::make_shared(server, timeout ? *timeout : 2, 100*(maxQueuedEntries ? *maxQueuedEntries : 100), reconnectWaitTime ? *reconnectWaitTime : 1, asyncConnect ? *asyncConnect : false); if (maskV4) { lci.protobufMaskV4 = *maskV4; @@ -293,6 +293,9 @@ if (taggedOnly) { lci.protobufTaggedOnly = *taggedOnly; } + if (responsesOnly) { + lci.protobufResponsesOnly = *responsesOnly; + } } else { theL()<toString()<(server, timeout ? *timeout : 2, maxQueuedEntries ? *maxQueuedEntries : 100, reconnectWaitTime ? *reconnectWaitTime : 1, asyncConnect ? *asyncConnect : false); + lci.outgoingProtobufServer = std::make_shared(server, timeout ? *timeout : 2, 100*(maxQueuedEntries ? *maxQueuedEntries : 100), reconnectWaitTime ? *reconnectWaitTime : 1, asyncConnect ? *asyncConnect : false); } else { theL()<toString()< g_luaconfs; diff -Nru pdns-recursor-4.1.10/remote_logger.cc pdns-recursor-4.1.11/remote_logger.cc --- pdns-recursor-4.1.10/remote_logger.cc 2019-01-24 10:14:45.000000000 +0000 +++ pdns-recursor-4.1.11/remote_logger.cc 2019-01-31 19:43:44.000000000 +0000 @@ -1,6 +1,11 @@ #include #include "remote_logger.hh" + +#include +#ifdef HAVE_CONFIG_H #include "config.h" +#endif + #ifdef PDNS_CONFIG_ARGS #include "logger.hh" #define WE_ARE_RECURSOR @@ -8,6 +13,65 @@ #include "dolog.hh" #endif +void CircularWriteBuffer::write(const std::string& str) +{ + if(d_buffer.size() + 2 + str.size() > d_buffer.capacity()) + flush(); + + if(d_buffer.size() + 2 + str.size() > d_buffer.capacity()) + throw std::runtime_error("Full!"); + + uint16_t len = htons(str.size()); + char* ptr = (char*)&len; + d_buffer.insert(d_buffer.end(), ptr, ptr + 2); + d_buffer.insert(d_buffer.end(), str.begin(), str.end()); +} + +void CircularWriteBuffer::flush() +{ + if(d_buffer.empty()) // not optional, we report EOF otherwise + return; + + auto arr1 = d_buffer.array_one(); + auto arr2 = d_buffer.array_two(); + + struct iovec iov[2]; + int pos=0; + size_t total=0; + for(const auto& arr : {arr1, arr2}) { + if(arr.second) { + iov[pos].iov_base = arr.first; + iov[pos].iov_len = arr.second; + total += arr.second; + ++pos; + } + } + + int res = writev(d_fd, iov, pos); + if(res < 0) { + throw std::runtime_error("Couldn't flush a thing: "+string(strerror(errno))); + } + if(!res) { + throw std::runtime_error("EOF"); + } + // cout<<"Flushed "<(d_socket, d_maxQueuedBytes); + } + d_thread = std::thread(&RemoteLogger::maintenanceThread, this); +} + bool RemoteLogger::reconnect() { if (d_socket >= 0) { @@ -30,58 +94,59 @@ return true; } -void RemoteLogger::worker() +void RemoteLogger::queueData(const std::string& data) { - if (d_asyncConnect) { - reconnect(); + if(!d_writer) { + d_drops++; + return; } - - while(true) { - std::string data; - { - std::unique_lock lock(d_writeMutex); - d_queueCond.wait(lock, [this]{return (!d_writeQueue.empty()) || d_exiting;}); - if (d_exiting) { - return; - } - data = d_writeQueue.front(); - d_writeQueue.pop(); - } - + std::unique_lock lock(d_mutex); + if(d_writer) { try { - uint16_t len = static_cast(data.length()); - sendSizeAndMsgWithTimeout(d_socket, len, data.c_str(), static_cast(d_timeout), nullptr, nullptr, 0, 0, 0); + d_writer->write(data); } - catch(const std::runtime_error& e) { -#ifdef WE_ARE_RECURSOR - L< lock(d_writeMutex); - if (d_writeQueue.size() >= d_maxQueuedEntries) { - d_writeQueue.pop(); + for(;;) { + if(d_exiting) + break; + + if(d_writer) { + std::unique_lock lock(d_mutex); + if(d_writer) { // check if it is still set + // cout<<"Flush"<flush(); + } + catch(std::exception& e) { + // cout<<"Flush failed!"< lock(d_mutex); + d_writer = make_unique(d_socket, d_maxQueuedBytes); } - d_writeQueue.push(data); + sleep(d_reconnectWaitTime); } - d_queueCond.notify_one(); } - -RemoteLogger::RemoteLogger(const ComboAddress& remote, uint16_t timeout, uint64_t maxQueuedEntries, uint8_t reconnectWaitTime, bool asyncConnect): d_remote(remote), d_maxQueuedEntries(maxQueuedEntries), d_timeout(timeout), d_reconnectWaitTime(reconnectWaitTime), d_asyncConnect(asyncConnect), d_thread(&RemoteLogger::worker, this) +catch(std::exception& e) { - if (!d_asyncConnect) { - reconnect(); - } + cerr<<"Thead died on: "< #include "iputils.hh" +#include -class RemoteLogger +/* Writes can be submitted and they are atomically accepted. Either the whole write + ends up in the buffer or nothing ends up in the buffer. + In case nothing ends up in the buffer, an exception is thrown. + Similarly, EOF leads to this treatment + + The filedescriptor can be in non-blocking mode. + + This class is not threadsafe. +*/ + +class CircularWriteBuffer +{ +public: + explicit CircularWriteBuffer(int fd, size_t size) : d_fd(fd), d_buffer(size) + { + } + + void write(const std::string& str); + void flush(); +private: + int d_fd; + boost::circular_buffer d_buffer; +}; + +class RemoteLoggerInterface { public: - RemoteLogger(const ComboAddress& remote, uint16_t timeout=2, uint64_t maxQueuedEntries=100, uint8_t reconnectWaitTime=1, bool asyncConnect=false); + virtual ~RemoteLoggerInterface() {}; + virtual void queueData(const std::string& data) = 0; + virtual std::string toString() const = 0; +}; + +/* Thread safe. Will connect asynchronously on request. + Runs a reconnection thread that also periodicall flushes. + Note that the buffer only runs as long as there is a connection. + If there is no connection we don't buffer a thing +*/ +class RemoteLogger : public RemoteLoggerInterface +{ +public: + RemoteLogger(const ComboAddress& remote, uint16_t timeout=2, + uint64_t maxQueuedBytes=100000, + uint8_t reconnectWaitTime=1, + bool asyncConnect=false); ~RemoteLogger(); - void queueData(const std::string& data); - std::string toString() + void queueData(const std::string& data) override; + std::string toString() const override { return d_remote.toStringWithPort(); } + void stop() + { + d_exiting = true; + } + std::atomic d_drops{0}; private: bool reconnect(); - void worker(); + void maintenanceThread(); - std::queue d_writeQueue; - std::mutex d_writeMutex; - std::condition_variable d_queueCond; ComboAddress d_remote; - uint64_t d_maxQueuedEntries; + uint64_t d_maxQueuedBytes; int d_socket{-1}; + std::unique_ptr d_writer; uint16_t d_timeout; uint8_t d_reconnectWaitTime; std::atomic d_exiting{false}; + bool d_asyncConnect{false}; std::thread d_thread; + std::mutex d_mutex; }; diff -Nru pdns-recursor-4.1.10/test-syncres_cc.cc pdns-recursor-4.1.11/test-syncres_cc.cc --- pdns-recursor-4.1.10/test-syncres_cc.cc 2019-01-24 10:14:45.000000000 +0000 +++ pdns-recursor-4.1.11/test-syncres_cc.cc 2019-01-31 19:43:44.000000000 +0000 @@ -8991,8 +8991,9 @@ g_luaconfs.setState(luaconfsCopy); size_t queriesCount = 0; + const time_t tnow = sr->getNow().tv_sec; - sr->setAsyncCallback([target,targetAddr,&queriesCount,keys](const ComboAddress& ip, const DNSName& domain, int type, bool doTCP, bool sendRDQuery, int EDNS0Level, struct timeval* now, boost::optional& srcmask, boost::optional context, std::shared_ptr outgoingLogger, LWResult* res, bool* chained) { + sr->setAsyncCallback([target,targetAddr,&queriesCount,keys,tnow](const ComboAddress& ip, const DNSName& domain, int type, bool doTCP, bool sendRDQuery, int EDNS0Level, struct timeval* now, boost::optional& srcmask, boost::optional context, std::shared_ptr outgoingLogger, LWResult* res, bool* chained) { queriesCount++; DNSName auth = domain; @@ -9004,14 +9005,13 @@ else { setLWResult(res, RCode::NoError, true, false, true); addRecordToLW(res, domain, QType::A, targetAddr.toString(), DNSResourceRecord::ANSWER, 3600); - addRRSIG(keys, res->d_records, domain, 1); + addRRSIG(keys, res->d_records, domain, 1, false, boost::none, boost::none, tnow); return 1; } return 0; }); - const time_t now = sr->getNow().tv_sec; vector ret; int res = sr->beginResolve(target, QType(QType::A), QClass::IN, ret); BOOST_CHECK_EQUAL(res, RCode::NoError); @@ -9023,10 +9023,10 @@ const ComboAddress who; vector cached; vector> signatures; - BOOST_REQUIRE_EQUAL(t_RC->get(now, target, QType(QType::A), true, &cached, who, &signatures), 1); + BOOST_REQUIRE_EQUAL(t_RC->get(tnow, target, QType(QType::A), true, &cached, who, &signatures), 1); BOOST_REQUIRE_EQUAL(cached.size(), 1); BOOST_REQUIRE_EQUAL(signatures.size(), 1); - BOOST_CHECK_EQUAL((cached[0].d_ttl - now), 1); + BOOST_CHECK_EQUAL((cached[0].d_ttl - tnow), 1); /* again, to test the cache */ ret.clear(); diff -Nru pdns-recursor-4.1.10/.version pdns-recursor-4.1.11/.version --- pdns-recursor-4.1.10/.version 2019-01-24 10:14:57.000000000 +0000 +++ pdns-recursor-4.1.11/.version 2019-01-31 19:43:56.000000000 +0000 @@ -1 +1 @@ -4.1.10 +4.1.11