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

PowerDNS / pdns / 15923993233

27 Jun 2025 10:20AM UTC coverage: 65.637% (-0.02%) from 65.656%
15923993233

Pull #15735

github

web-flow
Merge 883aec59c into ecbd3685b
Pull Request #15735: lmdb-safe: Improve the scalability of transaction maps

41581 of 91868 branches covered (45.26%)

Branch coverage included in aggregate %.

44 of 56 new or added lines in 1 file covered. (78.57%)

4906 existing lines in 99 files now uncovered.

126844 of 164732 relevant lines covered (77.0%)

6073148.21 hits per line

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

76.47
/pdns/dnsdistdist/dnsdist-dnsquestion.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.hh"
23
#include "dnsdist-configuration.hh"
24
#include "dnsdist-dnsparser.hh"
25

26
std::string DNSQuestion::getTrailingData() const
27
{
12✔
28
  // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
29
  const auto* message = reinterpret_cast<const char*>(this->getData().data());
12✔
30
  const uint16_t messageLen = getDNSPacketLength(message, this->getData().size());
12✔
31
  // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
32
  return {message + messageLen, this->getData().size() - messageLen};
12✔
33
}
12✔
34

35
bool DNSQuestion::setTrailingData(const std::string& tail)
36
{
14✔
37
  // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
38
  const char* message = reinterpret_cast<const char*>(this->data.data());
14✔
39
  const uint16_t messageLen = getDNSPacketLength(message, this->data.size());
14✔
40
  this->data.resize(messageLen);
14✔
41
  if (!tail.empty()) {
14✔
42
    if (!hasRoomFor(tail.size())) {
12✔
UNCOV
43
      return false;
2✔
UNCOV
44
    }
2✔
45
    this->data.insert(this->data.end(), tail.begin(), tail.end());
10✔
46
  }
10✔
47
  return true;
12✔
48
}
14✔
49

50
bool DNSQuestion::editHeader(const std::function<bool(dnsheader&)>& editFunction)
51
{
×
52
  if (data.size() < sizeof(dnsheader)) {
×
53
    throw std::runtime_error("Trying to access the dnsheader of a too small (" + std::to_string(data.size()) + ") DNSQuestion buffer");
×
54
  }
×
55
  return dnsdist::PacketMangling::editDNSHeaderFromPacket(data, editFunction);
×
56
}
×
57

58
DNSQuestion::DNSQuestion(InternalQueryState& ids_, PacketBuffer& data_) :
59
  data(data_), ids(ids_), ecsPrefixLength(ids.origRemote.sin4.sin_family == AF_INET ? dnsdist::configuration::getCurrentRuntimeConfiguration().d_ECSSourcePrefixV4 : dnsdist::configuration::getCurrentRuntimeConfiguration().d_ECSSourcePrefixV6), ecsOverride(dnsdist::configuration::getCurrentRuntimeConfiguration().d_ecsOverride)
2,475,064✔
60
{
2,475,064✔
61
}
2,475,064✔
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