Browse Source

New upstream version 4.4.1

tags/upstream/4.4.1^0
Chris Hofstaedtler 4 months ago
parent
commit
981911b71a
15 changed files with 190 additions and 101 deletions
  1. +10
    -10
      configure
  2. +1
    -1
      configure.ac
  3. +52
    -35
      effective_tld_names.dat
  4. +2
    -2
      lua-recursor4.cc
  5. +1
    -1
      mtasker.hh
  6. +1
    -1
      pdns_recursor.1
  7. +22
    -4
      pdns_recursor.cc
  8. +25
    -9
      pubsuffix.cc
  9. +3
    -4
      rec-carbon.cc
  10. +8
    -2
      rec_channel.hh
  11. +37
    -18
      rec_channel_rec.cc
  12. +1
    -1
      rec_control.1
  13. +12
    -0
      syncres.cc
  14. +2
    -1
      syncres.hh
  15. +13
    -12
      ws-recursor.cc

+ 10
- 10
configure View File

@@ -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.4.0.
# Generated by GNU Autoconf 2.69 for pdns-recursor 4.4.1.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='pdns-recursor'
PACKAGE_TARNAME='pdns-recursor'
PACKAGE_VERSION='4.4.0'
PACKAGE_STRING='pdns-recursor 4.4.0'
PACKAGE_VERSION='4.4.1'
PACKAGE_STRING='pdns-recursor 4.4.1'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

@@ -1519,7 +1519,7 @@ if test "$ac_init_help" = "long"; then
# 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.4.0 to adapt to many kinds of systems.
\`configure' configures pdns-recursor 4.4.1 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

@@ -1590,7 +1590,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of pdns-recursor 4.4.0:";;
short | recursive ) echo "Configuration of pdns-recursor 4.4.1:";;
esac
cat <<\_ACEOF

@@ -1772,7 +1772,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
pdns-recursor configure 4.4.0
pdns-recursor configure 4.4.1
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2365,7 +2365,7 @@ cat >config.log <<_ACEOF
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.4.0, which was
It was created by pdns-recursor $as_me 4.4.1, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ $0 $@
@@ -3233,7 +3233,7 @@ fi

# Define the identity of the package.
PACKAGE='pdns-recursor'
VERSION='4.4.0'
VERSION='4.4.1'


cat >>confdefs.h <<_ACEOF
@@ -25391,7 +25391,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# 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.4.0, which was
This file was extended by pdns-recursor $as_me 4.4.1, which was
generated by GNU Autoconf 2.69. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
@@ -25457,7 +25457,7 @@ _ACEOF
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.4.0
pdns-recursor config.status 4.4.1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"



+ 1
- 1
configure.ac View File

@@ -1,6 +1,6 @@
AC_PREREQ([2.61])

AC_INIT([pdns-recursor], [4.4.0])
AC_INIT([pdns-recursor], [4.4.1])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip tar-ustar -Wno-portability subdir-objects parallel-tests 1.11])
AM_SILENT_RULES([yes])


+ 52
- 35
effective_tld_names.dat View File

@@ -4703,6 +4703,7 @@ nl
// Norid geographical second level domains : https://www.norid.no/en/om-domenenavn/regelverk-for-no/vedlegg-b/
// Norid category second level domains : https://www.norid.no/en/om-domenenavn/regelverk-for-no/vedlegg-c/
// Norid category second-level domains managed by parties other than Norid : https://www.norid.no/en/om-domenenavn/regelverk-for-no/vedlegg-d/
// RSS feed: https://teknisk.norid.no/en/feed/
no
// Norid category second level domains : https://www.norid.no/en/om-domenenavn/regelverk-for-no/vedlegg-c/
fhs.no
@@ -7110,7 +7111,7 @@ org.zw

// newGTLDs

// List of new gTLDs imported from https://www.icann.org/resources/registries/gtlds/v2/gtlds.json on 2020-10-12T17:47:39Z
// List of new gTLDs imported from https://www.icann.org/resources/registries/gtlds/v2/gtlds.json on 2020-11-21T18:09:21Z
// This list is auto-generated, don't edit it manually.
// aaa : 2015-02-26 American Automobile Association, Inc.
aaa
@@ -7337,7 +7338,7 @@ avianca
// aws : 2015-06-25 Amazon Registry Services, Inc.
aws

// axa : 2013-12-19 AXA SA
// axa : 2013-12-19 AXA Group Operations SAS
axa

// azure : 2014-12-18 Microsoft Corporation
@@ -8651,9 +8652,6 @@ java
// jcb : 2014-11-20 JCB Co., Ltd.
jcb

// jcp : 2015-04-23 JCP Media, Inc.
jcp

// jeep : 2015-07-30 FCA US LLC.
jeep

@@ -9242,7 +9240,7 @@ one
// ong : 2014-03-06 Public Interest Registry
ong

// onl : 2013-09-16 I-Registry Ltd.
// onl : 2013-09-16 iRegistry GmbH
onl

// online : 2015-01-15 DotOnline Inc.
@@ -9539,7 +9537,7 @@ reviews
// rexroth : 2015-06-18 Robert Bosch GMBH
rexroth

// rich : 2013-11-21 I-Registry Ltd.
// rich : 2013-11-21 iRegistry GmbH
rich

// richardli : 2015-05-14 Pacific Century Asset Management (HK) Limited
@@ -10073,7 +10071,7 @@ travelers
// travelersinsurance : 2015-03-26 Travelers TLD, LLC
travelersinsurance

// trust : 2014-10-16 NCC Group Domain Services, Inc.
// trust : 2014-10-16 UNR Corp.
trust

// trv : 2015-03-26 Travelers TLD, LLC
@@ -10680,12 +10678,6 @@ barsy.ca
// Submitted by Werner Kaltofen <wk@all-inkl.com>
kasserver.com

// Algorithmia, Inc. : algorithmia.com
// Submitted by Eli Perelman <eperelman@algorithmia.io>
*.algorithmia.com
!teams.algorithmia.com
!test.algorithmia.com

// Altervista: https://www.altervista.org
// Submitted by Carlo Cannas <tech_staff@altervista.it>
altervista.org
@@ -10868,6 +10860,10 @@ bnr.la
// Submitted by Paul Crowder <paul.crowder@blackbaud.com>
blackbaudcdn.net

// Blatech : http://www.blatech.net
// Submitted by Luke Bratch <luke@bratch.co.uk>
of.je

// Boomla : https://boomla.com
// Submitted by Tibor Halter <thalter@boomla.com>
boomla.net
@@ -10981,10 +10977,6 @@ c.la
// Submitted by B. Blechschmidt <hostmaster@certmgr.org>
certmgr.org

// Citrix : https://citrix.com
// Submitted by Alex Stoddard <alex.stoddard@citrix.com>
xenapponazure.com

// Civilized Discourse Construction Kit, Inc. : https://www.discourse.org/
// Submitted by Rishabh Nambiar & Michael Brown <team@discourse.org>
discourse.group
@@ -11073,10 +11065,6 @@ cloudns.pro
cloudns.pw
cloudns.us

// Cloudeity Inc : https://cloudeity.com
// Submitted by Stefan Dimitrov <contact@cloudeity.com>
cloudeity.net

// CNPY : https://cnpy.gdn
// Submitted by Angelo Gladding <angelo@lahacker.net>
cnpy.gdn
@@ -11537,6 +11525,10 @@ ddnss.org
definima.net
definima.io

// DigitalOcean : https://digitalocean.com/
// Submitted by Braxton Huggins <bhuggins@digitalocean.com>
ondigitalocean.app

// dnstrace.pro : https://dnstrace.pro/
// Submitted by Chris Partridge <chris@partridge.tech>
bci.dnstrace.pro
@@ -11802,6 +11794,10 @@ ukco.me
// submitted by Koen Van Isterdael <k.vanisterdael@fermax.be>
mydobiss.com

// FH Muenster : https://www.fh-muenster.de
// Submitted by Robin Naundorf <r.naundorf@fh-muenster.de>
fh-muenster.io

// Filegear Inc. : https://www.filegear.com
// Submitted by Jason Zhu <jason@owtware.com>
filegear.me
@@ -12058,6 +12054,10 @@ ravendb.me
development.run
ravendb.run

// Hong Kong Productivity Council: https://www.hkpc.org/
// Submitted by SECaaS Team <summchan@hkpc.org>
secaas.hk

// HOSTBIP REGISTRY : https://www.hostbip.com/
// Submitted by Atanunu Igbunuroghene <publicsuffixlist@hostbip.com>
bpl.biz
@@ -12167,7 +12167,7 @@ iserv.dev
// Submitted by Yuji Minagawa <domains-admin@iodata.jp>
iobb.net

//Jelastic, Inc. : https://jelastic.com/
// Jelastic, Inc. : https://jelastic.com/
// Submited by Ihor Kolodyuk <ik@jelastic.com>
mel.cloudlets.com.au
cloud.interhostsolutions.be
@@ -12182,6 +12182,9 @@ jele.cloud
it1.eur.aruba.jenv-aruba.cloud
it1.jenv-aruba.cloud
it1-eur.jenv-arubabiz.cloud
oxa.cloud
tn.oxa.cloud
uk.oxa.cloud
primetel.cloud
uk.primetel.cloud
ca.reclaim.cloud
@@ -12252,6 +12255,7 @@ jelastic.regruhosting.ru
enscaled.sg
jele.site
jelastic.team
orangecloud.tn
j.layershift.co.uk
phx.enscaled.us
mircloud.us
@@ -12329,10 +12333,6 @@ co.technology
// Submitted by Greg Holland <greg.holland@lmpm.com>
app.lmpm.com

// Linki Tools UG : https://linki.tools
// Submitted by Paulo Matos <pmatos@linki.tools>
linkitools.space

// linkyard ldt: https://www.linkyard.ch/
// Submitted by Mario Siegenthaler <mario.siegenthaler@linkyard.ch>
linkyard.cloud
@@ -12371,7 +12371,6 @@ swidnik.pl

// Lug.org.uk : https://lug.org.uk
// Submitted by Jon Spriggs <admin@lug.org.uk>
uklugs.org
glug.org.uk
lug.org.uk
lugs.org.uk
@@ -12448,11 +12447,17 @@ eu.meteorapp.com
co.pl

// Microsoft Corporation : http://microsoft.com
// Submitted by Mostafa Elzeiny <moelzein@microsoft.com>
// Submitted by Mitch Webster <miwebst@microsoft.com>
*.azurecontainer.io
azurewebsites.net
azure-mobile.net
cloudapp.net
azurestaticapps.net
centralus.azurestaticapps.net
eastasia.azurestaticapps.net
eastus2.azurestaticapps.net
westeurope.azurestaticapps.net
westus2.azurestaticapps.net

// minion.systems : http://minion.systems
// Submitted by Robert Böttinger <r@minion.systems>
@@ -12494,19 +12499,22 @@ cust.retrosnub.co.uk
ui.nabu.casa

// Names.of.London : https://names.of.london/
// Submitted by James Stevens <registry@names.of.london> or <james@jrcs.net>
// Submitted by James Stevens <registry[at]names.of.london> or <publiclist[at]jrcs.net>
pony.club
of.fashion
on.fashion
of.football
in.london
of.london
from.marketing
with.marketing
for.men
repair.men
and.mom
for.mom
for.one
under.one
for.sale
of.work
that.win
from.work
to.work

// NCTU.ME : https://nctu.me/
@@ -12826,6 +12834,12 @@ mypep.link
// Submitted by Kenneth Van Alstyne <kvanalstyne@perspecta.com>
perspecta.cloud

// PE Ulyanov Kirill Sergeevich : https://airy.host
// Submitted by Kirill Ulyanov <k.ulyanov@airy.host>
lk3.ru
ra-ru.ru
zsew.ru

// Planet-Work : https://www.planet-work.com/
// Submitted by Frédéric VANNIÈRE <f.vanniere@planet-work.com>
on-web.fr
@@ -12887,6 +12901,10 @@ byen.site
// Submitted by Kor Nielsen <kor@pubtls.org>
pubtls.org

// QOTO, Org.
// Submitted by Jeffrey Phillips Freeman <jeffrey.freeman@qoto.org>
qoto.io

// Qualifio : https://qualifio.com/
// Submitted by Xavier De Cock <xdecock@gmail.com>
qualifioapp.com
@@ -12972,7 +12990,6 @@ hzc.io
// Revitalised Limited : http://www.revitalised.co.uk
// Submitted by Jack Price <jack@revitalised.co.uk>
wellbeingzone.eu
ptplus.fit
wellbeingzone.co.uk

// Rochester Institute of Technology : http://www.rit.edu/
@@ -13346,7 +13363,7 @@ wafflecell.com
// Submitted by Fajar Sodik <official@wapblog.id>
idnblogger.com
indowapblog.com
bloghp.id
bloger.id
wblog.id
wbq.me
fastblog.net


+ 2
- 2
lua-recursor4.cc View File

@@ -354,8 +354,8 @@ void RecursorLua4::postPrepareContext()

d_pd.push_back({"now", &g_now});

d_lw->writeFunction("getMetric", [](const std::string& str) {
return DynMetric{getDynMetric(str)};
d_lw->writeFunction("getMetric", [](const std::string& str, boost::optional<std::string> prometheusName) {
return DynMetric{getDynMetric(str, prometheusName ? *prometheusName : "")};
});

d_lw->registerFunction("inc", &DynMetric::inc);


+ 1
- 1
mtasker.hh View File

@@ -81,7 +81,7 @@ public:
EventKey key;
std::shared_ptr<pdns_ucontext_t> context;
struct timeval ttd;
int tid;
int tid;
};

typedef multi_index_container<


+ 1
- 1
pdns_recursor.1 View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "PDNS_RECURSOR" "1" "Oct 16, 2020" "" "PowerDNS Recursor"
.TH "PDNS_RECURSOR" "1" "Nov 24, 2020" "" "PowerDNS Recursor"
.SH NAME
pdns_recursor \- The PowerDNS Recursor binary
.


+ 22
- 4
pdns_recursor.cc View File

@@ -644,7 +644,7 @@ int asendto(const char *data, size_t len, int flags,
pair<MT_t::waiters_t::iterator, MT_t::waiters_t::iterator> chain=MT->d_waiters.equal_range(pident, PacketIDBirthdayCompare());

for(; chain.first != chain.second; chain.first++) {
if(chain.first->key.fd > -1) { // don't chain onto existing chained waiter!
if(chain.first->key.fd > -1 && !chain.first->key.closed) { // don't chain onto existing chained waiter or a chain already processed
/*
cerr<<"Orig: "<<pident.domain<<", "<<pident.remote.toString()<<", id="<<id<<endl;
cerr<<"Had hit: "<< chain.first->key.domain<<", "<<chain.first->key.remote.toString()<<", id="<<chain.first->key.id
@@ -1132,7 +1132,13 @@ static void sendNODLookup(const DNSName& dname)
// Send a DNS A query to <domain>.g_nodLookupDomain
static const QType qt(QType::A);
static const uint16_t qc(QClass::IN);
DNSName qname = dname + g_nodLookupDomain;
DNSName qname;
try {
qname = dname + g_nodLookupDomain;
}
catch(const std::range_error &e) {
return;
}
vector<DNSRecord> dummy;
directResolve(qname, qt, qc, dummy);
}
@@ -1186,7 +1192,16 @@ int followCNAMERecords(vector<DNSRecord>& ret, const QType& qtype)

int getFakeAAAARecords(const DNSName& qname, ComboAddress prefix, vector<DNSRecord>& ret)
{
int rcode = directResolve(qname, QType(QType::A), QClass::IN, ret);
/* we pass a separate vector of records because we will be resolving the initial qname
again, possibly encountering the same CNAME(s), and we don't want to trigger the CNAME
loop detection. */
vector<DNSRecord> newRecords;
int rcode = directResolve(qname, QType(QType::A), QClass::IN, newRecords);

ret.reserve(ret.size() + newRecords.size());
for (auto& record : newRecords) {
ret.push_back(std::move(record));
}

// Remove double CNAME records
std::set<DNSName> seenCNAMEs;
@@ -1488,7 +1503,7 @@ static void startDoResolve(void *p)
}
}

if (policyOverride) {
if (!policyOverride) {
/* No RPZ or gettag overrides it anyway */
ret = std::move(dc->d_records);
res = *dc->d_rcode;
@@ -3712,6 +3727,9 @@ static void handleTCPClientWritable(int fd, FDMultiplexer::funcparam_t& var)
// resend event to everybody chained onto it
static void doResends(MT_t::waiters_t::iterator& iter, PacketID resend, const string& content)
{
// We close the chain for new entries, since they won't be processed anyway
iter->key.closed = true;

if(iter->key.chain.empty())
return;
// cerr<<"doResends called!\n";


+ 25
- 9
pubsuffix.cc View File

@@ -5634,6 +5634,7 @@ const char* g_pubsuffix[]={
"betainabox.com",
"bnr.la",
"blackbaudcdn.net",
"of.je",
"boomla.net",
"boxfuse.io",
"square7.ch",
@@ -5691,7 +5692,6 @@ const char* g_pubsuffix[]={
"shop.ro",
"c.la",
"certmgr.org",
"xenapponazure.com",
"discourse.group",
"discourse.team",
"virtueeldomein.nl",
@@ -5730,7 +5730,6 @@ const char* g_pubsuffix[]={
"cloudns.pro",
"cloudns.pw",
"cloudns.us",
"cloudeity.net",
"cnpy.gdn",
"co.nl",
"co.no",
@@ -6081,6 +6080,7 @@ const char* g_pubsuffix[]={
"ddnss.org",
"definima.net",
"definima.io",
"ondigitalocean.app",
"bci.dnstrace.pro",
"ddnsfree.com",
"ddnsgeek.com",
@@ -6279,6 +6279,7 @@ const char* g_pubsuffix[]={
"couk.me",
"ukco.me",
"mydobiss.com",
"fh-muenster.io",
"filegear.me",
"filegear-au.me",
"filegear-de.me",
@@ -6430,6 +6431,7 @@ const char* g_pubsuffix[]={
"ravendb.me",
"development.run",
"ravendb.run",
"secaas.hk",
"bpl.biz",
"orx.biz",
"ng.city",
@@ -6507,6 +6509,9 @@ const char* g_pubsuffix[]={
"it1.eur.aruba.jenv-aruba.cloud",
"it1.jenv-aruba.cloud",
"it1-eur.jenv-arubabiz.cloud",
"oxa.cloud",
"tn.oxa.cloud",
"uk.oxa.cloud",
"primetel.cloud",
"uk.primetel.cloud",
"ca.reclaim.cloud",
@@ -6577,6 +6582,7 @@ const char* g_pubsuffix[]={
"enscaled.sg",
"jele.site",
"jelastic.team",
"orangecloud.tn",
"j.layershift.co.uk",
"phx.enscaled.us",
"mircloud.us",
@@ -6606,7 +6612,6 @@ const char* g_pubsuffix[]={
"co.place",
"co.technology",
"app.lmpm.com",
"linkitools.space",
"linkyard.cloud",
"linkyard-cloud.ch",
"members.linode.com",
@@ -6623,7 +6628,6 @@ const char* g_pubsuffix[]={
"lublin.pl",
"poniatowa.pl",
"swidnik.pl",
"uklugs.org",
"glug.org.uk",
"lug.org.uk",
"lugs.org.uk",
@@ -6667,6 +6671,12 @@ const char* g_pubsuffix[]={
"azurewebsites.net",
"azure-mobile.net",
"cloudapp.net",
"azurestaticapps.net",
"centralus.azurestaticapps.net",
"eastasia.azurestaticapps.net",
"eastus2.azurestaticapps.net",
"westeurope.azurestaticapps.net",
"westus2.azurestaticapps.net",
"csx.cc",
"forte.id",
"mozilla-iot.org",
@@ -6687,16 +6697,19 @@ const char* g_pubsuffix[]={
"ui.nabu.casa",
"pony.club",
"of.fashion",
"on.fashion",
"of.football",
"in.london",
"of.london",
"from.marketing",
"with.marketing",
"for.men",
"repair.men",
"and.mom",
"for.mom",
"for.one",
"under.one",
"for.sale",
"of.work",
"that.win",
"from.work",
"to.work",
"nctu.me",
"netlify.app",
@@ -6904,6 +6917,9 @@ const char* g_pubsuffix[]={
"gotpantheon.com",
"mypep.link",
"perspecta.cloud",
"lk3.ru",
"ra-ru.ru",
"zsew.ru",
"on-web.fr",
"bc.platform.sh",
"ent.platform.sh",
@@ -6924,6 +6940,7 @@ const char* g_pubsuffix[]={
"chirurgiens-dentistes-en-france.fr",
"byen.site",
"pubtls.org",
"qoto.io",
"qualifioapp.com",
"qbuser.com",
"instantcloud.cn",
@@ -6948,7 +6965,6 @@ const char* g_pubsuffix[]={
"devices.resinstaging.io",
"hzc.io",
"wellbeingzone.eu",
"ptplus.fit",
"wellbeingzone.co.uk",
"git-pages.rit.edu",
"sandcats.io",
@@ -7133,7 +7149,7 @@ const char* g_pubsuffix[]={
"wafflecell.com",
"idnblogger.com",
"indowapblog.com",
"bloghp.id",
"bloger.id",
"wblog.id",
"wbq.me",
"fastblog.net",


+ 3
- 4
rec-carbon.cc View File

@@ -54,14 +54,13 @@ try
s.connect(remote); // we do the connect so the first attempt happens while we gather stats
if(msg.empty()) {
typedef map<string,string> all_t;
all_t all=getAllStatsMap(StatComponent::Carbon);
auto all = getAllStatsMap(StatComponent::Carbon);
ostringstream str;
time_t now=time(0);
for(const all_t::value_type& val : all) {
str<<namespace_name<<'.'<<hostname<<'.'<<instance_name<<'.'<<val.first<<' '<<val.second<<' '<<now<<"\r\n";
for(const auto& val : all) {
str<<namespace_name<<'.'<<hostname<<'.'<<instance_name<<'.'<<val.first<<' '<<val.second.d_value<<' '<<now<<"\r\n";
}
msg = str.str();
}


+ 8
- 2
rec_channel.hh View File

@@ -72,7 +72,13 @@ public:

enum class StatComponent { API, Carbon, RecControl, SNMP };

std::map<std::string, std::string> getAllStatsMap(StatComponent component);
struct StatsMapEntry {
std::string d_prometheusName;
std::string d_value;
};
typedef std::map<std::string, StatsMapEntry> StatsMap;
StatsMap getAllStatsMap(StatComponent component);

extern std::mutex g_carbon_config_lock;
std::vector<std::pair<DNSName, uint16_t> >* pleaseGetQueryRing();
std::vector<std::pair<DNSName, uint16_t> >* pleaseGetServfailQueryRing();
@@ -83,7 +89,7 @@ std::vector<ComboAddress>* pleaseGetBogusRemotes();
std::vector<ComboAddress>* pleaseGetLargeAnswerRemotes();
std::vector<ComboAddress>* pleaseGetTimeouts();
DNSName getRegisteredName(const DNSName& dom);
std::atomic<unsigned long>* getDynMetric(const std::string& str);
std::atomic<unsigned long>* getDynMetric(const std::string& str, const std::string& prometheusName);
optional<uint64_t> getStatByName(const std::string& name);
bool isStatBlacklisted(StatComponent component, const std::string& name);
void blacklistStat(StatComponent component, const string& name);


+ 37
- 18
rec_channel_rec.cc View File

@@ -43,7 +43,12 @@ static map<string, const uint32_t*> d_get32bitpointers;
static map<string, const std::atomic<uint64_t>*> d_getatomics;
static map<string, function< uint64_t() > > d_get64bitmembers;
static std::mutex d_dynmetricslock;
static map<string, std::atomic<unsigned long>* > d_dynmetrics;
struct dynmetrics {
std::atomic<unsigned long> *d_ptr;
std::string d_prometheusName;
};

static map<string, dynmetrics> d_dynmetrics;

static std::map<StatComponent, std::set<std::string>> s_blacklistedStats;

@@ -82,16 +87,31 @@ static void addGetStat(const string& name, function<uint64_t ()> f )
d_get64bitmembers[name]=f;
}

std::atomic<unsigned long>* getDynMetric(const std::string& str)
static std::string getPrometheusName(const std::string& arg)
{
std::string name = arg;
std::replace_if(name.begin(), name.end(), [](char c){
return !isalnum(static_cast<unsigned char>(c));}, '_');
return "pdns_recursor_" + name;
}

std::atomic<unsigned long>* getDynMetric(const std::string& str, const std::string& prometheusName)
{
std::lock_guard<std::mutex> l(d_dynmetricslock);
auto f = d_dynmetrics.find(str);
if(f != d_dynmetrics.end())
return f->second;
return f->second.d_ptr;

auto ret = new std::atomic<unsigned long>();
std::string name(str);
if (!prometheusName.empty()) {
name = prometheusName;
} else {
name = getPrometheusName(name);
}

auto ret = dynmetrics{new std::atomic<unsigned long>(), name};
d_dynmetrics[str]= ret;
return ret;
return ret.d_ptr;
}

static optional<uint64_t> get(const string& name)
@@ -106,9 +126,9 @@ static optional<uint64_t> get(const string& name)
return d_get64bitmembers.find(name)->second();

std::lock_guard<std::mutex> l(d_dynmetricslock);
auto f =rplookup(d_dynmetrics, name);
if(f)
return (*f)->load();
auto f = rplookup(d_dynmetrics, name);
if (f)
return f->d_ptr->load();
return ret;
}
@@ -118,25 +138,25 @@ optional<uint64_t> getStatByName(const std::string& name)
return get(name);
}

map<string,string> getAllStatsMap(StatComponent component)
StatsMap getAllStatsMap(StatComponent component)
{
map<string,string> ret;
StatsMap ret;
const auto& blacklistMap = s_blacklistedStats.at(component);

for(const auto& the32bits : d_get32bitpointers) {
if (blacklistMap.count(the32bits.first) == 0) {
ret.insert(make_pair(the32bits.first, std::to_string(*the32bits.second)));
ret.insert(make_pair(the32bits.first, StatsMapEntry{getPrometheusName(the32bits.first), std::to_string(*the32bits.second)}));
}
}
for(const auto& atomic : d_getatomics) {
if (blacklistMap.count(atomic.first) == 0) {
ret.insert(make_pair(atomic.first, std::to_string(atomic.second->load())));
ret.insert(make_pair(atomic.first, StatsMapEntry{getPrometheusName(atomic.first), std::to_string(atomic.second->load())}));
}
}

for(const auto& the64bitmembers : d_get64bitmembers) {
if (blacklistMap.count(the64bitmembers.first) == 0) {
ret.insert(make_pair(the64bitmembers.first, std::to_string(the64bitmembers.second())));
ret.insert(make_pair(the64bitmembers.first, StatsMapEntry{getPrometheusName(the64bitmembers.first), std::to_string(the64bitmembers.second())}));
}
}

@@ -144,7 +164,7 @@ map<string,string> getAllStatsMap(StatComponent component)
std::lock_guard<std::mutex> l(d_dynmetricslock);
for(const auto& a : d_dynmetrics) {
if (blacklistMap.count(a.first) == 0) {
ret.insert({a.first, std::to_string(*a.second)});
ret.insert(make_pair(a.first, StatsMapEntry{a.second.d_prometheusName, std::to_string(*a.second.d_ptr)}));
}
}
}
@@ -154,11 +174,10 @@ map<string,string> getAllStatsMap(StatComponent component)

static string getAllStats()
{
typedef map<string, string> varmap_t;
varmap_t varmap = getAllStatsMap(StatComponent::RecControl);
auto varmap = getAllStatsMap(StatComponent::RecControl);
string ret;
for(varmap_t::value_type& tup : varmap) {
ret += tup.first + "\t" + tup.second +"\n";
for (const auto& tup : varmap) {
ret += tup.first + "\t" + tup.second.d_value + "\n";
}
return ret;
}


+ 1
- 1
rec_control.1 View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "REC_CONTROL" "1" "Oct 16, 2020" "" "PowerDNS Recursor"
.TH "REC_CONTROL" "1" "Nov 24, 2020" "" "PowerDNS Recursor"
.SH NAME
rec_control \- Command line tool to control a running Recursor
.


+ 12
- 0
syncres.cc View File

@@ -1497,6 +1497,13 @@ bool SyncRes::doCNAMECacheCheck(const DNSName &qname, const QType &qtype, vector
throw ImmediateServFailException(msg);
}

if (newTarget.isPartOf(qname)) {
// a.b.c. CNAME x.a.b.c will go to great depths with QM on
string msg = "got a CNAME referral (from cache) to child, disabling QM";
LOG(prefix<<qname<<": "<<msg<<endl);
setQNameMinimization(false);
}

// Check to see if we already have seen the new target as a previous target
if (scanForCNAMELoop(newTarget, ret)) {
string msg = "got a CNAME referral (from cache) that causes a loop";
@@ -3662,6 +3669,11 @@ void SyncRes::handleNewTarget(const std::string& prefix, const DNSName& qname, c
rcode = RCode::ServFail;
return;
}
if (newtarget.isPartOf(qname)) {
// a.b.c. CNAME x.a.b.c will go to great depths with QM on
LOG(prefix<<qname<<": status=got a CNAME referral to child, disabling QM"<<endl);
setQNameMinimization(false);
}

if (depth > 10) {
LOG(prefix<<qname<<": status=got a CNAME referral, but recursing too deep, returning SERVFAIL"<<endl);


+ 2
- 1
syncres.hh View File

@@ -926,7 +926,7 @@ int arecvtcp(string& data, size_t len, Socket* sock, bool incompleteOkay);

struct PacketID
{
PacketID() : id(0), type(0), sock(0), inNeeded(0), inIncompleteOkay(false), outPos(0), nearMisses(0), fd(-1)
PacketID() : id(0), type(0), sock(0), inNeeded(0), inIncompleteOkay(false), outPos(0), nearMisses(0), fd(-1), closed(false)
{
remote.reset();
}
@@ -948,6 +948,7 @@ struct PacketID
mutable chain_t chain;
mutable uint32_t nearMisses; // number of near misses - host correct, id wrong
int fd;
mutable bool closed; // Processing already started, don't accept new chained ids

bool operator<(const PacketID& b) const
{


+ 13
- 12
ws-recursor.cc View File

@@ -50,8 +50,12 @@ using json11::Json;

void productServerStatisticsFetch(map<string,string>& out)
{
map<string,string> stats = getAllStatsMap(StatComponent::API);
out.swap(stats);
auto stats = getAllStatsMap(StatComponent::API);
map<string,string> ret;
for (const auto& entry: stats) {
ret.insert(make_pair(entry.first, entry.second.d_value));
}
out.swap(ret);
}

boost::optional<uint64_t> productServerStatisticsFetch(const std::string& name)
@@ -434,16 +438,14 @@ static void prometheusMetrics(HttpRequest *req, HttpResponse *resp) {

registerAllStats();


std::ostringstream output;
typedef map <string, string> varmap_t;
varmap_t varmap = getAllStatsMap(
StatComponent::API); // Argument controls blacklisting of any stats. So stats-api-blacklist will be used to block returned stats.
for (const auto &tup : varmap) {
std::string metricName = tup.first;

// Prometheus suggest using '_' instead of '-'
std::string prometheusMetricName = "pdns_recursor_" + boost::replace_all_copy(metricName, "-", "_");
// Argument controls blacklisting of any stats. So
// stats-api-blacklist will be used to block returned stats.
auto varmap = getAllStatsMap(StatComponent::API);
for (const auto& tup : varmap) {
std::string metricName = tup.first;
std::string prometheusMetricName = tup.second.d_prometheusName;

MetricDefinition metricDetails;

@@ -459,7 +461,7 @@ static void prometheusMetrics(HttpRequest *req, HttpResponse *resp) {
output << "# HELP " << prometheusMetricName << " " << metricDetails.description << "\n";
output << "# TYPE " << prometheusMetricName << " " << prometheusTypeName << "\n";
}
output << prometheusMetricName << " " << tup.second << "\n";
output << prometheusMetricName << " " << tup.second.d_value << "\n";
}

output << "# HELP pdns_recursor_info " << "Info from pdns_recursor, value is always 1" << "\n";
@@ -469,7 +471,6 @@ static void prometheusMetrics(HttpRequest *req, HttpResponse *resp) {
resp->body = output.str();
resp->headers["Content-Type"] = "text/plain";
resp->status = 200;

}




Loading…
Cancel
Save