_ZN27ConcurrentConnectionManagerC2Em:
   30|      4|  {
   31|      4|    setMaxConcurrentConnections(max);
   32|      4|  }
_ZN27ConcurrentConnectionManager27setMaxConcurrentConnectionsEm:
   35|      4|  {
   36|      4|    d_data.lock()->d_maxConcurrentConnections = max;
   37|      4|  }

_ZN17dnsheader_aligned15isMemoryAlignedEPKv:
  227|  2.65k|  {
  228|  2.65k|    return reinterpret_cast<uintptr_t>(mem) % sizeof(uint32_t) == 0; // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
  229|  2.65k|  }

_ZN7dnsdist16DNSPacketOverlayC2ERKNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   29|  2.98k|{
   30|  2.98k|  if (packet.size() < sizeof(dnsheader)) {
  ------------------
  |  Branch (30:7): [True: 0, False: 2.98k]
  ------------------
   31|      0|    throw std::runtime_error("Packet is too small for a DNS packet");
   32|      0|  }
   33|       |
   34|  2.98k|  memcpy(&d_header, packet.data(), sizeof(dnsheader));
   35|  2.98k|  uint64_t supposedRecordCount = ntohs(d_header.ancount) + ntohs(d_header.nscount) + ntohs(d_header.arcount);
   36|       |  // No need to reserve more memory for more records than the request can
   37|       |  // contain. We could try to be smarter and actually count the records
   38|       |  // by doing getDnsrecordheader and skip the payload in a loop, but all
   39|       |  // we really want here is to avoid reserving too much memory in case of
   40|       |  // maliciously high record counts.
   41|  2.98k|  auto reserveRecordCount = std::min(1 + ((packet.size() - sizeof(dnsheader)) / sizeof(dnsrecordheader)), static_cast<size_t>(supposedRecordCount));
   42|  2.98k|  d_records.reserve(reserveRecordCount);
   43|       |
   44|  2.98k|  try {
   45|  2.98k|    PacketReader reader(std::string_view(reinterpret_cast<const char*>(packet.data()), packet.size()));
   46|       |
   47|  8.55k|    for (uint16_t idx = 0; idx < ntohs(d_header.qdcount); ++idx) {
  ------------------
  |  Branch (47:28): [True: 5.57k, False: 2.98k]
  ------------------
   48|  5.57k|      reader.xfrName(d_qname);
   49|  5.57k|      reader.xfrType(d_qtype);
   50|  5.57k|      reader.xfrType(d_qclass);
   51|  5.57k|    }
   52|       |
   53|  65.5k|    for (uint64_t idx = 0; idx < supposedRecordCount; ++idx) {
  ------------------
  |  Branch (53:28): [True: 62.5k, False: 2.98k]
  ------------------
   54|  62.5k|      Record rec;
   55|  62.5k|      reader.xfrName(rec.d_name);
   56|  62.5k|      rec.d_place = idx < ntohs(d_header.ancount) ? DNSResourceRecord::ANSWER : (idx < (ntohs(d_header.ancount) + ntohs(d_header.nscount)) ? DNSResourceRecord::AUTHORITY : DNSResourceRecord::ADDITIONAL);
  ------------------
  |  Branch (56:21): [True: 14.0k, False: 48.4k]
  |  Branch (56:82): [True: 18.3k, False: 30.0k]
  ------------------
   57|  62.5k|      reader.xfrType(rec.d_type);
   58|  62.5k|      reader.xfrType(rec.d_class);
   59|  62.5k|      reader.xfr32BitInt(rec.d_ttl);
   60|  62.5k|      reader.xfr16BitInt(rec.d_contentLength);
   61|  62.5k|      rec.d_contentOffset = reader.getPosition();
   62|  62.5k|      reader.skip(rec.d_contentLength);
   63|  62.5k|      d_records.push_back(std::move(rec));
   64|  62.5k|    }
   65|  2.98k|  }
   66|  2.98k|  catch (const std::exception& e) {
   67|  2.38k|    throw std::runtime_error("Unable to parse DNS packet: " + std::string(e.what()));
   68|  2.38k|  }
   69|  2.98k|  catch (...) {
   70|      0|    throw std::runtime_error("Unable to parse DNS packet");
   71|      0|  }
   72|  2.98k|}
_ZN7dnsdist21changeNameInDNSPacketERNSt3__16vectorIh14noinit_adaptorINS0_9allocatorIhEEEEERK7DNSNameSA_:
   75|  2.38k|{
   76|  2.38k|  if (initialPacket.size() < sizeof(dnsheader)) {
  ------------------
  |  Branch (76:7): [True: 0, False: 2.38k]
  ------------------
   77|      0|    return false;
   78|      0|  }
   79|       |
   80|  2.38k|  PacketReader pr(std::string_view(reinterpret_cast<const char*>(initialPacket.data()), initialPacket.size()));
   81|       |
   82|  2.38k|  dnsheader dh;
   83|  2.38k|  memcpy(&dh, initialPacket.data(), sizeof(dh));
   84|  2.38k|  size_t idx = 0;
   85|  2.38k|  DNSName rrname;
   86|  2.38k|  uint16_t qdcount = ntohs(dh.qdcount);
   87|  2.38k|  uint16_t ancount = ntohs(dh.ancount);
   88|  2.38k|  uint16_t nscount = ntohs(dh.nscount);
   89|  2.38k|  uint16_t arcount = ntohs(dh.arcount);
   90|  2.38k|  uint16_t rrtype;
   91|  2.38k|  uint16_t rrclass;
   92|  2.38k|  string blob;
   93|       |
   94|  2.38k|  size_t recordsCount = ancount + nscount + arcount;
   95|  2.38k|  struct dnsrecordheader ah;
   96|       |
   97|  2.38k|  rrname = pr.getName();
   98|  2.38k|  if (rrname == from) {
  ------------------
  |  Branch (98:7): [True: 2.38k, False: 0]
  ------------------
   99|  2.38k|    rrname = to;
  100|  2.38k|  }
  101|       |
  102|  2.38k|  rrtype = pr.get16BitInt();
  103|  2.38k|  rrclass = pr.get16BitInt();
  104|       |
  105|  2.38k|  PacketBuffer newContent;
  106|  2.38k|  newContent.reserve(initialPacket.size());
  107|  2.38k|  GenericDNSPacketWriter<PacketBuffer> pw(newContent, rrname, rrtype, rrclass, dh.opcode);
  108|       |  /* we want to copy the flags and ID but not the counts since we recreate the records below */
  109|  2.38k|  pw.getHeader()->id = dh.id;
  110|  2.38k|  pw.getHeader()->qr = dh.qr;
  111|  2.38k|  pw.getHeader()->aa = dh.aa;
  112|  2.38k|  pw.getHeader()->tc = dh.tc;
  113|  2.38k|  pw.getHeader()->rd = dh.rd;
  114|  2.38k|  pw.getHeader()->ra = dh.ra;
  115|  2.38k|  pw.getHeader()->ad = dh.ad;
  116|  2.38k|  pw.getHeader()->cd = dh.cd;
  117|  2.38k|  pw.getHeader()->rcode = dh.rcode;
  118|       |
  119|       |  /* consume remaining qd if any, but do not copy it */
  120|  7.01k|  for (idx = 1; idx < qdcount; idx++) {
  ------------------
  |  Branch (120:17): [True: 4.62k, False: 2.38k]
  ------------------
  121|  4.62k|    rrname = pr.getName();
  122|  4.62k|    (void)pr.get16BitInt();
  123|  4.62k|    (void)pr.get16BitInt();
  124|  4.62k|  }
  125|       |
  126|  2.38k|  static const std::unordered_set<QType> nameOnlyTypes{QType::NS, QType::PTR, QType::CNAME, QType::DNAME};
  127|  2.38k|  static const std::unordered_set<QType> noNameTypes{QType::A, QType::AAAA, QType::DHCID, QType::TXT, QType::OPT, QType::HINFO, QType::DNSKEY, QType::CDNSKEY, QType::DS, QType::CDS, QType::DLV, QType::SSHFP, QType::KEY, QType::CERT, QType::TLSA, QType::SMIMEA, QType::OPENPGPKEY, QType::NSEC, QType::NSEC3, QType::CSYNC, QType::NSEC3PARAM, QType::LOC, QType::NID, QType::L32, QType::L64, QType::EUI48, QType::EUI64, QType::URI, QType::CAA};
  128|       |
  129|       |  /* copy AN, NS and AR */
  130|  74.7k|  for (idx = 0; idx < recordsCount; idx++) {
  ------------------
  |  Branch (130:17): [True: 73.7k, False: 966]
  ------------------
  131|  73.7k|    rrname = pr.getName();
  132|  73.7k|    if (rrname == from) {
  ------------------
  |  Branch (132:9): [True: 35.7k, False: 37.9k]
  ------------------
  133|  35.7k|      rrname = to;
  134|  35.7k|    }
  135|  73.7k|    pr.getDnsrecordheader(ah);
  136|       |
  137|  73.7k|    auto place = idx < ancount ? DNSResourceRecord::ANSWER : (idx < (ancount + nscount) ? DNSResourceRecord::AUTHORITY : DNSResourceRecord::ADDITIONAL);
  ------------------
  |  Branch (137:18): [True: 28.8k, False: 44.9k]
  |  Branch (137:63): [True: 20.0k, False: 24.8k]
  ------------------
  138|  73.7k|    pw.startRecord(rrname, ah.d_type, ah.d_ttl, ah.d_class, place, true);
  139|  73.7k|    if (nameOnlyTypes.count(ah.d_type)) {
  ------------------
  |  Branch (139:9): [True: 6.29k, False: 67.4k]
  ------------------
  140|  6.29k|      rrname = pr.getName();
  141|       |      // compression is not allowed for DNAME target per rfc6672 section 2.5
  142|  6.29k|      pw.xfrName(rrname, ah.d_type != QType::DNAME);
  143|  6.29k|    }
  144|  67.4k|    else if (noNameTypes.count(ah.d_type)) {
  ------------------
  |  Branch (144:14): [True: 34.1k, False: 33.3k]
  ------------------
  145|  34.1k|      pr.xfrBlob(blob);
  146|  34.1k|      pw.xfrBlob(blob);
  147|  34.1k|    }
  148|  33.3k|    else if (ah.d_type == QType::RRSIG) {
  ------------------
  |  Branch (148:14): [True: 3.51k, False: 29.8k]
  ------------------
  149|       |      /* good luck */
  150|  3.51k|      pr.xfrBlob(blob);
  151|  3.51k|      pw.xfrBlob(blob);
  152|  3.51k|    }
  153|  29.8k|    else if (ah.d_type == QType::MX) {
  ------------------
  |  Branch (153:14): [True: 1.65k, False: 28.2k]
  ------------------
  154|  1.65k|      auto prio = pr.get16BitInt();
  155|  1.65k|      rrname = pr.getName();
  156|  1.65k|      pw.xfr16BitInt(prio);
  157|  1.65k|      pw.xfrName(rrname, true);
  158|  1.65k|    }
  159|  28.2k|    else if (ah.d_type == QType::SOA) {
  ------------------
  |  Branch (159:14): [True: 1.27k, False: 26.9k]
  ------------------
  160|  1.27k|      auto mname = pr.getName();
  161|  1.27k|      pw.xfrName(mname, true);
  162|  1.27k|      auto rname = pr.getName();
  163|  1.27k|      pw.xfrName(rname, true);
  164|       |      /* serial */
  165|  1.27k|      pw.xfr32BitInt(pr.get32BitInt());
  166|       |      /* refresh */
  167|  1.27k|      pw.xfr32BitInt(pr.get32BitInt());
  168|       |      /* retry */
  169|  1.27k|      pw.xfr32BitInt(pr.get32BitInt());
  170|       |      /* expire */
  171|  1.27k|      pw.xfr32BitInt(pr.get32BitInt());
  172|       |      /* minimal */
  173|  1.27k|      pw.xfr32BitInt(pr.get32BitInt());
  174|  1.27k|    }
  175|  26.9k|    else if (ah.d_type == QType::SRV) {
  ------------------
  |  Branch (175:14): [True: 25.5k, False: 1.42k]
  ------------------
  176|       |      /* preference */
  177|  25.5k|      pw.xfr16BitInt(pr.get16BitInt());
  178|       |      /* weight */
  179|  25.5k|      pw.xfr16BitInt(pr.get16BitInt());
  180|       |      /* port */
  181|  25.5k|      pw.xfr16BitInt(pr.get16BitInt());
  182|  25.5k|      auto target = pr.getName();
  183|       |      /* Compression is not allowed per rfc2782:
  184|       |         "Unless and until permitted by future standards action,
  185|       |         name compression is not to be used for this field."
  186|       |      */
  187|  25.5k|      pw.xfrName(target, false);
  188|  25.5k|    }
  189|  1.42k|    else {
  190|       |      /* sorry, unsafe type */
  191|  1.42k|      return false;
  192|  1.42k|    }
  193|  73.7k|  }
  194|       |
  195|    966|  pw.commit();
  196|    966|  initialPacket = std::move(newContent);
  197|       |
  198|    966|  return true;
  199|  2.38k|}
_ZN7dnsdist14PacketMangling23editDNSHeaderFromPacketERNSt3__16vectorIh14noinit_adaptorINS1_9allocatorIhEEEEERKNS1_8functionIFbR9dnsheaderEEE:
  204|  2.65k|  {
  205|  2.65k|    if (packet.size() < sizeof(dnsheader)) {
  ------------------
  |  Branch (205:9): [True: 0, False: 2.65k]
  ------------------
  206|      0|      throw std::runtime_error("Trying to edit the DNS header of a too small packet");
  207|      0|    }
  208|       |
  209|  2.65k|    return editDNSHeaderFromRawPacket(packet.data(), editFunction);
  210|  2.65k|  }
_ZN7dnsdist14PacketMangling26editDNSHeaderFromRawPacketEPvRKNSt3__18functionIFbR9dnsheaderEEE:
  213|  2.65k|  {
  214|  2.65k|    if (dnsheader_aligned::isMemoryAligned(packet)) {
  ------------------
  |  Branch (214:9): [True: 2.65k, False: 0]
  ------------------
  215|       |      // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
  216|  2.65k|      auto* header = reinterpret_cast<dnsheader*>(packet);
  217|  2.65k|      return editFunction(*header);
  218|  2.65k|    }
  219|       |
  220|      0|    dnsheader header{};
  221|      0|    memcpy(&header, packet, sizeof(header));
  222|      0|    if (!editFunction(header)) {
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|      return false;
  224|      0|    }
  225|      0|    memcpy(packet, &header, sizeof(header));
  226|      0|    return true;
  227|      0|  }
_ZN7dnsdist14PacketMangling21restrictDNSPacketTTLsERNSt3__16vectorIh14noinit_adaptorINS1_9allocatorIhEEEEEjjRKNS1_13unordered_setI5QTypeNS1_4hashISA_EENS1_8equal_toISA_EENS4_ISA_EEEE:
  230|  5.30k|  {
  231|  5.30k|    auto visitor = [minimumValue, maximumValue, types](uint8_t section, uint16_t qclass, uint16_t qtype, uint32_t ttl) {
  232|  5.30k|      (void)section;
  233|  5.30k|      if (!types.empty() && qclass == QClass::IN && types.count(qtype) == 0) {
  234|  5.30k|        return ttl;
  235|  5.30k|      }
  236|       |
  237|  5.30k|      if (minimumValue > 0) {
  238|  5.30k|        if (ttl < minimumValue) {
  239|  5.30k|          ttl = minimumValue;
  240|  5.30k|        }
  241|  5.30k|      }
  242|  5.30k|      if (ttl > maximumValue) {
  243|  5.30k|        ttl = maximumValue;
  244|  5.30k|      }
  245|  5.30k|      return ttl;
  246|  5.30k|    };
  247|       |    // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
  248|  5.30k|    editDNSPacketTTL(reinterpret_cast<char*>(packet.data()), packet.size(), visitor);
  249|  5.30k|  }
_ZN7dnsdist13RecordParsers18parseAddressRecordERKNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERKNS_16DNSPacketOverlay6RecordE:
  289|  18.7k|  {
  290|  18.7k|    if (record.d_type == QType::A && record.d_contentLength == 4) {
  ------------------
  |  Branch (290:9): [True: 4.30k, False: 14.4k]
  |  Branch (290:38): [True: 412, False: 3.89k]
  ------------------
  291|       |      // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage): length is passed in and used to read data
  292|    412|      return makeComboAddressFromRaw(4, packet.substr(record.d_contentOffset, record.d_contentLength).data(), record.d_contentLength);
  293|    412|    }
  294|       |
  295|  18.3k|    if (record.d_type == QType::AAAA && record.d_contentLength == 16) {
  ------------------
  |  Branch (295:9): [True: 834, False: 17.5k]
  |  Branch (295:41): [True: 535, False: 299]
  ------------------
  296|       |      // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage): length is passed in and used to read data
  297|    535|      return makeComboAddressFromRaw(6, packet.substr(record.d_contentOffset, record.d_contentLength).data(), record.d_contentLength);
  298|    535|    }
  299|       |
  300|  17.8k|    return {};
  301|  18.3k|  }
_ZN7dnsdist13RecordParsers16parseCNAMERecordERKNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERKNS_16DNSPacketOverlay6RecordE:
  304|  18.7k|  {
  305|  18.7k|    if (record.d_type != QType::CNAME) {
  ------------------
  |  Branch (305:9): [True: 17.9k, False: 858]
  ------------------
  306|  17.9k|      return {};
  307|  17.9k|    }
  308|       |
  309|       |    // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage): length is passed in and used to read data
  310|    858|    return DNSName(packet.data(), record.d_contentOffset + record.d_contentLength, record.d_contentOffset, true);
  311|  18.7k|  }
dnsdist-dnsparser.cc:_ZZN7dnsdist14PacketMangling21restrictDNSPacketTTLsERNSt3__16vectorIh14noinit_adaptorINS1_9allocatorIhEEEEEjjRKNS1_13unordered_setI5QTypeNS1_4hashISA_EENS1_8equal_toISA_EENS4_ISA_EEEEENK3$_0clEhttj:
  231|   112k|    auto visitor = [minimumValue, maximumValue, types](uint8_t section, uint16_t qclass, uint16_t qtype, uint32_t ttl) {
  232|   112k|      (void)section;
  233|   112k|      if (!types.empty() && qclass == QClass::IN && types.count(qtype) == 0) {
  ------------------
  |  Branch (233:11): [True: 56.1k, False: 56.1k]
  |  Branch (233:11): [True: 1.00k, False: 111k]
  |  Branch (233:29): [True: 1.75k, False: 54.3k]
  |  Branch (233:53): [True: 1.00k, False: 743]
  ------------------
  234|  1.00k|        return ttl;
  235|  1.00k|      }
  236|       |
  237|   111k|      if (minimumValue > 0) {
  ------------------
  |  Branch (237:11): [True: 40.4k, False: 70.8k]
  ------------------
  238|  40.4k|        if (ttl < minimumValue) {
  ------------------
  |  Branch (238:13): [True: 12.2k, False: 28.2k]
  ------------------
  239|  12.2k|          ttl = minimumValue;
  240|  12.2k|        }
  241|  40.4k|      }
  242|   111k|      if (ttl > maximumValue) {
  ------------------
  |  Branch (242:11): [True: 71.8k, False: 39.4k]
  ------------------
  243|  71.8k|        ttl = maximumValue;
  244|  71.8k|      }
  245|   111k|      return ttl;
  246|   112k|    };

_ZN8DynBlockC2Ev:
   78|      4|  {
   79|      4|    until.tv_sec = 0;
   80|      4|    until.tv_nsec = 0;
   81|      4|  }

_ZN7dnsdist7metrics5StatsC2Ev:
   80|      2|  entries{std::vector<EntryTriple>{
   81|      2|    {"responses", "", &responses},
   82|      2|    {"servfail-responses", "", &servfailResponses},
   83|      2|    {"queries", "", &queries},
   84|      2|    {"frontend-nxdomain", "", &frontendNXDomain},
   85|      2|    {"frontend-servfail", "", &frontendServFail},
   86|      2|    {"frontend-noerror", "", &frontendNoError},
   87|      2|    {"acl-drops", "", &aclDrops},
   88|      2|    {"rule-drop", "", &ruleDrop},
   89|      2|    {"rule-nxdomain", "", &ruleNXDomain},
   90|      2|    {"rule-refused", "", &ruleRefused},
   91|      2|    {"rule-servfail", "", &ruleServFail},
   92|      2|    {"rule-truncated", "", &ruleTruncated},
   93|      2|    {"self-answered", "", &selfAnswered},
   94|      2|    {"downstream-timeouts", "", &downstreamTimeouts},
   95|      2|    {"downstream-send-errors", "", &downstreamSendErrors},
   96|      2|    {"trunc-failures", "", &truncFail},
   97|      2|    {"no-policy", "", &noPolicy},
   98|      2|    {"latency0-1", "", &latency0_1},
   99|      2|    {"latency1-10", "", &latency1_10},
  100|      2|    {"latency10-50", "", &latency10_50},
  101|      2|    {"latency50-100", "", &latency50_100},
  102|      2|    {"latency100-1000", "", &latency100_1000},
  103|      2|    {"latency-slow", "", &latencySlow},
  104|      2|    {"latency-avg100", "", &latencyAvg100},
  105|      2|    {"latency-avg1000", "", &latencyAvg1000},
  106|      2|    {"latency-avg10000", "", &latencyAvg10000},
  107|      2|    {"latency-avg1000000", "", &latencyAvg1000000},
  108|      2|    {"latency-tcp-avg100", "", &latencyTCPAvg100},
  109|      2|    {"latency-tcp-avg1000", "", &latencyTCPAvg1000},
  110|      2|    {"latency-tcp-avg10000", "", &latencyTCPAvg10000},
  111|      2|    {"latency-tcp-avg1000000", "", &latencyTCPAvg1000000},
  112|      2|    {"latency-dot-avg100", "", &latencyDoTAvg100},
  113|      2|    {"latency-dot-avg1000", "", &latencyDoTAvg1000},
  114|      2|    {"latency-dot-avg10000", "", &latencyDoTAvg10000},
  115|      2|    {"latency-dot-avg1000000", "", &latencyDoTAvg1000000},
  116|      2|    {"latency-doh-avg100", "", &latencyDoHAvg100},
  117|      2|    {"latency-doh-avg1000", "", &latencyDoHAvg1000},
  118|      2|    {"latency-doh-avg10000", "", &latencyDoHAvg10000},
  119|      2|    {"latency-doh-avg1000000", "", &latencyDoHAvg1000000},
  120|      2|    {"latency-doq-avg100", "", &latencyDoQAvg100},
  121|      2|    {"latency-doq-avg1000", "", &latencyDoQAvg1000},
  122|      2|    {"latency-doq-avg10000", "", &latencyDoQAvg10000},
  123|      2|    {"latency-doq-avg1000000", "", &latencyDoQAvg1000000},
  124|      2|    {"latency-doh3-avg100", "", &latencyDoH3Avg100},
  125|      2|    {"latency-doh3-avg1000", "", &latencyDoH3Avg1000},
  126|      2|    {"latency-doh3-avg10000", "", &latencyDoH3Avg10000},
  127|      2|    {"latency-doh3-avg1000000", "", &latencyDoH3Avg1000000},
  128|      2|    {"uptime", "", uptimeOfProcess},
  129|      2|    {"real-memory-usage", "", getRealMemoryUsage},
  130|      2|    {"special-memory-usage", "", getSpecialMemoryUsage},
  131|      2|    {"udp-in-errors", "", [](const std::string&) { return udpErrorStats("udp-in-errors"); }},
  132|      2|    {"udp-noport-errors", "", [](const std::string&) { return udpErrorStats("udp-noport-errors"); }},
  133|      2|    {"udp-recvbuf-errors", "", [](const std::string&) { return udpErrorStats("udp-recvbuf-errors"); }},
  134|      2|    {"udp-sndbuf-errors", "", [](const std::string&) { return udpErrorStats("udp-sndbuf-errors"); }},
  135|      2|    {"udp-in-csum-errors", "", [](const std::string&) { return udpErrorStats("udp-in-csum-errors"); }},
  136|      2|    {"udp6-in-errors", "", [](const std::string&) { return udp6ErrorStats("udp6-in-errors"); }},
  137|      2|    {"udp6-recvbuf-errors", "", [](const std::string&) { return udp6ErrorStats("udp6-recvbuf-errors"); }},
  138|      2|    {"udp6-sndbuf-errors", "", [](const std::string&) { return udp6ErrorStats("udp6-sndbuf-errors"); }},
  139|      2|    {"udp6-noport-errors", "", [](const std::string&) { return udp6ErrorStats("udp6-noport-errors"); }},
  140|      2|    {"udp6-in-csum-errors", "", [](const std::string&) { return udp6ErrorStats("udp6-in-csum-errors"); }},
  141|      2|    {"tcp-listen-overflows", "", [](const std::string&) { return tcpErrorStats("ListenOverflows"); }},
  142|      2|    {"noncompliant-queries", "", &nonCompliantQueries},
  143|      2|    {"noncompliant-responses", "", &nonCompliantResponses},
  144|      2|    {"proxy-protocol-invalid", "", &proxyProtocolInvalid},
  145|      2|    {"rdqueries", "", &rdQueries},
  146|      2|    {"empty-queries", "", &emptyQueries},
  147|      2|    {"cache-hits", "", &cacheHits},
  148|      2|    {"cache-misses", "", &cacheMisses},
  149|      2|    {"cpu-iowait", "", getCPUIOWait},
  150|      2|    {"cpu-steal", "", getCPUSteal},
  151|      2|    {"cpu-sys-msec", "", getCPUTimeSystem},
  152|      2|    {"cpu-user-msec", "", getCPUTimeUser},
  153|      2|    {"fd-usage", "", getOpenFileDescriptors},
  154|      2|    {"dyn-blocked", "", &dynBlocked},
  155|      2|#ifndef DISABLE_DYNBLOCKS
  156|      2|    {"dyn-block-nmg-size", "", [](const std::string&) { return dnsdist::DynamicBlocks::getClientAddressDynamicRules().size(); }},
  157|      2|#endif /* DISABLE_DYNBLOCKS */
  158|      2|    {"security-status", "", &securityStatus},
  159|      2|    {"doh-query-pipe-full", "", &dohQueryPipeFull},
  160|      2|    {"doh-response-pipe-full", "", &dohResponsePipeFull},
  161|      2|    {"doq-response-pipe-full", "", &doqResponsePipeFull},
  162|      2|    {"doh3-response-pipe-full", "", &doh3ResponsePipeFull},
  163|      2|    {"outgoing-doh-query-pipe-full", "", &outgoingDoHQueryPipeFull},
  164|      2|    {"tcp-query-pipe-full", "", &tcpQueryPipeFull},
  165|      2|    {"tcp-cross-protocol-query-pipe-full", "", &tcpCrossProtocolQueryPipeFull},
  166|      2|    {"tcp-cross-protocol-response-pipe-full", "", &tcpCrossProtocolResponsePipeFull},
  167|       |    // Latency histogram
  168|      2|    {"latency-sum", "", &latencySum},
  169|      2|    {"latency-count", "", &latencyCount},
  170|      2|  }}
  171|      2|{
  172|      2|}

_ZN16MetricDefinitionC2E20PrometheusMetricTypeRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_:
   51|    162|    description(_description), customName(customName_), prometheusType(_prometheusType)
   52|    162|  {
   53|    162|  }

_ZN7dnsdist10QueryCount13ConfigurationC2Ev:
   39|      2|  Configuration() = default;

_ZN7dnsdist3udp22UDPTCPCrossQuerySenderC2Ev:
   77|      2|  UDPTCPCrossQuerySender() = default;

_ZN7DNSNameC2ENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
   73|  2.42k|{
   74|  2.42k|  const char* p = sw.data();
   75|  2.42k|  size_t length = sw.length();
   76|       |
   77|  2.42k|  if(length == 0 || (length == 1 && p[0]=='.')) {
  ------------------
  |  Branch (77:6): [True: 0, False: 2.42k]
  |  Branch (77:22): [True: 6, False: 2.41k]
  |  Branch (77:37): [True: 4, False: 2]
  ------------------
   78|      4|    d_storage.assign(1, '\0');
   79|  2.41k|  } else {
   80|  2.41k|    if(!std::memchr(p, '\\', length)) {
  ------------------
  |  Branch (80:8): [True: 2.41k, False: 0]
  ------------------
   81|  2.41k|      unsigned char lenpos=0;
   82|  2.41k|      unsigned char labellen=0;
   83|  2.41k|      const char* const pbegin=p, *pend=p+length;
   84|       |
   85|  2.41k|      d_storage.reserve(length+1);
   86|  7.23k|      for(auto iter = pbegin; iter != pend; ) {
  ------------------
  |  Branch (86:31): [True: 4.81k, False: 2.41k]
  ------------------
   87|  4.81k|        lenpos = d_storage.size();
   88|  4.81k|        if(*iter=='.')
  ------------------
  |  Branch (88:12): [True: 0, False: 4.81k]
  ------------------
   89|      0|          throwSafeRangeError("Found . in wrong position in DNSName: ", p, length);
   90|  4.81k|        d_storage.append(1, '\0');
   91|  4.81k|        labellen=0;
   92|  4.81k|        auto begiter=iter;
   93|  87.5k|        for(; iter != pend && *iter!='.'; ++iter) {
  ------------------
  |  Branch (93:15): [True: 87.5k, False: 26]
  |  Branch (93:31): [True: 82.7k, False: 4.78k]
  ------------------
   94|  82.7k|          labellen++;
   95|  82.7k|        }
   96|  4.81k|        d_storage.append(begiter,iter);
   97|  4.81k|        if(iter != pend)
  ------------------
  |  Branch (97:12): [True: 4.78k, False: 26]
  ------------------
   98|  4.78k|          ++iter;
   99|  4.81k|        if(labellen > s_maxDNSLabelLength) {
  ------------------
  |  Branch (99:12): [True: 0, False: 4.81k]
  ------------------
  100|      0|          throwSafeRangeError("label too long to append: ", p, length);
  101|      0|        }
  102|       |
  103|  4.81k|        if(iter-pbegin > static_cast<ptrdiff_t>(s_maxDNSNameLength - 1)) // reserve two bytes, one for length and one for the root label
  ------------------
  |  Branch (103:12): [True: 0, False: 4.81k]
  ------------------
  104|      0|          throwSafeRangeError("name too long to append: ", p, length);
  105|       |
  106|  4.81k|        d_storage[lenpos]=labellen;
  107|  4.81k|      }
  108|  2.41k|      d_storage.append(1, '\0');
  109|  2.41k|    }
  110|      0|    else {
  111|      0|      d_storage=segmentDNSNameRaw(p, length);
  112|      0|      if(d_storage.size() > s_maxDNSNameLength) {
  ------------------
  |  Branch (112:10): [True: 0, False: 0]
  ------------------
  113|      0|        throwSafeRangeError("name too long: ", p, length);
  114|      0|      }
  115|      0|    }
  116|  2.41k|  }
  117|  2.42k|}
_ZN7DNSNameC2EPKcmmbPtS2_Pjt:
  120|   188k|{
  121|   188k|  if (offset >= len)
  ------------------
  |  Branch (121:7): [True: 658, False: 187k]
  ------------------
  122|    658|    throw std::range_error("Trying to read past the end of the buffer ("+std::to_string(offset)+ " >= "+std::to_string(len)+")");
  123|       |
  124|   187k|  if(!uncompress) {
  ------------------
  |  Branch (124:6): [True: 2.58k, False: 185k]
  ------------------
  125|  2.58k|    if(const void * fnd=memchr(pos+offset, 0, len-offset)) {
  ------------------
  |  Branch (125:21): [True: 2.48k, False: 97]
  ------------------
  126|  2.48k|      d_storage.reserve(2+(const char*)fnd-(pos+offset));
  127|  2.48k|    }
  128|  2.58k|  }
  129|       |
  130|   187k|  packetParser(pos, len, offset, uncompress, qtype, qclass, consumed, 0, minOffset);
  131|   187k|}
_ZN7DNSName23parsePacketUncompressedERKN4pdns5views16UnsignedCharViewEmb:
  145|   230k|{
  146|   230k|  const size_t initialPos = pos;
  147|   230k|  auto existingSize = d_storage.size();
  148|   230k|  const size_t neededSizeForFinalLabel = /* final empty label length */ (existingSize == 0 ? 1U : 0U);
  ------------------
  |  Branch (148:74): [True: 213k, False: 16.8k]
  ------------------
  149|   230k|  size_t totalLength = 0;
  150|   230k|  unsigned char labellen = 0;
  151|       |
  152|  2.26M|  do {
  153|  2.26M|    labellen = view.at(pos);
  154|  2.26M|    ++pos;
  155|       |
  156|  2.26M|    if (labellen == 0) {
  ------------------
  |  Branch (156:9): [True: 186k, False: 2.07M]
  ------------------
  157|   186k|      --pos;
  158|   186k|      break;
  159|   186k|    }
  160|       |
  161|  2.07M|    if (labellen >= 0xc0) {
  ------------------
  |  Branch (161:9): [True: 43.1k, False: 2.03M]
  ------------------
  162|  43.1k|      if (!uncompress) {
  ------------------
  |  Branch (162:11): [True: 93, False: 43.0k]
  ------------------
  163|     93|        throw std::range_error("Found compressed label, instructed not to follow");
  164|     93|      }
  165|  43.0k|      --pos;
  166|  43.0k|      break;
  167|  43.1k|    }
  168|       |
  169|  2.03M|    if ((labellen & 0xc0) != 0) {
  ------------------
  |  Branch (169:9): [True: 241, False: 2.03M]
  ------------------
  170|    241|      throw std::range_error("Found an invalid label length in qname (only one of the first two bits is set)");
  171|    241|    }
  172|  2.03M|    checkLabelLength(labellen);
  173|       |
  174|       |    // reserve one byte for the label length, plus one byte for the final empty label if we were empty before
  175|  2.03M|    if ((existingSize + totalLength + labellen + 1U + neededSizeForFinalLabel) > s_maxDNSNameLength) {
  ------------------
  |  Branch (175:9): [True: 47, False: 2.03M]
  ------------------
  176|     47|      throw std::range_error("name too long to append");
  177|     47|    }
  178|  2.03M|    if (pos + labellen >= view.size()) {
  ------------------
  |  Branch (178:9): [True: 231, False: 2.03M]
  ------------------
  179|    231|      throw std::range_error("Found an invalid label length in qname");
  180|    231|    }
  181|  2.03M|    pos += labellen;
  182|  2.03M|    totalLength += 1U + labellen;
  183|  2.03M|  }
  184|  2.03M|  while (pos < view.size());
  ------------------
  |  Branch (184:10): [True: 2.03M, False: 0]
  ------------------
  185|       |
  186|   229k|  if (totalLength != 0) {
  ------------------
  |  Branch (186:7): [True: 92.0k, False: 137k]
  ------------------
  187|  92.0k|    if (existingSize > 0) {
  ------------------
  |  Branch (187:9): [True: 15.2k, False: 76.7k]
  ------------------
  188|       |      // remove the last label count, we are about to override it */
  189|  15.2k|      --existingSize;
  190|  15.2k|    }
  191|  92.0k|    if ((existingSize + totalLength + 1U) > s_maxDNSNameLength) {
  ------------------
  |  Branch (191:9): [True: 0, False: 92.0k]
  ------------------
  192|      0|      throw std::range_error("name too long to append");
  193|      0|    }
  194|  92.0k|    d_storage.reserve(existingSize + totalLength + 1);
  195|  92.0k|    d_storage.resize(existingSize + totalLength);
  196|  92.0k|    memcpy(&d_storage.at(existingSize), &view.at(initialPos), totalLength);
  197|  92.0k|    d_storage.append(1, static_cast<char>(0));
  198|  92.0k|  }
  199|   229k|  return pos;
  200|   229k|}
_ZN7DNSName12packetParserEPKcmmbPtS2_Pjit:
  204|   230k|{
  205|   230k|  if (offset >= len) {
  ------------------
  |  Branch (205:7): [True: 0, False: 230k]
  ------------------
  206|      0|    throw std::range_error("Trying to read past the end of the buffer ("+std::to_string(offset)+ " >= "+std::to_string(len)+")");
  207|      0|  }
  208|       |
  209|   230k|  if (offset < static_cast<size_t>(minOffset)) {
  ------------------
  |  Branch (209:7): [True: 0, False: 230k]
  ------------------
  210|      0|    throw std::range_error("Trying to read before the beginning of the buffer ("+std::to_string(offset)+ " < "+std::to_string(minOffset)+")");
  211|      0|  }
  212|   230k|  unsigned char labellen{0};
  213|       |
  214|   230k|  pdns::views::UnsignedCharView view(qpos, len);
  215|   230k|  auto pos = parsePacketUncompressed(view, offset, uncompress);
  216|       |
  217|   230k|  labellen = view.at(pos);
  218|   230k|  pos++;
  219|   230k|  if (labellen != 0 && pos < view.size()) {
  ------------------
  |  Branch (219:7): [True: 43.0k, False: 187k]
  |  Branch (219:24): [True: 42.8k, False: 282]
  ------------------
  220|  42.8k|    if (labellen < 0xc0) {
  ------------------
  |  Branch (220:9): [True: 0, False: 42.8k]
  ------------------
  221|      0|      throw std::range_error("Invalid label byte during decompression ("+std::to_string(labellen)+")");
  222|      0|    }
  223|       |
  224|  42.8k|    if (!uncompress) {
  ------------------
  |  Branch (224:9): [True: 0, False: 42.8k]
  ------------------
  225|      0|      throw std::range_error("Found compressed label, instructed not to follow");
  226|      0|    }
  227|       |
  228|  42.8k|    labellen &= (~0xc0);
  229|  42.8k|    size_t newpos = (labellen << 8) + view.at(pos);
  230|       |
  231|  42.8k|    if (newpos >= offset) {
  ------------------
  |  Branch (231:9): [True: 337, False: 42.4k]
  ------------------
  232|    337|      throw std::range_error("Found a forward reference during label decompression");
  233|    337|    }
  234|       |
  235|  42.4k|    if (newpos < minOffset) {
  ------------------
  |  Branch (235:9): [True: 13, False: 42.4k]
  ------------------
  236|     13|      throw std::range_error("Invalid label position during decompression ("+std::to_string(newpos)+ " < "+std::to_string(minOffset)+")");
  237|     13|    }
  238|       |
  239|  42.4k|    if (++depth > 100) {
  ------------------
  |  Branch (239:9): [True: 0, False: 42.4k]
  ------------------
  240|      0|      throw std::range_error("Abort label decompression after 100 redirects");
  241|      0|    }
  242|       |
  243|  42.4k|    packetParser(qpos, len, newpos, true, nullptr, nullptr, nullptr, depth, minOffset);
  244|       |
  245|  42.4k|    pos++;
  246|  42.4k|  }
  247|       |
  248|   229k|  if (d_storage.empty()) {
  ------------------
  |  Branch (248:7): [True: 110k, False: 119k]
  ------------------
  249|   110k|    d_storage.append(1, static_cast<char>(0)); // we just parsed the root
  250|   110k|  }
  251|       |
  252|   229k|  if (consumed != nullptr) {
  ------------------
  |  Branch (252:7): [True: 185k, False: 43.9k]
  ------------------
  253|   185k|    *consumed = pos - offset;
  254|   185k|  }
  255|       |
  256|   229k|  if (qtype != nullptr) {
  ------------------
  |  Branch (256:7): [True: 0, False: 229k]
  ------------------
  257|      0|    if (pos + 2 > view.size()) {
  ------------------
  |  Branch (257:9): [True: 0, False: 0]
  ------------------
  258|      0|      throw std::range_error("Trying to read qtype past the end of the buffer ("+std::to_string(pos + 2)+ " > "+std::to_string(len)+")");
  259|      0|    }
  260|      0|    *qtype = view.at(pos)*256 + view.at(pos+1);
  261|      0|  }
  262|       |
  263|   229k|  pos += 2;
  264|   229k|  if (qclass != nullptr) {
  ------------------
  |  Branch (264:7): [True: 0, False: 229k]
  ------------------
  265|      0|    if (pos + 2 > view.size()) {
  ------------------
  |  Branch (265:9): [True: 0, False: 0]
  ------------------
  266|      0|      throw std::range_error("Trying to read qclass past the end of the buffer ("+std::to_string(pos + 2)+ " > "+std::to_string(len)+")");
  267|      0|    }
  268|      0|    *qclass = view.at(pos)*256 + view.at(pos+1);
  269|      0|  }
  270|   229k|}
_ZNK7DNSName10wirelengthEv:
  341|  2.28k|size_t DNSName::wirelength() const {
  342|  2.28k|  return d_storage.length();
  343|  2.28k|}
dnsname.cc:_ZL16checkLabelLengthh:
  134|  2.03M|{
  135|  2.03M|  if (length == 0) {
  ------------------
  |  Branch (135:7): [True: 0, False: 2.03M]
  ------------------
  136|      0|    throw std::range_error("no such thing as an empty label to append");
  137|      0|  }
  138|  2.03M|  if (length > DNSName::s_maxDNSLabelLength) {
  ------------------
  |  Branch (138:7): [True: 0, False: 2.03M]
  ------------------
  139|      0|    throw std::range_error("label too long to append");
  140|      0|  }
  141|  2.03M|}

_Z11dns_tolowerh:
   58|  3.18M|{
   59|  3.18M|  return dns_tolower_table[chr];
   60|  3.18M|}
_Z39pdns_ilexicographical_compare_three_wayNSt3__117basic_string_viewIcNS_11char_traitsIcEEEES3_:
   64|   106k|{
   65|   106k|  const unsigned char *aPtr = (const unsigned char*)a.data(), *bPtr = (const unsigned char*)b.data();
   66|   106k|  const unsigned char *aEptr = aPtr + a.length(), *bEptr = bPtr + b.length();
   67|   289k|  while(aPtr != aEptr && bPtr != bEptr) {
  ------------------
  |  Branch (67:9): [True: 217k, False: 71.4k]
  |  Branch (67:26): [True: 217k, False: 0]
  ------------------
   68|   217k|    if (*aPtr != *bPtr) {
  ------------------
  |  Branch (68:9): [True: 35.5k, False: 182k]
  ------------------
   69|  35.5k|      if (int rc = dns_tolower(*aPtr) - dns_tolower(*bPtr); rc != 0) {
  ------------------
  |  Branch (69:61): [True: 35.1k, False: 440]
  ------------------
   70|  35.1k|        return rc;
   71|  35.1k|      }
   72|  35.5k|    }
   73|   182k|    aPtr++;
   74|   182k|    bPtr++;
   75|   182k|  }
   76|       |  // At this point, one of the strings has been completely processed.
   77|       |  // Either both have the same length, and they are equal, or one of them
   78|       |  // is larger, and compares as higher.
   79|  71.4k|  if (aPtr == aEptr) {
  ------------------
  |  Branch (79:7): [True: 71.4k, False: 0]
  ------------------
   80|  71.4k|    if (bPtr != bEptr) {
  ------------------
  |  Branch (80:9): [True: 0, False: 71.4k]
  ------------------
   81|      0|      return -1; // a < b
   82|      0|    }
   83|  71.4k|  }
   84|      0|  else {
   85|      0|    return 1; // a > b
   86|      0|  }
   87|  71.4k|  return 0; // a == b
   88|  71.4k|}
_ZN7DNSNameaSERKS_:
  149|  38.1k|  {
  150|  38.1k|    if (this != &rhs) {
  ------------------
  |  Branch (150:9): [True: 38.1k, False: 0]
  ------------------
  151|  38.1k|      d_storage = rhs.d_storage;
  152|  38.1k|    }
  153|  38.1k|    return *this;
  154|  38.1k|  }
_ZN7DNSNameaSEOS_:
  156|   155k|  {
  157|   155k|    if (this != &rhs) {
  ------------------
  |  Branch (157:9): [True: 155k, False: 0]
  ------------------
  158|   155k|      d_storage = std::move(rhs.d_storage);
  159|   155k|    }
  160|   155k|    return *this;
  161|   155k|  }
_ZNK7DNSName5emptyEv:
  208|   369k|  bool empty() const { return d_storage.empty(); }
_ZNK7DNSName6isRootEv:
  209|   148k|  bool isRoot() const { return d_storage.size()==1 && d_storage[0]==0; }
  ------------------
  |  Branch (209:32): [True: 26.1k, False: 121k]
  |  Branch (209:55): [True: 26.1k, False: 0]
  ------------------
_ZNK7DNSName10getStorageEv:
  253|  90.3k|  const string_t& getStorage() const {
  254|  90.3k|    return d_storage;
  255|  90.3k|  }
_ZNK7DNSNameeqERKS_:
  818|   147k|{
  819|   147k|  if (rhs.empty() != empty() || rhs.d_storage.size() != d_storage.size()) {
  ------------------
  |  Branch (819:7): [True: 0, False: 147k]
  |  Branch (819:33): [True: 72.4k, False: 74.7k]
  ------------------
  820|  72.4k|    return false;
  821|  72.4k|  }
  822|       |
  823|  74.7k|  const auto* us = d_storage.cbegin();
  824|  74.7k|  const auto* p = rhs.d_storage.cbegin();
  825|  1.62M|  for (; us != d_storage.cend() && p != rhs.d_storage.cend(); ++us, ++p) {
  ------------------
  |  Branch (825:10): [True: 1.55M, False: 73.6k]
  |  Branch (825:36): [True: 1.55M, False: 0]
  ------------------
  826|  1.55M|    if (dns_tolower(*p) != dns_tolower(*us)) {
  ------------------
  |  Branch (826:9): [True: 1.05k, False: 1.55M]
  ------------------
  827|  1.05k|      return false;
  828|  1.05k|    }
  829|  1.55M|  }
  830|  73.6k|  return true;
  831|  74.7k|}
_ZN7DNSNameC2ERKS_:
  162|  2.28k|  DNSName(const DNSName& a) = default;
_ZN7DNSNameC2EOS_:
  163|  61.4k|  DNSName(DNSName&& a) = default;
_ZN7DNSNameC2Ev:
  146|  67.9k|  DNSName() = default; //!< Constructs an *empty* DNSName, NOT the root!
_ZN15SuffixMatchTreeI8DynBlockEC2ENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEb:
  457|      2|    d_name(std::move(name)), endNode(endNode_)
  458|      2|  {}

_ZN12PacketReader18getDnsrecordheaderER15dnsrecordheader:
  469|  73.1k|{
  470|  73.1k|  unsigned char *p = reinterpret_cast<unsigned char*>(&ah);
  471|       |
  472|   803k|  for(unsigned int n = 0; n < sizeof(dnsrecordheader); ++n) {
  ------------------
  |  Branch (472:27): [True: 729k, False: 73.1k]
  ------------------
  473|   729k|    p[n] = d_content.at(d_pos++);
  474|   729k|  }
  475|       |
  476|  73.1k|  ah.d_type = ntohs(ah.d_type);
  477|  73.1k|  ah.d_class = ntohs(ah.d_class);
  478|  73.1k|  ah.d_clen = ntohs(ah.d_clen);
  479|  73.1k|  ah.d_ttl = ntohl(ah.d_ttl);
  480|       |
  481|  73.1k|  d_startrecordpos = d_pos; // needed for getBlob later on
  482|  73.1k|  d_recordlen = ah.d_clen;
  483|  73.1k|  if (d_pos > d_content.size() || (d_content.size() - d_pos) < (d_recordlen)) {
  ------------------
  |  Branch (483:7): [True: 302, False: 72.8k]
  |  Branch (483:35): [True: 129, False: 72.7k]
  ------------------
  484|    129|    throw std::out_of_range("DNS record length (" + std::to_string(d_recordlen) + " starting at " + std::to_string(d_pos) + ") goes beyond the packet's content (" + std::to_string(d_content.size()) + ")");
  485|    129|  }
  486|  73.1k|}
_ZN12PacketReader11get32BitIntEv:
  541|  67.7k|{
  542|  67.7k|  uint32_t ret=0;
  543|  67.7k|  ret+=static_cast<uint8_t>(d_content.at(d_pos++));
  544|  67.7k|  ret<<=8;
  545|  67.7k|  ret+=static_cast<uint8_t>(d_content.at(d_pos++));
  546|  67.7k|  ret<<=8;
  547|  67.7k|  ret+=static_cast<uint8_t>(d_content.at(d_pos++));
  548|  67.7k|  ret<<=8;
  549|  67.7k|  ret+=static_cast<uint8_t>(d_content.at(d_pos++));
  550|       |
  551|  67.7k|  return ret;
  552|  67.7k|}
_ZN12PacketReader11get16BitIntEv:
  556|   288k|{
  557|   288k|  uint16_t ret=0;
  558|   288k|  ret+=static_cast<uint8_t>(d_content.at(d_pos++));
  559|   288k|  ret<<=8;
  560|   288k|  ret+=static_cast<uint8_t>(d_content.at(d_pos++));
  561|       |
  562|   288k|  return ret;
  563|   288k|}
_ZN12PacketReader7getNameEv:
  571|   184k|{
  572|   184k|  unsigned int consumed;
  573|   184k|  try {
  574|   184k|    uint16_t minOffset = d_standalone ? 0 : sizeof(dnsheader);
  ------------------
  |  Branch (574:26): [True: 0, False: 184k]
  ------------------
  575|   184k|    bool uncompress = !d_standalone;
  576|   184k|    DNSName name((const char*) d_content.data(), d_content.size(), d_pos, uncompress, nullptr /* qtype */, nullptr /* qclass */, &consumed, minOffset);
  577|       |
  578|   184k|    d_pos+=consumed;
  579|   184k|    return name;
  580|   184k|  }
  581|   184k|  catch(const std::range_error& re) {
  582|  1.33k|    throw std::out_of_range(string("dnsname issue: ")+re.what());
  583|  1.33k|  }
  584|   184k|  catch(...) {
  585|      0|    throw std::out_of_range("dnsname issue");
  586|      0|  }
  587|   184k|}
_ZN12PacketReader7xfrBlobERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  686|  37.6k|{
  687|  37.6k|  try {
  688|  37.6k|    if(d_recordlen && !(d_pos == (d_startrecordpos + d_recordlen))) {
  ------------------
  |  Branch (688:8): [True: 27.2k, False: 10.3k]
  |  Branch (688:23): [True: 27.2k, False: 0]
  ------------------
  689|  27.2k|      if (d_pos > (d_startrecordpos + d_recordlen)) {
  ------------------
  |  Branch (689:11): [True: 0, False: 27.2k]
  ------------------
  690|      0|        throw std::out_of_range("xfrBlob out of record range");
  691|      0|      }
  692|  27.2k|      blob.assign(&d_content.at(d_pos), &d_content.at(d_startrecordpos + d_recordlen - 1 ) + 1);
  693|  27.2k|    }
  694|  10.3k|    else {
  695|  10.3k|      blob.clear();
  696|  10.3k|    }
  697|       |
  698|  37.6k|    d_pos = d_startrecordpos + d_recordlen;
  699|  37.6k|  }
  700|  37.6k|  catch(...)
  701|  37.6k|  {
  702|      0|    throw std::out_of_range("xfrBlob out of range");
  703|      0|  }
  704|  37.6k|}
_Z16editDNSPacketTTLPcmRKNSt3__18functionIFjhttjEEE:
  907|  5.30k|{
  908|  5.30k|  if(length < sizeof(dnsheader))
  ------------------
  |  Branch (908:6): [True: 0, False: 5.30k]
  ------------------
  909|      0|    return;
  910|  5.30k|  try
  911|  5.30k|  {
  912|  5.30k|    dnsheader dh;
  913|  5.30k|    memcpy((void*)&dh, (const dnsheader*)packet, sizeof(dh));
  914|  5.30k|    uint64_t numrecords = ntohs(dh.ancount) + ntohs(dh.nscount) + ntohs(dh.arcount);
  915|  5.30k|    DNSPacketMangler dpm(packet, length);
  916|       |
  917|  5.30k|    uint64_t n;
  918|  56.5k|    for(n=0; n < ntohs(dh.qdcount) ; ++n) {
  ------------------
  |  Branch (918:14): [True: 51.2k, False: 5.30k]
  ------------------
  919|  51.2k|      dpm.skipDomainName();
  920|       |      /* type and class */
  921|  51.2k|      dpm.skipBytes(4);
  922|  51.2k|    }
  923|       |
  924|   118k|    for(n=0; n < numrecords; ++n) {
  ------------------
  |  Branch (924:14): [True: 113k, False: 5.28k]
  ------------------
  925|   113k|      dpm.skipDomainName();
  926|       |
  927|   113k|      uint8_t section = n < ntohs(dh.ancount) ? 1 : (n < (ntohs(dh.ancount) + ntohs(dh.nscount)) ? 2 : 3);
  ------------------
  |  Branch (927:25): [True: 28.1k, False: 85.2k]
  |  Branch (927:54): [True: 21.3k, False: 63.8k]
  ------------------
  928|   113k|      uint16_t dnstype = dpm.get16BitInt();
  929|   113k|      uint16_t dnsclass = dpm.get16BitInt();
  930|       |
  931|   113k|      if(dnstype == QType::OPT) // not getting near that one with a stick
  ------------------
  |  Branch (931:10): [True: 18, False: 113k]
  ------------------
  932|     18|        break;
  933|       |
  934|   113k|      uint32_t dnsttl = dpm.get32BitInt();
  935|   113k|      uint32_t newttl = visitor(section, dnsclass, dnstype, dnsttl);
  936|   113k|      if (newttl) {
  ------------------
  |  Branch (936:11): [True: 94.0k, False: 19.4k]
  ------------------
  937|  94.0k|        dpm.rewindBytes(sizeof(newttl));
  938|  94.0k|        dpm.setAndSkip32BitInt(newttl);
  939|  94.0k|      }
  940|   113k|      dpm.skipRData();
  941|   113k|    }
  942|  5.30k|  }
  943|  5.30k|  catch(...)
  944|  5.30k|  {
  945|  4.74k|    return;
  946|  4.74k|  }
  947|  5.30k|}

_ZN12PacketReaderC2ERKNSt3__117basic_string_viewIcNS0_11char_traitsIcEEEEtbb:
   72|  5.36k|    : d_pos(initialPos), d_startrecordpos(initialPos), d_internal(internalRepresentation), d_standalone(standalone), d_content(content)
   73|  5.36k|  {
   74|  5.36k|    if(content.size() > std::numeric_limits<uint16_t>::max())
  ------------------
  |  Branch (74:8): [True: 0, False: 5.36k]
  ------------------
   75|      0|      throw std::out_of_range("packet too large");
   76|       |
   77|  5.36k|    d_recordlen = (uint16_t) content.size();
   78|  5.36k|  }
_ZN12PacketReader11xfr32BitIntERj:
   88|  61.9k|  {
   89|  61.9k|    val=get32BitInt();
   90|  61.9k|  }
_ZN12PacketReader11xfr16BitIntERt:
  123|   196k|  {
  124|   196k|    val=get16BitInt();
  125|   196k|  }
_ZN12PacketReader7xfrTypeERt:
  128|   134k|  {
  129|   134k|    xfr16BitInt(val);
  130|   134k|  }
_ZN12PacketReader7xfrNameER7DNSNameb:
  139|  68.1k|  {
  140|  68.1k|    name = getName();
  141|  68.1k|  }
_ZNK12PacketReader11getPositionEv:
  193|  61.5k|  {
  194|  61.5k|    return d_pos;
  195|  61.5k|  }
_ZN12PacketReader4skipEt:
  198|  61.5k|  {
  199|  61.5k|    size_t stop = d_pos;
  200|  61.5k|    stop += n;
  201|  61.5k|    if (stop > d_content.size()) {
  ------------------
  |  Branch (201:9): [True: 1.01k, False: 60.5k]
  ------------------
  202|  1.01k|      throw std::out_of_range("Attempt to skip bytes (" + std::to_string(n) + " starting at " + std::to_string(d_pos) + ") farther than the packet's end (" + std::to_string(d_content.size()) + ")");
  203|  1.01k|    }
  204|  60.5k|    d_pos += n;
  205|  60.5k|  }
_ZN16DNSPacketManglerC2EPcm:
  588|  5.30k|    : d_packet(packet), d_length(length), d_notyouroffset(12), d_offset(d_notyouroffset)
  589|  5.30k|  {}
_ZN16DNSPacketMangler14skipDomainNameEv:
  596|   164k|  {
  597|   164k|    uint8_t len;
  598|   287k|    while((len=get8BitInt())) {
  ------------------
  |  Branch (598:11): [True: 164k, False: 123k]
  ------------------
  599|   164k|      if(len >= 0xc0) { // extended label
  ------------------
  |  Branch (599:10): [True: 41.5k, False: 123k]
  ------------------
  600|  41.5k|        get8BitInt();
  601|  41.5k|        return;
  602|  41.5k|      }
  603|   123k|      skipBytes(len);
  604|   123k|    }
  605|   164k|  }
_ZN16DNSPacketMangler9skipBytesEt:
  608|   174k|  {
  609|   174k|    moveOffset(bytes);
  610|   174k|  }
_ZN16DNSPacketMangler11rewindBytesEt:
  612|  94.0k|  {
  613|  94.0k|    rewindOffset(by);
  614|  94.0k|  }
_ZN16DNSPacketMangler11get32BitIntEv:
  616|   112k|  {
  617|   112k|    const char* p = d_packet + d_offset;
  618|   112k|    moveOffset(4);
  619|   112k|    uint32_t ret;
  620|   112k|    memcpy(&ret, p, sizeof(ret));
  621|       |    return ntohl(ret);
  622|   112k|  }
_ZN16DNSPacketMangler11get16BitIntEv:
  624|   337k|  {
  625|   337k|    const char* p = d_packet + d_offset;
  626|   337k|    moveOffset(2);
  627|   337k|    uint16_t ret;
  628|   337k|    memcpy(&ret, p, sizeof(ret));
  629|       |    return ntohs(ret);
  630|   337k|  }
_ZN16DNSPacketMangler10get8BitIntEv:
  633|   329k|  {
  634|   329k|    const char* p = d_packet + d_offset;
  635|   329k|    moveOffset(1);
  636|   329k|    return *p;
  637|   329k|  }
_ZN16DNSPacketMangler9skipRDataEv:
  640|   112k|  {
  641|   112k|    auto toskip = get16BitInt();
  642|   112k|    moveOffset(toskip);
  643|   112k|  }
_ZN16DNSPacketMangler18setAndSkip32BitIntEj:
  672|  94.0k|  {
  673|  94.0k|    moveOffset(4);
  674|       |
  675|       |    value = htonl(value);
  676|  94.0k|    memcpy(d_packet + d_offset-4, (const char*)&value, sizeof(value));
  677|  94.0k|  }
_ZN16DNSPacketMangler10moveOffsetEt:
  710|  1.15M|  {
  711|  1.15M|    d_notyouroffset += by;
  712|  1.15M|    if(d_notyouroffset > d_length)
  ------------------
  |  Branch (712:8): [True: 4.74k, False: 1.15M]
  ------------------
  713|  4.74k|      throw std::out_of_range("dns packet out of range: "+std::to_string(d_notyouroffset) +" > "
  714|  4.74k|      + std::to_string(d_length) );
  715|  1.15M|  }
_ZN16DNSPacketMangler12rewindOffsetEt:
  718|  94.0k|  {
  719|  94.0k|    if(d_notyouroffset < by)
  ------------------
  |  Branch (719:8): [True: 0, False: 94.0k]
  ------------------
  720|      0|      throw std::out_of_range("Rewinding dns packet out of range: "+std::to_string(d_notyouroffset) +" < "
  721|      0|                              + std::to_string(by));
  722|  94.0k|    d_notyouroffset -= by;
  723|  94.0k|    if(d_notyouroffset < 12)
  ------------------
  |  Branch (723:8): [True: 0, False: 94.0k]
  ------------------
  724|      0|      throw std::out_of_range("Rewinding dns packet out of range: "+std::to_string(d_notyouroffset) +" < "
  725|      0|                              + std::to_string(12));
  726|  94.0k|  }

_ZN22GenericDNSPacketWriterINSt3__16vectorIh14noinit_adaptorINS0_9allocatorIhEEEEEEC2ERS6_RK7DNSNametth:
   43|  2.28k|  d_qname(qname), d_content(content)
   44|  2.28k|{
   45|  2.28k|  d_content.clear();
   46|  2.28k|  dnsheader dnsheader;
   47|       |
   48|  2.28k|  memset(&dnsheader, 0, sizeof(dnsheader));
   49|  2.28k|  dnsheader.id=0;
   50|  2.28k|  dnsheader.qdcount=htons(1);
   51|  2.28k|  dnsheader.opcode=opcode;
   52|       |
   53|  2.28k|  const uint8_t* ptr=(const uint8_t*)&dnsheader;
   54|  2.28k|  d_content.reserve(sizeof(dnsheader) + qname.wirelength() + sizeof(qtype) + sizeof(qclass));
   55|  2.28k|  d_content.resize(sizeof(dnsheader));
   56|  2.28k|  uint8_t* dptr=(&*d_content.begin());
   57|       |
   58|  2.28k|  memcpy(dptr, ptr, sizeof(dnsheader));
   59|  2.28k|  d_namepositions.reserve(16);
   60|  2.28k|  xfrName(qname, false);
   61|  2.28k|  xfr16BitInt(qtype);
   62|  2.28k|  xfr16BitInt(qclass);
   63|       |
   64|  2.28k|  if (d_content.size() > std::numeric_limits<decltype(d_truncatemarker)>::max()) {
  ------------------
  |  Branch (64:7): [True: 0, False: 2.28k]
  ------------------
   65|      0|    throw std::range_error("Trying to build a packet larger than " + std::to_string(std::numeric_limits<decltype(d_truncatemarker)>::max()) + " bytes");
   66|      0|  }
   67|  2.28k|  d_truncatemarker = d_content.size();
   68|  2.28k|}
_ZN22GenericDNSPacketWriterINSt3__16vectorIh14noinit_adaptorINS0_9allocatorIhEEEEEE11startRecordERK7DNSNametjtN17DNSResourceRecord5PlaceEb:
   77|  72.7k|{
   78|  72.7k|  d_compress = compress;
   79|  72.7k|  commit();
   80|  72.7k|  if (d_content.size() > std::numeric_limits<decltype(d_rollbackmarker)>::max()) {
  ------------------
  |  Branch (80:7): [True: 0, False: 72.7k]
  ------------------
   81|      0|    throw std::range_error("Trying to build a packet larger than " + std::to_string(std::numeric_limits<decltype(d_rollbackmarker)>::max()) + " bytes");
   82|      0|  }
   83|  72.7k|  d_rollbackmarker = d_content.size();
   84|       |
   85|  72.7k|  if (compress && !name.isRoot() && d_qname==name) {  // don't do the whole label compression thing if we *know* we can get away with "see question" - except when compressing the root
  ------------------
  |  Branch (85:7): [True: 72.7k, False: 30]
  |  Branch (85:19): [True: 71.6k, False: 1.12k]
  |  Branch (85:37): [True: 35.5k, False: 36.1k]
  ------------------
   86|  35.5k|    static const std::array<unsigned char, 2> marker{0xc0, 0x0c};
   87|  35.5k|    d_content.insert(d_content.end(), reinterpret_cast<const char *>(marker.begin()), reinterpret_cast<const char *>(marker.end()));
   88|  35.5k|  }
   89|  37.2k|  else {
   90|  37.2k|    xfrName(name, compress);
   91|  37.2k|  }
   92|  72.7k|  xfr16BitInt(qtype);
   93|  72.7k|  xfr16BitInt(qclass);
   94|  72.7k|  xfr32BitInt(ttl);
   95|  72.7k|  xfr16BitInt(0); // this will be the record size
   96|  72.7k|  d_recordplace = place;
   97|       |
   98|  72.7k|  d_sor = d_content.size(); // this will remind us where to stuff the record size
   99|  72.7k|}
_ZN22GenericDNSPacketWriterINSt3__16vectorIh14noinit_adaptorINS0_9allocatorIhEEEEEE6commitEv:
  574|  73.0k|{
  575|  73.0k|  if (d_sor == 0) {
  ------------------
  |  Branch (575:7): [True: 1.73k, False: 71.3k]
  ------------------
  576|  1.73k|    return;
  577|  1.73k|  }
  578|       |
  579|  71.3k|  if (d_sor < 2 || d_sor > d_content.size()) {
  ------------------
  |  Branch (579:7): [True: 0, False: 71.3k]
  |  Branch (579:20): [True: 0, False: 71.3k]
  ------------------
  580|      0|    throw std::range_error("Invalid start of record when trying to build a packet: " + std::to_string(d_sor) + " / " + std::to_string(d_content.size()));
  581|      0|  }
  582|       |
  583|  71.3k|  if (d_content.size() > std::numeric_limits<uint16_t>::max()) {
  ------------------
  |  Branch (583:7): [True: 31, False: 71.3k]
  ------------------
  584|     31|    throw std::range_error("Trying to build a packet larger than " + std::to_string(std::numeric_limits<uint16_t>::max()) + " bytes");
  585|     31|  }
  586|       |
  587|  71.3k|  uint16_t rlen = d_content.size() - d_sor;
  588|  71.3k|  d_content.at(d_sor-2) = rlen >> 8;
  589|  71.3k|  d_content.at(d_sor-1) = rlen & 0xff;
  590|  71.3k|  d_sor = 0;
  591|  71.3k|  auto* dh = reinterpret_cast<dnsheader*>( &*d_content.begin());
  592|  71.3k|  switch(d_recordplace) {
  ------------------
  |  Branch (592:10): [True: 71.3k, False: 0]
  ------------------
  593|      0|  case DNSResourceRecord::QUESTION:
  ------------------
  |  Branch (593:3): [True: 0, False: 71.3k]
  ------------------
  594|      0|    dh->qdcount = htons(ntohs(dh->qdcount) + 1);
  595|      0|    break;
  596|  27.9k|  case DNSResourceRecord::ANSWER:
  ------------------
  |  Branch (596:3): [True: 27.9k, False: 43.4k]
  ------------------
  597|  27.9k|    dh->ancount = htons(ntohs(dh->ancount) + 1);
  598|  27.9k|    break;
  599|  19.6k|  case DNSResourceRecord::AUTHORITY:
  ------------------
  |  Branch (599:3): [True: 19.6k, False: 51.6k]
  ------------------
  600|  19.6k|    dh->nscount = htons(ntohs(dh->nscount) + 1);
  601|  19.6k|    break;
  602|  23.7k|  case DNSResourceRecord::ADDITIONAL:
  ------------------
  |  Branch (602:3): [True: 23.7k, False: 47.5k]
  ------------------
  603|  23.7k|    dh->arcount = htons(ntohs(dh->arcount) + 1);
  604|  23.7k|    break;
  605|  71.3k|  }
  606|       |
  607|  71.3k|}
_ZN22GenericDNSPacketWriterINSt3__16vectorIh14noinit_adaptorINS0_9allocatorIhEEEEEE11xfr32BitIntEm:
  155|  78.3k|{
  156|  78.3k|  if (val > std::numeric_limits<uint32_t>::max()) {
  ------------------
  |  Branch (156:7): [True: 0, False: 78.3k]
  ------------------
  157|      0|    throw runtime_error("Value too large to fit in 32 bits");
  158|      0|  }
  159|  78.3k|  uint32_t rval=htonl(static_cast<uint32_t>(val));
  160|  78.3k|  uint8_t* ptr=reinterpret_cast<uint8_t*>(&rval);
  161|  78.3k|  d_content.insert(d_content.end(), ptr, ptr+4);
  162|  78.3k|}
_ZN22GenericDNSPacketWriterINSt3__16vectorIh14noinit_adaptorINS0_9allocatorIhEEEEEE11xfr16BitIntEm:
  165|   300k|{
  166|   300k|  if (val > std::numeric_limits<uint16_t>::max()) {
  ------------------
  |  Branch (166:7): [True: 0, False: 300k]
  ------------------
  167|      0|    throw runtime_error("Value too large to fit in 16 bits");
  168|      0|  }
  169|   300k|  uint16_t rval=htons(static_cast<uint16_t>(val));
  170|   300k|  uint8_t* ptr=reinterpret_cast<uint8_t*>(&rval);
  171|   300k|  d_content.insert(d_content.end(), ptr, ptr+2);
  172|   300k|}
_ZN22GenericDNSPacketWriterINSt3__16vectorIh14noinit_adaptorINS0_9allocatorIhEEEEEE7xfrNameERK7DNSNameb:
  395|  75.3k|{
  396|  75.3k|  if(l_verbose)
  ------------------
  |  Branch (396:6): [Folded, False: 75.3k]
  ------------------
  397|      0|    cout<<"Wants to write "<<name<<", compress="<<compress<<", canonic="<<d_canonic<<", LC="<<d_lowerCase<<endl;
  398|  75.3k|  if(d_canonic || d_lowerCase)   // d_lowerCase implies canonic
  ------------------
  |  Branch (398:6): [True: 0, False: 75.3k]
  |  Branch (398:19): [True: 0, False: 75.3k]
  ------------------
  399|      0|    compress=false;
  400|       |
  401|  75.3k|  if(name.empty() || name.isRoot()) { // for speed
  ------------------
  |  Branch (401:6): [True: 0, False: 75.3k]
  |  Branch (401:22): [True: 24.9k, False: 50.3k]
  ------------------
  402|  24.9k|    d_content.push_back(0);
  403|  24.9k|    return;
  404|  24.9k|  }
  405|       |
  406|  50.3k|  uint16_t li=0;
  407|  50.3k|  uint16_t matchlen=0;
  408|  50.3k|  if(d_compress && compress && (li=lookupName(name, &matchlen)) && li < maxCompressionOffset) {
  ------------------
  |  Branch (408:6): [True: 48.0k, False: 2.28k]
  |  Branch (408:20): [True: 39.9k, False: 8.10k]
  |  Branch (408:32): [True: 11.7k, False: 28.1k]
  |  Branch (408:68): [True: 11.7k, False: 0]
  ------------------
  409|  11.7k|    const auto& dns=name.getStorage();
  410|  11.7k|    if(l_verbose)
  ------------------
  |  Branch (410:8): [Folded, False: 11.7k]
  ------------------
  411|      0|      cout<<"Found a substring of "<<matchlen<<" bytes from the back, offset: "<<li<<", dnslen: "<<dns.size()<<endl;
  412|       |    // found a substring, if www.powerdns.com matched powerdns.com, we get back matchlen = 13
  413|       |
  414|  11.7k|    unsigned int pos=d_content.size();
  415|  11.7k|    if(pos < maxCompressionOffset && matchlen != dns.size()) {
  ------------------
  |  Branch (415:8): [True: 8.66k, False: 3.11k]
  |  Branch (415:38): [True: 1.21k, False: 7.45k]
  ------------------
  416|  1.21k|      if(l_verbose)
  ------------------
  |  Branch (416:10): [Folded, False: 1.21k]
  ------------------
  417|      0|        cout<<"Inserting pos "<<pos<<" for "<<name<<" for compressed case"<<endl;
  418|  1.21k|      d_namepositions.push_back(pos);
  419|  1.21k|    }
  420|       |
  421|  11.7k|    if(l_verbose)
  ------------------
  |  Branch (421:8): [Folded, False: 11.7k]
  ------------------
  422|      0|      cout<<"Going to write unique part: '"<<makeHexDump(string(dns.c_str(), dns.c_str() + dns.size() - matchlen)) <<"'"<<endl;
  423|  11.7k|    d_content.insert(d_content.end(), (const unsigned char*)dns.c_str(), (const unsigned char*)dns.c_str() + dns.size() - matchlen);
  424|  11.7k|    uint16_t offset=li;
  425|  11.7k|    offset|=0xc000;
  426|       |
  427|  11.7k|    d_content.push_back((char)(offset >> 8));
  428|  11.7k|    d_content.push_back((char)(offset & 0xff));
  429|  11.7k|  }
  430|  38.5k|  else {
  431|  38.5k|    unsigned int pos=d_content.size();
  432|  38.5k|    if(l_verbose)
  ------------------
  |  Branch (432:8): [Folded, False: 38.5k]
  ------------------
  433|      0|      cout<<"Found nothing, we are at pos "<<pos<<", inserting whole name"<<endl;
  434|  38.5k|    if(pos < maxCompressionOffset) {
  ------------------
  |  Branch (434:8): [True: 22.0k, False: 16.5k]
  ------------------
  435|  22.0k|      if(l_verbose)
  ------------------
  |  Branch (435:10): [Folded, False: 22.0k]
  ------------------
  436|      0|        cout<<"Inserting pos "<<pos<<" for "<<name<<" for uncompressed case"<<endl;
  437|  22.0k|      d_namepositions.push_back(pos);
  438|  22.0k|    }
  439|       |
  440|  38.5k|    std::unique_ptr<DNSName> lc;
  441|  38.5k|    if(d_lowerCase)
  ------------------
  |  Branch (441:8): [True: 0, False: 38.5k]
  ------------------
  442|      0|      lc = make_unique<DNSName>(name.makeLowerCase());
  443|       |
  444|  38.5k|    const DNSName::string_t& raw = (lc ? *lc : name).getStorage();
  ------------------
  |  Branch (444:37): [True: 0, False: 38.5k]
  ------------------
  445|  38.5k|    if(l_verbose)
  ------------------
  |  Branch (445:8): [Folded, False: 38.5k]
  ------------------
  446|      0|      cout<<"Writing out the whole thing "<<makeHexDump(string(raw.c_str(),  raw.c_str() + raw.length()))<<endl;
  447|  38.5k|    d_content.insert(d_content.end(), raw.c_str(), raw.c_str() + raw.size());
  448|  38.5k|  }
  449|  50.3k|}
_ZN22GenericDNSPacketWriterINSt3__16vectorIh14noinit_adaptorINS0_9allocatorIhEEEEEE7xfrBlobERKNS0_12basic_stringIcNS0_11char_traitsIcEENS3_IcEEEEi:
  452|  37.6k|{
  453|  37.6k|  const uint8_t* ptr=reinterpret_cast<const uint8_t*>(blob.c_str());
  454|  37.6k|  d_content.insert(d_content.end(), ptr, ptr+blob.size());
  455|  37.6k|}
_ZN22GenericDNSPacketWriterINSt3__16vectorIh14noinit_adaptorINS0_9allocatorIhEEEEEE9getHeaderEv:
   71|  20.6k|{
   72|  20.6k|  return reinterpret_cast<dnsheader*>(&*d_content.begin());
   73|  20.6k|}
_ZN22GenericDNSPacketWriterINSt3__16vectorIh14noinit_adaptorINS0_9allocatorIhEEEEEE10lookupNameERK7DNSNamePt:
  229|  39.9k|{
  230|       |  // iterate over the written labels, see if we find a match
  231|  39.9k|  const auto& raw = name.getStorage();
  232|       |
  233|       |  /* name might be a.root-servers.net, we need to be able to benefit from finding:
  234|       |     b.root-servers.net, or even:
  235|       |     b\xc0\x0c
  236|       |  */
  237|  39.9k|  unsigned int bestpos=0;
  238|  39.9k|  *matchLen = 0;
  239|       |
  240|       |  // positions of each label in the name we are trying to compress
  241|  39.9k|  boost::container::static_vector<uint16_t, 34> positionsInName;
  242|       |  // positions of labels in the packet we are building
  243|  39.9k|  boost::container::static_vector<uint16_t, 34> positionsInPacket;
  244|       |
  245|  39.9k|  try {
  246|   955k|    for(auto riter= raw.cbegin(); riter < raw.cend(); ) {
  ------------------
  |  Branch (246:35): [True: 930k, False: 24.5k]
  ------------------
  247|   930k|      if (*riter == 0) {
  ------------------
  |  Branch (247:11): [True: 15.4k, False: 915k]
  ------------------
  248|  15.4k|        break;
  249|  15.4k|      }
  250|   915k|      positionsInName.push_back(riter - raw.cbegin());
  251|   915k|      riter += *riter + 1;
  252|   915k|    }
  253|  39.9k|  }
  254|  39.9k|  catch (const std::bad_alloc& ba) {
  255|  24.5k|    if (l_verbose) {
  ------------------
  |  Branch (255:9): [Folded, False: 24.5k]
  ------------------
  256|      0|      cout << "Domain " << name << " too large to compress" << endl;
  257|      0|    }
  258|  24.5k|    return 0;
  259|  24.5k|  }
  260|       |
  261|  15.4k|  if (l_verbose) {
  ------------------
  |  Branch (261:7): [Folded, False: 15.4k]
  ------------------
  262|      0|    cout<<"Input vector for lookup "<<name<<": ";
  263|      0|    for (const auto n : positionsInName) {
  ------------------
  |  Branch (263:23): [True: 0, False: 0]
  ------------------
  264|      0|      cout << n << " ";
  265|      0|    }
  266|      0|    cout<<endl;
  267|      0|    cout<<makeHexDump(string(raw.c_str(), raw.c_str()+raw.size()))<<endl;
  268|      0|  }
  269|       |
  270|  15.4k|  if (l_verbose) {
  ------------------
  |  Branch (270:7): [Folded, False: 15.4k]
  ------------------
  271|      0|    cout << "Have " << d_namepositions.size() << " to ponder" << endl;
  272|      0|  }
  273|       |
  274|  15.4k|  int counter=1;
  275|   201k|  for (const auto positionInPacket : d_namepositions) {
  ------------------
  |  Branch (275:36): [True: 201k, False: 5.58k]
  ------------------
  276|       |    // here it's a bit tricky because the names might be compressed,
  277|       |    // so we will gather all labels composing the name, following
  278|       |    // pointers if needed
  279|       |    // for example if there is an uncompressed \1a\1b\1c\0 we will store
  280|       |    // the position of \1a, \1b, \1c
  281|       |    // if there is instead \1a followed by a pointer to \1b\1c\0 earlier
  282|       |    // in the packet we will store the position of \1a, \1b, \1c as well
  283|       |    // they will just be disjoint
  284|   201k|    if (l_verbose) {
  ------------------
  |  Branch (284:9): [Folded, False: 201k]
  ------------------
  285|      0|      cout<<"Pos: "<<positionInPacket<<", "<<d_content.size()<<endl;
  286|      0|      DNSName pname(reinterpret_cast<const char*>(d_content.data()), d_content.size(), positionInPacket, true); // only for debugging
  287|      0|      cout<<"Looking at '"<<pname<<"' in packet at position "<<positionInPacket<<"/"<<d_content.size()<<", option "<<counter<<"/"<<d_namepositions.size()<<endl;
  288|      0|      ++counter;
  289|      0|    }
  290|   201k|    size_t pointerQuota = 50U;
  291|       |    // memcmp here makes things _slower_
  292|   201k|    positionsInPacket.clear();
  293|   201k|    try {
  294|  4.30M|      for (auto iter = d_content.cbegin() + positionInPacket; iter < d_content.cend() && pointerQuota > 0;) {
  ------------------
  |  Branch (294:63): [True: 4.19M, False: 103k]
  |  Branch (294:63): [True: 4.19M, False: 103k]
  |  Branch (294:90): [True: 4.19M, False: 0]
  ------------------
  295|  4.19M|        uint8_t labelLength = *iter;
  296|  4.19M|        const uint16_t currentPos = (iter - d_content.cbegin());
  297|  4.19M|        if (l_verbose) {
  ------------------
  |  Branch (297:13): [Folded, False: 4.19M]
  ------------------
  298|      0|          cout << "Found label length: " << std::to_string(labelLength) << " at " << currentPos << endl;
  299|      0|        }
  300|  4.19M|        if (labelLength & 0xc0) {
  ------------------
  |  Branch (300:13): [True: 38.6k, False: 4.16M]
  ------------------
  301|  38.6k|          uint16_t npos = 0x100*(labelLength & (~0xc0)) + *++iter;
  302|       |          // check against going forward
  303|  38.6k|          if (npos >= currentPos || npos < sizeof(dnsheader)) {
  ------------------
  |  Branch (303:15): [True: 0, False: 38.6k]
  |  Branch (303:37): [True: 0, False: 38.6k]
  ------------------
  304|       |            /* something is not right */
  305|      0|            break;
  306|      0|          }
  307|       |
  308|       |          // jump to the target of the pointer
  309|  38.6k|          iter = d_content.begin() + npos;
  310|  38.6k|          if (l_verbose) {
  ------------------
  |  Branch (310:15): [Folded, False: 38.6k]
  ------------------
  311|      0|            cout << "Is compressed label to newpos " << npos << ", going there" << endl;
  312|      0|          }
  313|       |
  314|  38.6k|          if (pointerQuota >= 1) {
  ------------------
  |  Branch (314:15): [True: 38.6k, False: 0]
  ------------------
  315|  38.6k|            pointerQuota--;
  316|  38.6k|            continue;
  317|  38.6k|          }
  318|       |
  319|       |          // out of pointer quota, let's stop there
  320|      0|          break;
  321|  38.6k|        }
  322|       |
  323|  4.16M|        if (labelLength == 0) {
  ------------------
  |  Branch (323:13): [True: 96.7k, False: 4.06M]
  ------------------
  324|  96.7k|          break;
  325|  96.7k|        }
  326|       |
  327|  4.06M|        if (currentPos >= maxCompressionOffset) {
  ------------------
  |  Branch (327:13): [True: 1.01k, False: 4.06M]
  ------------------
  328|  1.01k|          break; // compression pointers cannot point here
  329|  1.01k|        }
  330|       |
  331|  4.06M|        positionsInPacket.push_back(currentPos);
  332|       |        // jump to the next label
  333|  4.06M|        iter += labelLength + 1;
  334|  4.06M|      }
  335|   201k|    }
  336|   201k|    catch (const std::bad_alloc& ba) {
  337|   103k|      if (l_verbose) {
  ------------------
  |  Branch (337:11): [Folded, False: 103k]
  ------------------
  338|      0|        cout << "Domain " << name << " too large to compress" << endl;
  339|      0|      }
  340|   103k|      continue;
  341|   103k|    }
  342|       |
  343|  97.7k|    if (l_verbose) {
  ------------------
  |  Branch (343:9): [Folded, False: 97.7k]
  ------------------
  344|      0|      cout<<"Packet vector: "<<endl;
  345|      0|      for (const auto n : positionsInPacket) {
  ------------------
  |  Branch (345:25): [True: 0, False: 0]
  ------------------
  346|      0|        cout << n << " ";
  347|      0|      }
  348|      0|      cout<<endl;
  349|      0|    }
  350|       |
  351|  97.7k|    auto positionInNameIter = positionsInName.crbegin();
  352|  97.7k|    auto positionInPacketIter = positionsInPacket.crbegin();
  353|  97.7k|    unsigned int cmatchlen=1;
  354|   159k|    for(; positionInNameIter != positionsInName.crend() && positionInPacketIter != positionsInPacket.crend(); ++positionInNameIter, ++positionInPacketIter) {
  ------------------
  |  Branch (354:11): [True: 159k, False: 0]
  |  Branch (354:11): [True: 156k, False: 2.80k]
  |  Branch (354:60): [True: 156k, False: 2.80k]
  ------------------
  355|       |      // positionInNameIter is an offset in raw, pvect an offset in packet
  356|   156k|      uint8_t nlen = raw[*positionInNameIter];
  357|   156k|      uint8_t plen = d_content[*positionInPacketIter];
  358|       |
  359|   156k|      if (l_verbose) {
  ------------------
  |  Branch (359:11): [Folded, False: 156k]
  ------------------
  360|      0|        cout << "nlnen=" << (int)nlen << ", plen=" << (int)plen << endl;
  361|      0|      }
  362|       |
  363|   156k|      if (nlen != plen) {
  ------------------
  |  Branch (363:11): [True: 49.9k, False: 106k]
  ------------------
  364|  49.9k|        break;
  365|  49.9k|      }
  366|       |
  367|   106k|      auto rawpart = std::string_view(raw.c_str() + *positionInNameIter + 1, nlen); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
  368|   106k|      auto pktpart = std::string_view((const char*)&d_content[*positionInPacketIter] + 1, nlen); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
  369|   106k|      if (pdns_ilexicographical_compare_three_way(rawpart, pktpart) != 0) {
  ------------------
  |  Branch (369:11): [True: 35.1k, False: 71.4k]
  ------------------
  370|  35.1k|        if (l_verbose) {
  ------------------
  |  Branch (370:13): [Folded, False: 35.1k]
  ------------------
  371|      0|          cout << "Mismatch: " << rawpart << " != " << pktpart << endl;
  372|      0|        }
  373|  35.1k|        break;
  374|  35.1k|      }
  375|       |
  376|  71.4k|      cmatchlen += nlen + 1;
  377|  71.4k|      if (cmatchlen == raw.length()) { // have matched all of it, can't improve
  ------------------
  |  Branch (377:11): [True: 9.83k, False: 61.6k]
  ------------------
  378|  9.83k|        if (l_verbose) {
  ------------------
  |  Branch (378:13): [Folded, False: 9.83k]
  ------------------
  379|      0|          cout << "Stopping search, matched whole name" << endl;
  380|      0|        }
  381|       |
  382|  9.83k|        *matchLen = cmatchlen;
  383|  9.83k|        return *positionInPacketIter;
  384|  9.83k|      }
  385|  71.4k|    }
  386|  87.9k|    if (positionInPacketIter != positionsInPacket.crbegin() && *matchLen < cmatchlen) {
  ------------------
  |  Branch (386:9): [True: 19.5k, False: 68.3k]
  |  Branch (386:9): [True: 6.15k, False: 81.7k]
  |  Branch (386:64): [True: 6.15k, False: 13.4k]
  ------------------
  387|  6.15k|      *matchLen = cmatchlen;
  388|  6.15k|      bestpos = *--positionInPacketIter;
  389|  6.15k|    }
  390|  87.9k|  }
  391|  5.58k|  return bestpos;
  392|  15.4k|}

_ZN22EpollRegisterOurselvesC2Ev:
   72|      2|  {
   73|      2|    FDMultiplexer::getMultiplexerMap().emplace(0, &makeEpoll); // priority 0!
   74|      2|  }

_ZN10LuaContextC2Eb:
  110|      2|    {
  111|       |        // luaL_newstate can return null if allocation failed
  112|       |#if defined(__SANITIZE_THREAD__) && defined(LUAJIT_VERSION) && defined(__aarch64__)
  113|       |        // on arm64 with luajit and TSAN, allocation may fail spuriously, so keep retrying a bit
  114|       |        int tries = 100;
  115|       |#else
  116|      2|        int tries = 1;
  117|      2|#endif
  118|      2|        for (; tries > 0; tries--) {
  ------------------
  |  Branch (118:16): [True: 2, False: 0]
  ------------------
  119|      2|          mState = luaL_newstate();
  120|      2|          if (mState != nullptr) { break; }
  ------------------
  |  Branch (120:15): [True: 2, False: 0]
  ------------------
  121|      2|        }
  122|      2|#undef RETRIES
  123|      2|        if (mState == nullptr)
  ------------------
  |  Branch (123:13): [True: 0, False: 2]
  ------------------
  124|      0|            throw std::bad_alloc();
  125|       |
  126|       |        // setting the panic function
  127|      2|        lua_atpanic(mState, [](lua_State* state) -> int {
  128|      2|            const std::string str = lua_tostring(state, -1);
  129|      2|            lua_pop(state, 1);
  130|      2|            assert(false && "lua_atpanic triggered");
  131|      2|            exit(0);
  132|      2|        });
  133|       |
  134|       |        // opening default library if required to do so
  135|      2|        if (openDefaultLibs)
  ------------------
  |  Branch (135:13): [True: 2, False: 0]
  ------------------
  136|      2|            luaL_openlibs(mState);
  137|       |
  138|      2|        writeGlobalEq();
  139|      2|        lua_pushliteral(mState, LUACONTEXT_DEBUG_TRACEBACK); // ref
  ------------------
  |  |  276|      2|	lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)
  ------------------
  140|      2|        lua_getglobal(mState, "debug"); // ref, debug
  ------------------
  |  |  279|      2|#define lua_getglobal(L,s)	lua_getfield(L, LUA_GLOBALSINDEX, (s))
  |  |  ------------------
  |  |  |  |   38|      2|#define LUA_GLOBALSINDEX	(-10002)
  |  |  ------------------
  ------------------
  141|      2|        lua_getfield(mState, -1, "traceback"); // ref, debug, traceback
  142|      2|        lua_remove(mState, -2); // ref, traceback
  143|      2|        lua_settable(mState, LUA_REGISTRYINDEX); // []
  ------------------
  |  |   36|      2|#define LUA_REGISTRYINDEX	(-10000)
  ------------------
  144|      2|    }
_ZN10LuaContext13writeGlobalEqEv:
  146|      2|    void writeGlobalEq() {
  147|      2|      const auto eqFunction = [](lua_State* lua) -> int {
  148|      2|        try {
  149|      2|          lua_pushstring(lua, "__eq");
  150|      2|          lua_gettable(lua, -2);
  151|       |          /* if not found, return false */
  152|      2|          if (lua_isnil(lua, -1)) {
  153|      2|            lua_pop(lua, 2);
  154|      2|            lua_pushboolean(lua, false);
  155|      2|            return 1;
  156|      2|          }
  157|      2|          lua_insert(lua, lua_gettop(lua)-2);
  158|      2|          return callRaw(lua, PushedObject{lua, 3}, 1).release();
  159|      2|        } catch(...) {
  160|      2|          Pusher<std::exception_ptr>::push(lua, std::current_exception()).release();
  161|      2|          luaError(lua);
  162|      2|        }
  163|      2|      };
  164|      2|      lua_pushcfunction(mState, eqFunction);
  ------------------
  |  |  262|      2|#define lua_pushcfunction(L,f)	lua_pushcclosure(L, (f), 0)
  ------------------
  165|      2|      lua_setglobal(mState, LUACONTEXT_GLOBAL_EQ);
  ------------------
  |  |  278|      2|#define lua_setglobal(L,s)	lua_setfield(L, LUA_GLOBALSINDEX, (s))
  |  |  ------------------
  |  |  |  |   38|      2|#define LUA_GLOBALSINDEX	(-10002)
  |  |  ------------------
  ------------------
  166|      2|    };
_ZN10LuaContextC2EOS_:
  172|      2|        mState(s.mState)
  173|      2|    {
  174|      2|        s.mState = luaL_newstate();
  175|      2|    }
_ZN10LuaContextD2Ev:
  200|      2|    {
  201|      2|        assert(mState);
  ------------------
  |  Branch (201:9): [True: 2, False: 0]
  ------------------
  202|      2|        lua_close(mState);
  203|      2|    }

LLVMFuzzerTestOneInput:
   24|  2.66k|{
   25|  2.66k|  if (size < sizeof(dnsheader) || size > std::numeric_limits<uint16_t>::max()) {
  ------------------
  |  Branch (25:7): [True: 6, False: 2.66k]
  |  Branch (25:35): [True: 10, False: 2.65k]
  ------------------
   26|     16|    return 0;
   27|     16|  }
   28|       |
   29|       |  // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
   30|  2.65k|  const PacketBuffer packet(data, data + size);
   31|       |  // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
   32|  2.65k|  const std::string_view view(reinterpret_cast<const char*>(packet.data()), packet.size());
   33|       |
   34|  2.65k|  try {
   35|  2.65k|    parseRecords(view);
   36|  2.65k|  }
   37|       |  // NOLINTNEXTLINE(bugprone-empty-catch)
   38|  2.65k|  catch (const std::exception&) {
   39|  2.39k|  }
   40|       |
   41|  2.65k|  try {
   42|  2.65k|    unsigned int consumed = 0;
   43|       |    // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
   44|  2.65k|    const DNSName original(view.data(), view.size(), sizeof(dnsheader), false, nullptr, nullptr, &consumed);
   45|       |    // a 1-63 octet label shrinks with single alphabet grows the rewritten packet, shifting records and compression pointers with legitimate IDs.
   46|       |    // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
   47|  2.65k|    const DNSName replacement(std::string(1U + (data[0] % 63U), static_cast<char>('a' + (data[1] % 26U))) + ".example.");
   48|  2.65k|    PacketBuffer rewritten(packet);
   49|  2.65k|    if (dnsdist::changeNameInDNSPacket(rewritten, original, replacement)) {
  ------------------
  |  Branch (49:9): [True: 330, False: 2.32k]
  ------------------
   50|       |      // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
   51|    330|      parseRecords(std::string_view(reinterpret_cast<const char*>(rewritten.data()), rewritten.size()));
   52|    330|    }
   53|  2.65k|  }
   54|       |  // NOLINTNEXTLINE(bugprone-empty-catch)
   55|  2.65k|  catch (const std::exception&) {
   56|  1.93k|  }
   57|       |
   58|  2.65k|  try {
   59|       |    // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
   60|  2.65k|    const uint32_t first = (static_cast<uint32_t>(data[0]) << 8U) | data[1];
   61|       |    // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
   62|  2.65k|    const uint32_t second = (static_cast<uint32_t>(data[2]) << 8U) | data[3];
   63|  2.65k|    PacketBuffer restricted(packet);
   64|  2.65k|    dnsdist::PacketMangling::restrictDNSPacketTTLs(restricted, std::min(first, second), std::max(first, second));
   65|  2.65k|    dnsdist::PacketMangling::restrictDNSPacketTTLs(restricted, 0, second, {QType::A, QType::AAAA});
   66|  2.65k|  }
   67|       |  // NOLINTNEXTLINE(bugprone-empty-catch)
   68|  2.65k|  catch (const std::exception&) {
   69|      0|  }
   70|       |
   71|  2.65k|  PacketBuffer edited(packet);
   72|  2.65k|  dnsdist::PacketMangling::editDNSHeaderFromPacket(edited, [](dnsheader& header) {
   73|  2.65k|    header.rd = !header.rd;
   74|  2.65k|    header.cd = !header.cd;
   75|  2.65k|    return true;
   76|  2.65k|  });
   77|       |
   78|  2.65k|  return 0;
   79|  2.65k|}
fuzz_dnsdist_dnsparser.cc:_ZN12_GLOBAL__N_112parseRecordsERKNSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
   12|  2.98k|{
   13|  2.98k|  const dnsdist::DNSPacketOverlay overlay(packet);
   14|  18.7k|  for (const auto& record : overlay.d_records) {
  ------------------
  |  Branch (14:27): [True: 18.7k, False: 2.98k]
  ------------------
   15|  18.7k|    dnsdist::RecordParsers::parseAddressRecord(packet, record);
   16|  18.7k|    dnsdist::RecordParsers::parseCNAMERecord(packet, record);
   17|  18.7k|  }
   18|  2.98k|}
fuzz_dnsdist_dnsparser.cc:_ZZ22LLVMFuzzerTestOneInputENK3$_0clER9dnsheader:
   72|  2.65k|  dnsdist::PacketMangling::editDNSHeaderFromPacket(edited, [](dnsheader& header) {
   73|  2.65k|    header.rd = !header.rd;
   74|  2.65k|    header.cd = !header.cd;
   75|  2.65k|    return true;
   76|  2.65k|  });

_ZN12ComboAddressC2Ev:
  212|    957|  {
  213|       |    sin4.sin_family = AF_INET;
  214|    957|    sin4.sin_addr.s_addr = 0;
  215|    957|    sin4.sin_port = 0;
  216|    957|    sin6.sin6_scope_id = 0;
  217|    957|    sin6.sin6_flowinfo = 0;
  218|    957|  }
_ZN12ComboAddressC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEt:
  247|      2|  {
  248|      2|    memset(&sin6, 0, sizeof(sin6));
  249|      2|    sin4.sin_family = AF_INET;
  250|      2|    sin4.sin_port = 0;
  251|      2|    if (makeIPv4sockaddr(str, &sin4) != 0) {
  ------------------
  |  Branch (251:9): [True: 0, False: 2]
  ------------------
  252|      0|      sin6.sin6_family = AF_INET6;
  253|      0|      if (makeIPv6sockaddr(str, &sin6) < 0) {
  ------------------
  |  Branch (253:11): [True: 0, False: 0]
  ------------------
  254|      0|        throw PDNSException("Unable to convert presentation address '" + str + "'");
  255|      0|      }
  256|      0|    }
  257|      2|    if (sin4.sin_port == 0) { // 'str' overrides port!
  ------------------
  |  Branch (257:9): [True: 0, False: 2]
  ------------------
  258|       |      sin4.sin_port = htons(port);
  259|      0|    }
  260|      2|  }
_Z23makeComboAddressFromRawhPKcm:
  661|    947|{
  662|    947|  ComboAddress address;
  663|       |
  664|    947|  if (version == 4) {
  ------------------
  |  Branch (664:7): [True: 412, False: 535]
  ------------------
  665|    412|    address.sin4.sin_family = AF_INET;
  666|    412|    if (len != sizeof(address.sin4.sin_addr)) {
  ------------------
  |  Branch (666:9): [True: 0, False: 412]
  ------------------
  667|      0|      throw NetmaskException("invalid raw address length");
  668|      0|    }
  669|    412|    memcpy(&address.sin4.sin_addr, raw, sizeof(address.sin4.sin_addr));
  670|    412|  }
  671|    535|  else if (version == 6) {
  ------------------
  |  Branch (671:12): [True: 535, False: 0]
  ------------------
  672|    535|    address.sin6.sin6_family = AF_INET6;
  673|    535|    if (len != sizeof(address.sin6.sin6_addr)) {
  ------------------
  |  Branch (673:9): [True: 0, False: 535]
  ------------------
  674|      0|      throw NetmaskException("invalid raw address length");
  675|      0|    }
  676|    535|    memcpy(&address.sin6.sin6_addr, raw, sizeof(address.sin6.sin6_addr));
  677|    535|  }
  678|      0|  else {
  679|      0|    throw NetmaskException("invalid address family");
  680|      0|  }
  681|       |
  682|    947|  return address;
  683|    947|}
_ZN7NetmaskC2Ev:
  696|      8|  {
  697|      8|    d_network.sin4.sin_family = 0; // disable this doing anything useful
  698|      8|    d_network.sin4.sin_port = 0; // this guarantees d_network compares identical
  699|      8|  }
_ZN19AddressAndPortRangeC2Ev:
 1885|      2|    d_addrMask(0), d_portMask(0)
 1886|      2|  {
 1887|      2|    d_addr.sin4.sin_family = 0; // disable this doing anything useful
 1888|      2|    d_addr.sin4.sin_port = 0; // this guarantees d_network compares identical
 1889|      2|  }
_ZN12NetmaskGroupC2Ev:
 1722|      8|  NetmaskGroup() noexcept = default;
_ZN11NetmaskTreeIb7NetmaskEC2Ev:
 1327|      8|    d_root(new TreeNode()), d_left(nullptr)
 1328|      8|  {
 1329|      8|  }
_ZN11NetmaskTreeIb7NetmaskE8TreeNodeC2Ev:
 1032|      8|      parent(nullptr), node(), assigned(false), d_bits(0)
 1033|      8|    {
 1034|      8|    }
_ZN11NetmaskTreeI8DynBlock19AddressAndPortRangeE8TreeNodeC2Ev:
 1032|      2|      parent(nullptr), node(), assigned(false), d_bits(0)
 1033|      2|    {
 1034|      2|    }
_ZN11NetmaskTreeI8DynBlock19AddressAndPortRangeEC2Ev:
 1327|      2|    d_root(new TreeNode()), d_left(nullptr)
 1328|      2|  {
 1329|      2|  }

_ZN11LockGuardedINSt3__15dequeINS0_10unique_ptrI18CrossProtocolQueryNS0_14default_deleteIS3_EEEENS0_9allocatorIS6_EEEEEC2Ev:
  314|      2|  explicit LockGuarded() = default;
_ZN11LockGuardedINSt3__110shared_ptrIN7dnsdist13configuration20RuntimeConfigurationEEEEC2EOS5_:
  310|      2|    d_value(std::move(value))
  311|      2|  {
  312|      2|  }
_ZN11LockGuardedIN19DynBlockMaintenance4TopsEEC2Ev:
  314|      2|  explicit LockGuarded() = default;
_ZN11LockGuardedINSt3__16vectorINS0_10shared_ptrI18DynBlockRulesGroupEENS0_9allocatorIS4_EEEEEC2Ev:
  314|      2|  explicit LockGuarded() = default;
_ZN11LockGuardedINSt3__110shared_ptrI11NetmaskTreeI8DynBlock19AddressAndPortRangeEEEEC2EOS6_:
  310|      2|    d_value(std::move(value))
  311|      2|  {
  312|      2|  }
_ZN11LockGuardedINSt3__110shared_ptrI15SuffixMatchTreeI8DynBlockEEEEC2EOS5_:
  310|      2|    d_value(std::move(value))
  311|      2|  {
  312|      2|  }
_ZN20RecursiveLockGuardedI10LuaContextEC2EOS0_:
  415|      2|    d_value(std::move(value))
  416|      2|  {
  417|      2|  }
_ZN11LockGuardedINSt3__16vectorINS0_10shared_ptrIN7dnsdist16ServiceDiscovery18UpgradeableBackendEEENS0_9allocatorIS6_EEEEEC2Ev:
  314|      2|  explicit LockGuarded() = default;
_ZN11LockGuardedINSt3__16vectorINS0_4pairI7timevalNS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEEENS7_ISA_EEEEEC2Ev:
  314|      2|  explicit LockGuarded() = default;
_ZN11LockGuardedIN27ConcurrentConnectionManager4DataEEC2Ev:
  314|      4|  explicit LockGuarded() = default;
_ZN11LockGuardedIN27ConcurrentConnectionManager4DataEE4lockEv:
  322|      4|  {
  323|      4|    return LockGuardedHolder<T>(d_value, d_mutex);
  324|      4|  }
_ZN17LockGuardedHolderIN27ConcurrentConnectionManager4DataEEC2ERS1_RNSt3__15mutexE:
  236|      4|    d_lock(mutex), d_value(value)
  237|      4|  {
  238|      4|  }
_ZNK17LockGuardedHolderIN27ConcurrentConnectionManager4DataEEptEv:
  246|      4|  {
  247|      4|    return &d_value;
  248|      4|  }
_ZN11LockGuardedINSt3__16vectorINS0_8functionIFvvEEENS0_9allocatorIS4_EEEEEC2Ev:
  314|      2|  explicit LockGuarded() = default;
_ZN11LockGuardedINSt3__16vectorINS0_4pairINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_8functionIFvvEEEEENS6_ISC_EEEEEC2Ev:
  314|      2|  explicit LockGuarded() = default;
_ZN11LockGuardedINSt3__16vectorINS0_8functionIFvRKNS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEbEEENS6_ISC_EEEEEC2Ev:
  314|      2|  explicit LockGuarded() = default;
_ZN17SharedLockGuardedIN5boost15circular_bufferIN7dnsdist17MacAddressesCache5EntryENSt3__19allocatorIS4_EEEEEC2Ev:
  583|      2|  explicit SharedLockGuarded() = default;
_ZN17SharedLockGuardedINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS1_IS7_N7dnsdist7metrics14MutableCounterENS0_4lessIS7_EENS5_INS0_4pairIKS7_SA_EEEEEENSB_IvEENS5_INSD_ISE_SH_EEEEEEEC2Ev:
  583|      2|  explicit SharedLockGuarded() = default;
_ZN17SharedLockGuardedINSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS1_IS7_N7dnsdist7metrics12MutableGaugeENS0_4lessIS7_EENS5_INS0_4pairIKS7_SA_EEEEEENSB_IvEENS5_INSD_ISE_SH_EEEEEEEC2Ev:
  583|      2|  explicit SharedLockGuarded() = default;
_ZN17SharedLockGuardedINSt3__16vectorIN7dnsdist7metrics5Stats11EntryTripleENS0_9allocatorIS5_EEEEEC2EOS8_:
  579|      2|    d_value(std::move(value))
  580|      2|  {
  581|      2|  }
_ZN17SharedLockGuardedINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEjNS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_jEEEEEEEC2Ev:
  583|      2|  explicit SharedLockGuarded() = default;
_ZN11LockGuardedIN15TLSSessionCache9CacheDataEEC2Ev:
  314|      2|  explicit LockGuarded() = default;
_ZN11LockGuardedIN5boost11multi_index21multi_index_containerIN7dnsdist11ClientEntryENS1_10indexed_byINS1_13hashed_uniqueINS1_3tagINS3_10AddressTagEN4mpl_2naESA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_EENS1_6memberIS4_19AddressAndPortRangeXadL_ZNS4_6d_addrEEEEENSD_4hashESA_EENS1_18ordered_non_uniqueINS7_INS3_7TimeTagESA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_EENSC_IS4_lXadL_ZNS4_10d_lastSeenEEEEESA_EESA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_SA_EENSt3__19allocatorIS4_EEEEEC2Ev:
  314|     32|  explicit LockGuarded() = default;
_ZN17SharedLockGuardedINSt3__113unordered_mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_7variantIJNS0_8functionIFvRKN6YaHTTP7RequestERNSA_8ResponseERKN4Logr6LoggerEEEENS9_IFvSD_SF_EEEEEENS0_4hashIS7_EENS0_8equal_toIS7_EENS5_INS0_4pairIKS7_SO_EEEEEEEC2Ev:
  583|      2|  explicit SharedLockGuarded() = default;
_ZN11LockGuardedIbEC2EOb:
  310|      2|    d_value(std::move(value))
  311|      2|  {
  312|      2|  }

_Z11getHostnamev:
  479|      2|{
  480|      2|  const size_t maxHostNameBufSize = getMaxHostNameSize() + 1;
  481|      2|  std::string hostname;
  482|      2|  hostname.resize(maxHostNameBufSize, 0);
  483|       |
  484|      2|  if (gethostname(hostname.data(), maxHostNameBufSize) == -1) {
  ------------------
  |  Branch (484:7): [True: 0, False: 2]
  ------------------
  485|      0|    return std::nullopt;
  486|      0|  }
  487|       |
  488|      2|  hostname.resize(strlen(hostname.c_str()));
  489|      2|  return std::make_optional(hostname);
  490|      2|}
_Z16makeIPv4sockaddrRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEP11sockaddr_in:
  778|      2|{
  779|      2|  std::string str(arg);
  780|      2|  if (str.empty()) {
  ------------------
  |  Branch (780:7): [True: 0, False: 2]
  ------------------
  781|      0|    return -1;
  782|      0|  }
  783|      2|  struct in_addr inp{};
  784|       |
  785|      2|  string::size_type pos = str.find(':');
  786|      2|  if (pos == string::npos) { // no port specified, not touching the port
  ------------------
  |  Branch (786:7): [True: 0, False: 2]
  ------------------
  787|      0|    if (inet_aton(str.c_str(), &inp) != 0) {
  ------------------
  |  Branch (787:9): [True: 0, False: 0]
  ------------------
  788|      0|      ret->sin_addr.s_addr = inp.s_addr;
  789|      0|      return 0;
  790|      0|    }
  791|      0|    return -1;
  792|      0|  }
  793|      2|  if (*(str.c_str() + pos + 1) == 0) { // trailing :
  ------------------
  |  Branch (793:7): [True: 0, False: 2]
  ------------------
  794|      0|    return -1;
  795|      0|  }
  796|       |
  797|      2|  auto* eptr = str.data() + str.size();
  798|      2|  int port = static_cast<int>(strtol(str.c_str() + pos + 1, &eptr, 10));
  799|      2|  if (port < 0 || port > 65535) {
  ------------------
  |  Branch (799:7): [True: 0, False: 2]
  |  Branch (799:19): [True: 0, False: 2]
  ------------------
  800|      0|    return -1;
  801|      0|  }
  802|      2|  if (*eptr != 0) {
  ------------------
  |  Branch (802:7): [True: 0, False: 2]
  ------------------
  803|      0|    return -1;
  804|      0|  }
  805|       |
  806|      2|  ret->sin_port = htons(port);
  807|      2|  if (inet_aton(str.substr(0, pos).c_str(), &inp) != 0) {
  ------------------
  |  Branch (807:7): [True: 2, False: 0]
  ------------------
  808|      2|    ret->sin_addr.s_addr = inp.s_addr;
  809|      2|    return 0;
  810|      2|  }
  811|      0|  return -1;
  812|      2|}
misc.cc:_ZL18getMaxHostNameSizev:
  462|      2|{
  463|      2|#if defined(HOST_NAME_MAX)
  464|      2|  return HOST_NAME_MAX;
  465|      0|#endif
  466|       |
  467|      0|#if defined(_SC_HOST_NAME_MAX)
  468|      0|  auto tmp = sysconf(_SC_HOST_NAME_MAX);
  469|      0|  if (tmp != -1) {
  ------------------
  |  Branch (469:7): [True: 0, False: 0]
  ------------------
  470|      0|    return tmp;
  471|      0|  }
  472|      0|#endif
  473|       |
  474|      0|  const size_t maxHostNameSize = 255;
  475|      0|  return maxHostNameSize;
  476|      0|}

_ZN13FDMultiplexer17getMultiplexerMapEv:
  259|      4|  {
  260|      4|    static FDMultiplexermap_t theMap;
  261|      4|    return theMap;
  262|      4|  }

_ZN14noinit_adaptorINSt3__19allocatorIhEEEC2Ev:
   22|  4.94k|  noinit_adaptor(): Allocator() { }
_ZN14noinit_adaptorINSt3__19allocatorIhEEE9constructIhRKhJEEEvPT_OT0_DpOT1_:
   36|  7.64M|  void construct(U* p, V&& v, Args&&... args) {
   37|  7.64M|    ::new((void*)p) U(std::forward<V>(v), std::forward<Args>(args)...);
   38|  7.64M|  }
_ZN14noinit_adaptorINSt3__19allocatorIhEEE7destroyIhEEvPT_:
   41|  41.1M|  void destroy(U* p) {
   42|  41.1M|    p->~U();
   43|  41.1M|  }
_ZN14noinit_adaptorINSt3__19allocatorIhEEE9constructIhRhJEEEvPT_OT0_DpOT1_:
   36|  17.5M|  void construct(U* p, V&& v, Args&&... args) {
   37|  17.5M|    ::new((void*)p) U(std::forward<V>(v), std::forward<Args>(args)...);
   38|  17.5M|  }
_ZN14noinit_adaptorINSt3__19allocatorIhEEE9constructIhEEvPT_:
   31|  27.4k|  void construct(U* p) {
   32|  27.4k|    ::new((void*)p) U;
   33|  27.4k|  }
_ZN14noinit_adaptorINSt3__19allocatorIhEEE9constructIhhJEEEvPT_OT0_DpOT1_:
   36|  10.0M|  void construct(U* p, V&& v, Args&&... args) {
   37|  10.0M|    ::new((void*)p) U(std::forward<V>(v), std::forward<Args>(args)...);
   38|  10.0M|  }
_ZN14noinit_adaptorINSt3__19allocatorIhEEE9constructIhRKcJEEEvPT_OT0_DpOT1_:
   36|  5.81M|  void construct(U* p, V&& v, Args&&... args) {
   37|  5.81M|    ::new((void*)p) U(std::forward<V>(v), std::forward<Args>(args)...);
   38|  5.81M|  }

_ZN17RegisterOurselvesC2Ev:
   58|      2|  {
   59|      2|    FDMultiplexer::getMultiplexerMap().emplace(2, &make);
   60|      2|  }

qtype.cc:_ZL12swapElementsRKNSt3__13mapIKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEtNS_4lessIS7_EENS4_INS_4pairIS7_tEEEEEE:
  103|      2|{
  104|      2|  std::map<uint16_t, const std::string> ret;
  105|       |
  106|    138|  for (const auto& name : names) {
  ------------------
  |  Branch (106:25): [True: 138, False: 2]
  ------------------
  107|    138|    ret.emplace(name.second, name.first);
  108|    138|  }
  109|      2|  return ret;
  110|      2|}

_ZN5QTypeC2Et:
   49|   146k|    code(qtype) {}
_ZNKSt3__14hashI5QTypeEclES1_:
  177|   162k|  {
  178|   162k|    return std::hash<uint16_t>{}(qtype.getCode());
  179|   162k|  }
_ZNK5QType7getCodeEv:
   60|   162k|  {
   61|   162k|    return code;
   62|   162k|  }
_ZNK5QTypecvtEv:
   54|  82.2k|  {
   55|  82.2k|    return code;
   56|  82.2k|  }
_ZNK6QClasscvtEv:
  201|  56.1k|  {
  202|  56.1k|    return qclass;
  203|  56.1k|  }

_ZN17GlobalStateHolderIN7dnsdist13configuration20RuntimeConfigurationEEC2Ev:
  105|      2|    d_state(std::make_shared<T>())
  106|      2|  {}
_ZN17GlobalStateHolderI11NetmaskTreeI8DynBlock19AddressAndPortRangeEEC2Ev:
  105|      2|    d_state(std::make_shared<T>())
  106|      2|  {}
_ZN17GlobalStateHolderI15SuffixMatchTreeI8DynBlockEEC2Ev:
  105|      2|    d_state(std::make_shared<T>())
  106|      2|  {}

_ZN4pdns12stat_t_traitImEC2Em:
   39|     92|    {
   40|     92|      new(&counter) atomic_t(value);
   41|     92|    }
_ZN4pdns12stat_t_traitIdEC2Ed:
   39|     48|    {
   40|     48|      new(&counter) atomic_t(value);
   41|     48|    }

_ZN4pdns5views16UnsignedCharViewC2EPKcm:
   33|   230k|    view(data_, size_)
   34|   230k|  {
   35|   230k|  }
_ZNK4pdns5views16UnsignedCharView2atEm:
   44|  2.63M|  {
   45|  2.63M|    return reinterpret_cast<const unsigned char&>(view.at(pos));
   46|  2.63M|  }
_ZNK4pdns5views16UnsignedCharView4sizeEv:
   60|  4.11M|  {
   61|  4.11M|    return view.size();
   62|  4.11M|  }

