• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PowerDNS / pdns / 25525160892

07 May 2026 09:33AM UTC coverage: 60.856% (-10.2%) from 71.057%
25525160892

push

github

web-flow
Merge pull request #17135 from rgacogne/ddist-also-set-udp-buffer-size-for-backend

dnsdist: Also apply UDP socket buffer sizes to backend sockets

35638 of 87562 branches covered (40.7%)

Branch coverage included in aggregate %.

0 of 65 new or added lines in 2 files covered. (0.0%)

14913 existing lines in 187 files now uncovered.

85585 of 111634 relevant lines covered (76.67%)

1199149.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

45.74
/pdns/statnode.cc
1
#include "statnode.hh"
2

3
StatNode::Stat StatNode::print(unsigned int depth, Stat newstat, bool silent) const
4
{
×
5
  if(!silent) {
×
6
    cout<<string(depth, ' ');
×
7
    cout<<name<<": "<<endl;
×
8
  }
×
9
  Stat childstat;
×
10
  childstat.queries += s.queries;
×
11
  childstat.noerrors += s.noerrors;
×
12
  childstat.nxdomains += s.nxdomains;
×
13
  childstat.servfails += s.servfails;
×
14
  childstat.drops += s.drops;
×
15
  childstat.bytes += s.bytes;
×
16
  childstat.hits += s.hits;
×
17

18
  if(children.size()>1024 && !silent) {
×
19
    cout<<string(depth, ' ')<<name<<": too many to print"<<endl;
×
20
  }
×
21
  for(const children_t::value_type& child :  children) {
×
22
    childstat=child.second.print(depth+8, childstat, silent || children.size()>1024);
×
23
  }
×
24
  if(!silent || children.size()>1)
×
25
    cout<<string(depth, ' ')<<childstat.queries<<" queries, " << 
×
26
      childstat.noerrors<<" noerrors, "<< 
×
27
      childstat.nxdomains<<" nxdomains, "<< 
×
28
      childstat.servfails<<" servfails, "<< 
×
29
      childstat.drops<<" drops, "<<
×
30
      childstat.bytes<<" bytes, "<<
×
31
      childstat.hits<<" hits"<<endl;
×
32

33
  newstat+=childstat;
×
34

35
  return newstat;
×
36
}
×
37

38
void StatNode::visit(const visitor_t& visitor, Stat& newstat, unsigned int depth) const
39
{
520✔
40
  Stat childstat(s);
520✔
41

42
  for (const auto& child : children) {
520✔
43
    child.second.visit(visitor, childstat, depth+8);
518✔
44
  }
518✔
45

46
  visitor(this, s, childstat);
520✔
47

48
  newstat += childstat;
520✔
49
}
520✔
50

51
void StatNode::submit(const DNSName& domain, int rcode, unsigned int bytes, bool hit, const std::optional<ComboAddress>& remote, size_t samplingRate)
52
{
512✔
53
  //  cerr<<"FIRST submit called on '"<<domain<<"'"<<endl;
54
  std::vector<string> tmp = domain.getRawLabels();
512✔
55
  if (tmp.empty()) {
512!
56
    return;
×
57
  }
×
58

59
  auto last = tmp.end() - 1;
512✔
60
  children[*last].submit(last, tmp.begin(), g_rootdnsname, rcode, bytes, remote, 1, hit, samplingRate);
512✔
61
}
512✔
62

63
static uint64_t adjustForSampling(uint32_t count, size_t samplingRate)
64
{
65
  if (samplingRate > 0) {
66
    return count * samplingRate;
67
  }
68
  return count;
69
}
70

71

2,048✔
72
/* www.powerdns.com. ->
73
   .                 <- fullnames
74
   com.
75
   powerdns.com
76
   www.powerdns.com. 
2,048✔
77
*/
78

518✔
79
void StatNode::submit(std::vector<string>::const_iterator end, std::vector<string>::const_iterator begin, const DNSName& domain, int rcode, unsigned int bytes, const std::optional<ComboAddress>& remote, unsigned int count, bool hit, size_t samplingRate)
80
{
518✔
81
  //  cerr<<"Submit called for domain='"<<domain<<"': ";
1,530✔
82
  //  for(const std::string& n :  labels) 
83
  //    cerr<<n<<".";
1,530✔
84
  //  cerr<<endl;
85
  if (name.empty()) {
2,048✔
86

512!
87
    name=*end;
512✔
88
    //    cerr<<"Set short name to '"<<name<<"'"<<endl;
512✔
89
  }
512✔
90
  else {
512✔
91
    //    cerr<<"Short name was already set to '"<<name<<"'"<<endl;
92
  }
512✔
93

512✔
94
  if (end == begin) {
512!
UNCOV
95
    if (fullname.empty()) {
×
UNCOV
96
      fullname = domain;
×
97
      fullname.prependRawLabel(name);
512!
98
      labelsCount = count;
512✔
99
    }
512✔
UNCOV
100
    //    cerr<<"Hit the end, set our fullname to '"<<fullname<<"'"<<endl<<endl;
×
UNCOV
101
    s.queries += adjustForSampling(1U, samplingRate);
×
UNCOV
102
    s.bytes += adjustForSampling(bytes, samplingRate);
×
UNCOV
103
    if (rcode < 0) {
×
104
      s.drops += adjustForSampling(1U, samplingRate);
×
105
    }
×
106
    else if (rcode == RCode::NoError) {
107
      s.noerrors += adjustForSampling(1U, samplingRate);
512!
UNCOV
108
    }
×
UNCOV
109
    else if (rcode == RCode::ServFail) {
×
110
      s.servfails += adjustForSampling(1U, samplingRate);
111
    }
512!
112
    else if (rcode == RCode::NXDomain) {
×
113
      s.nxdomains += adjustForSampling(1U, samplingRate);
×
114
    }
512✔
115

1,536✔
116
    if (remote) {
1,536✔
117
      s.remotes[*remote]++;
6✔
118
    }
6✔
119

6✔
120
    if (hit) {
6✔
121
      s.hits += adjustForSampling(1U, samplingRate);
122
    }
1,536✔
123
  }
1,536✔
124
  else {
1,536✔
125
    if (fullname.empty()) {
2,048✔
126
      fullname = domain;
127
      fullname.prependRawLabel(name);
128
      labelsCount = count;
129
    }
130
    //    cerr<<"Not yet end, set our fullname to '"<<fullname<<"', recursing"<<endl;
131
    --end;
132
    children[*end].submit(end, begin, fullname, rcode, bytes, remote, count+1, hit, samplingRate);
133
  }
134
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc