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

PowerDNS / pdns / 19741624072

27 Nov 2025 03:45PM UTC coverage: 73.086% (+0.02%) from 73.065%
19741624072

Pull #16570

github

web-flow
Merge 08a2cdb1d into f94a3f63f
Pull Request #16570: rec: rewrite all unwrap calls in web.rs

38523 of 63408 branches covered (60.75%)

Branch coverage included in aggregate %.

128044 of 164496 relevant lines covered (77.84%)

6531485.83 hits per line

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

54.55
/pdns/dnsdistdist/dnsdist-actions.cc
1
/*
2
 * This file is part of PowerDNS or dnsdist.
3
 * Copyright -- PowerDNS.COM B.V. and its contributors
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of version 2 of the GNU General Public License as
7
 * published by the Free Software Foundation.
8
 *
9
 * In addition, for the avoidance of any doubt, permission is granted to
10
 * link this program with OpenSSL and to (re)distribute the binaries
11
 * produced as the result of such linking.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
 */
22
#include "dnsdist-actions.hh"
23

24
#include <boost/algorithm/string.hpp>
25

26
DNSAction::Action DNSAction::typeFromString(const std::string& str)
27
{
73✔
28
  static const std::unordered_map<std::string, Action> s_mappings{
73✔
29
    {"allow", Action::Allow},
73✔
30
    {"delay", Action::Delay},
73✔
31
    {"drop", Action::Drop},
73✔
32
    {"headermodify", Action::HeaderModify},
73✔
33
    {"none", Action::None},
73✔
34
    {"noop", Action::NoOp},
73✔
35
    {"norecurse", Action::NoRecurse},
73✔
36
    {"nxdomain", Action::Nxdomain},
73✔
37
    {"pool", Action::Pool},
73✔
38
    {"refused", Action::Refused},
73✔
39
    {"servfail", Action::ServFail},
73✔
40
    {"settag", Action::SetTag},
73✔
41
    {"spoof", Action::Spoof},
73✔
42
    {"spoofpacket", Action::SpoofPacket},
73✔
43
    {"spoofraw", Action::SpoofRaw},
73✔
44
    {"truncate", Action::Truncate},
73✔
45
  };
73✔
46

47
  auto lower = boost::to_lower_copy(str);
73✔
48
  lower.erase(std::remove(lower.begin(), lower.end(), '-'), lower.end());
73✔
49
  auto mappingIt = s_mappings.find(lower);
73✔
50
  if (mappingIt != s_mappings.end()) {
73!
51
    return mappingIt->second;
73✔
52
  }
73✔
53
  throw std::runtime_error("Unable to convert '" + str + "' into a DNS Action");
×
54
}
73✔
55

56
std::string DNSAction::typeToString(DNSAction::Action action)
57
{
10✔
58
  switch (action) {
10!
59
  case Action::Drop:
8✔
60
    return "Drop";
8✔
61
  case Action::Nxdomain:
×
62
    return "Send NXDomain";
×
63
  case Action::Refused:
×
64
    return "Send Refused";
×
65
  case Action::Spoof:
×
66
    return "Spoof an answer";
×
67
  case Action::SpoofPacket:
×
68
    return "Spoof a raw answer from bytes";
×
69
  case Action::SpoofRaw:
×
70
    return "Spoof an answer from raw bytes";
×
71
  case Action::Allow:
×
72
    return "Allow";
×
73
  case Action::HeaderModify:
×
74
    return "Modify the header";
×
75
  case Action::Pool:
×
76
    return "Route to a pool";
×
77
  case Action::Delay:
×
78
    return "Delay";
×
79
  case Action::Truncate:
×
80
    return "Truncate over UDP";
×
81
  case Action::ServFail:
×
82
    return "Send ServFail";
×
83
  case Action::SetTag:
×
84
    return "Set Tag";
×
85
  case Action::None:
×
86
  case Action::NoOp:
2✔
87
    return "Do nothing";
2✔
88
  case Action::NoRecurse:
×
89
    return "Set rd=0";
×
90
  }
10✔
91

92
  return "Unknown";
×
93
}
10✔
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

© 2025 Coveralls, Inc