_Z8burtleCIPKhjj:
  121|  1.80k|{
  122|  1.80k|  uint32_t a, b, c, len;
  123|       |
  124|       |  /* Set up the internal state */
  125|  1.80k|  len = length;
  126|  1.80k|  a = b = 0x9e3779b9; /* the golden ratio; an arbitrary value */
  127|  1.80k|  c = initval; /* the previous hash value */
  128|       |
  129|       |  /*---------------------------------------- handle most of the key */
  130|  5.52k|  while (len >= 12) {
  ------------------
  |  Branch (130:10): [True: 3.72k, False: 1.80k]
  ------------------
  131|  3.72k|    a += (dns_tolower(k[0]) + ((uint32_t)dns_tolower(k[1]) << 8) + ((uint32_t)dns_tolower(k[2]) << 16) + ((uint32_t)dns_tolower(k[3]) << 24));
  132|  3.72k|    b += (dns_tolower(k[4]) + ((uint32_t)dns_tolower(k[5]) << 8) + ((uint32_t)dns_tolower(k[6]) << 16) + ((uint32_t)dns_tolower(k[7]) << 24));
  133|  3.72k|    c += (dns_tolower(k[8]) + ((uint32_t)dns_tolower(k[9]) << 8) + ((uint32_t)dns_tolower(k[10]) << 16) + ((uint32_t)dns_tolower(k[11]) << 24));
  134|  3.72k|    burtlemix(a, b, c);
  135|  3.72k|    k += 12;
  136|  3.72k|    len -= 12;
  137|  3.72k|  }
  138|       |
  139|       |  /*------------------------------------- handle the last 11 bytes */
  140|  1.80k|  c += length;
  141|  1.80k|  switch (len) { /* all the case statements fall through */
  ------------------
  |  Branch (141:11): [True: 30, False: 1.77k]
  ------------------
  142|     26|  case 11:
  ------------------
  |  Branch (142:3): [True: 26, False: 1.77k]
  ------------------
  143|     26|    c += ((uint32_t)dns_tolower(k[10]) << 24);
  144|       |    /* fall-through */
  145|     36|  case 10:
  ------------------
  |  Branch (145:3): [True: 10, False: 1.79k]
  ------------------
  146|     36|    c += ((uint32_t)dns_tolower(k[9]) << 16);
  147|       |    /* fall-through */
  148|     42|  case 9:
  ------------------
  |  Branch (148:3): [True: 6, False: 1.79k]
  ------------------
  149|     42|    c += ((uint32_t)dns_tolower(k[8]) << 8);
  150|       |    /* the first byte of c is reserved for the length */
  151|       |    /* fall-through */
  152|     60|  case 8:
  ------------------
  |  Branch (152:3): [True: 18, False: 1.78k]
  ------------------
  153|     60|    b += ((uint32_t)dns_tolower(k[7]) << 24);
  154|       |    /* fall-through */
  155|     84|  case 7:
  ------------------
  |  Branch (155:3): [True: 24, False: 1.77k]
  ------------------
  156|     84|    b += ((uint32_t)dns_tolower(k[6]) << 16);
  157|       |    /* fall-through */
  158|     96|  case 6:
  ------------------
  |  Branch (158:3): [True: 12, False: 1.79k]
  ------------------
  159|     96|    b += ((uint32_t)dns_tolower(k[5]) << 8);
  160|       |    /* fall-through */
  161|    110|  case 5:
  ------------------
  |  Branch (161:3): [True: 14, False: 1.78k]
  ------------------
  162|    110|    b += dns_tolower(k[4]);
  163|       |    /* fall-through */
  164|    132|  case 4:
  ------------------
  |  Branch (164:3): [True: 22, False: 1.78k]
  ------------------
  165|    132|    a += ((uint32_t)dns_tolower(k[3]) << 24);
  166|       |    /* fall-through */
  167|    284|  case 3:
  ------------------
  |  Branch (167:3): [True: 152, False: 1.65k]
  ------------------
  168|    284|    a += ((uint32_t)dns_tolower(k[2]) << 16);
  169|       |    /* fall-through */
  170|    290|  case 2:
  ------------------
  |  Branch (170:3): [True: 6, False: 1.79k]
  ------------------
  171|    290|    a += ((uint32_t)dns_tolower(k[1]) << 8);
  172|       |    /* fall-through */
  173|  1.77k|  case 1:
  ------------------
  |  Branch (173:3): [True: 1.48k, False: 320]
  ------------------
  174|  1.77k|    a += dns_tolower(k[0]);
  175|       |    /* case 0: nothing left to add */
  176|  1.80k|  }
  177|  1.80k|  burtlemix(a, b, c);
  178|       |  /*-------------------------------------------- report the result */
  179|  1.80k|  return c;
  180|  1.80k|}
_Z9burtlemixRjS_S_:
   28|   598k|{
   29|   598k|  a -= b;
   30|   598k|  a -= c;
   31|   598k|  a ^= (c >> 13);
   32|   598k|  b -= c;
   33|   598k|  b -= a;
   34|   598k|  b ^= (a << 8);
   35|   598k|  c -= a;
   36|   598k|  c -= b;
   37|   598k|  c ^= (b >> 13);
   38|   598k|  a -= b;
   39|   598k|  a -= c;
   40|   598k|  a ^= (c >> 12);
   41|   598k|  b -= c;
   42|   598k|  b -= a;
   43|   598k|  b ^= (a << 16);
   44|   598k|  c -= a;
   45|   598k|  c -= b;
   46|   598k|  c ^= (b >> 5);
   47|   598k|  a -= b;
   48|   598k|  a -= c;
   49|   598k|  a ^= (c >> 3);
   50|   598k|  b -= c;
   51|   598k|  b -= a;
   52|   598k|  b ^= (a << 10);
   53|   598k|  c -= a;
   54|   598k|  c -= b;
   55|   598k|  c ^= (b >> 15);
   56|   598k|}
_Z6burtlePKhjj:
   59|  29.4k|{
   60|  29.4k|  uint32_t a, b, c, len;
   61|       |
   62|       |  /* Set up the internal state */
   63|  29.4k|  len = length;
   64|  29.4k|  a = b = 0x9e3779b9; /* the golden ratio; an arbitrary value */
   65|  29.4k|  c = initval; /* the previous hash value */
   66|       |
   67|       |  /*---------------------------------------- handle most of the key */
   68|   592k|  while (len >= 12) {
  ------------------
  |  Branch (68:10): [True: 563k, False: 29.4k]
  ------------------
   69|   563k|    a += (k[0] + ((uint32_t)k[1] << 8) + ((uint32_t)k[2] << 16) + ((uint32_t)k[3] << 24));
   70|   563k|    b += (k[4] + ((uint32_t)k[5] << 8) + ((uint32_t)k[6] << 16) + ((uint32_t)k[7] << 24));
   71|   563k|    c += (k[8] + ((uint32_t)k[9] << 8) + ((uint32_t)k[10] << 16) + ((uint32_t)k[11] << 24));
   72|   563k|    burtlemix(a, b, c);
   73|   563k|    k += 12;
   74|   563k|    len -= 12;
   75|   563k|  }
   76|       |
   77|       |  /*------------------------------------- handle the last 11 bytes */
   78|  29.4k|  c += length;
   79|  29.4k|  switch (len) { /* all the case statements fall through */
  ------------------
  |  Branch (79:11): [True: 910, False: 28.5k]
  ------------------
   80|    795|  case 11:
  ------------------
  |  Branch (80:3): [True: 795, False: 28.6k]
  ------------------
   81|    795|    c += ((uint32_t)k[10] << 24);
   82|       |    /* fall-through */
   83|  6.34k|  case 10:
  ------------------
  |  Branch (83:3): [True: 5.54k, False: 23.8k]
  ------------------
   84|  6.34k|    c += ((uint32_t)k[9] << 16);
   85|       |    /* fall-through */
   86|  6.66k|  case 9:
  ------------------
  |  Branch (86:3): [True: 325, False: 29.1k]
  ------------------
   87|  6.66k|    c += ((uint32_t)k[8] << 8);
   88|       |    /* the first byte of c is reserved for the length */
   89|       |    /* fall-through */
   90|  7.45k|  case 8:
  ------------------
  |  Branch (90:3): [True: 788, False: 28.6k]
  ------------------
   91|  7.45k|    b += ((uint32_t)k[7] << 24);
   92|       |    /* fall-through */
   93|  8.49k|  case 7:
  ------------------
  |  Branch (93:3): [True: 1.03k, False: 28.4k]
  ------------------
   94|  8.49k|    b += ((uint32_t)k[6] << 16);
   95|       |    /* fall-through */
   96|  10.0k|  case 6:
  ------------------
  |  Branch (96:3): [True: 1.57k, False: 27.8k]
  ------------------
   97|  10.0k|    b += ((uint32_t)k[5] << 8);
   98|       |    /* fall-through */
   99|  10.6k|  case 5:
  ------------------
  |  Branch (99:3): [True: 594, False: 28.8k]
  ------------------
  100|  10.6k|    b += k[4];
  101|       |    /* fall-through */
  102|  23.8k|  case 4:
  ------------------
  |  Branch (102:3): [True: 13.2k, False: 16.2k]
  ------------------
  103|  23.8k|    a += ((uint32_t)k[3] << 24);
  104|       |    /* fall-through */
  105|  25.3k|  case 3:
  ------------------
  |  Branch (105:3): [True: 1.46k, False: 27.9k]
  ------------------
  106|  25.3k|    a += ((uint32_t)k[2] << 16);
  107|       |    /* fall-through */
  108|  26.0k|  case 2:
  ------------------
  |  Branch (108:3): [True: 710, False: 28.7k]
  ------------------
  109|  26.0k|    a += ((uint32_t)k[1] << 8);
  110|       |    /* fall-through */
  111|  28.5k|  case 1:
  ------------------
  |  Branch (111:3): [True: 2.47k, False: 26.9k]
  ------------------
  112|  28.5k|    a += k[0];
  113|       |    /* case 0: nothing left to add */
  114|  29.4k|  }
  115|  29.4k|  burtlemix(a, b, c);
  116|       |  /*-------------------------------------------- report the result */
  117|  29.4k|  return c;
  118|  29.4k|}

_ZN17dnsheader_alignedC2EPKv:
  195|    901|  {
  196|    901|    if (reinterpret_cast<uintptr_t>(mem) % sizeof(uint32_t) == 0) {
  ------------------
  |  Branch (196:9): [True: 901, False: 0]
  ------------------
  197|    901|      d_p = reinterpret_cast<const dnsheader*>(mem);
  198|    901|    }
  199|      0|    else {
  200|      0|      memcpy(&d_h, mem, sizeof(dnsheader));
  201|      0|      d_p = &d_h;
  202|      0|    }
  203|    901|  }
_ZNK17dnsheader_aligned3getEv:
  206|    901|  {
  207|    901|    return d_p;
  208|    901|  }

_ZN18DNSDistPacketCacheC2Emjjjjjbjbb:
   33|  2.36k|{
   34|  2.36k|  if (d_maxEntries == 0) {
  ------------------
  |  Branch (34:7): [True: 0, False: 2.36k]
  ------------------
   35|      0|    throw std::runtime_error("Trying to create a 0-sized packet-cache");
   36|      0|  }
   37|       |
   38|  2.36k|  d_shards.resize(d_shardCount);
   39|       |
   40|       |  /* we reserve maxEntries + 1 to avoid rehashing from occurring
   41|       |     when we get to maxEntries, as it means a load factor of 1 */
   42|  2.36k|  for (auto& shard : d_shards) {
  ------------------
  |  Branch (42:20): [True: 2.36k, False: 2.36k]
  ------------------
   43|  2.36k|    shard.setSize((maxEntries / d_shardCount) + 1);
   44|  2.36k|  }
   45|  2.36k|}
_ZN18DNSDistPacketCache15getClientSubnetERKNSt3__16vectorIh14noinit_adaptorINS0_9allocatorIhEEEEEmRN5boost8optionalI7NetmaskEE:
   48|    901|{
   49|    901|  uint16_t optRDPosition;
   50|    901|  size_t remaining = 0;
   51|       |
   52|    901|  int res = getEDNSOptionsStart(packet, qnameWireLength, &optRDPosition, &remaining);
   53|       |
   54|    901|  if (res == 0) {
  ------------------
  |  Branch (54:7): [True: 541, False: 360]
  ------------------
   55|    541|    size_t ecsOptionStartPosition = 0;
   56|    541|    size_t ecsOptionSize = 0;
   57|       |
   58|    541|    res = getEDNSOption(reinterpret_cast<const char*>(&packet.at(optRDPosition)), remaining, EDNSOptionCode::ECS, &ecsOptionStartPosition, &ecsOptionSize);
   59|       |
   60|    541|    if (res == 0 && ecsOptionSize > (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE)) {
  ------------------
  |  |  226|    254|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
                  if (res == 0 && ecsOptionSize > (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE)) {
  ------------------
  |  |  227|    254|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
  |  Branch (60:9): [True: 254, False: 287]
  |  Branch (60:21): [True: 248, False: 6]
  ------------------
   61|       |
   62|    248|      EDNSSubnetOpts eso;
   63|    248|      if (getEDNSSubnetOptsFromString(reinterpret_cast<const char*>(&packet.at(optRDPosition + ecsOptionStartPosition + (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE))), ecsOptionSize - (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE), &eso) == true) {
  ------------------
  |  |  226|    248|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
                    if (getEDNSSubnetOptsFromString(reinterpret_cast<const char*>(&packet.at(optRDPosition + ecsOptionStartPosition + (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE))), ecsOptionSize - (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE), &eso) == true) {
  ------------------
  |  |  227|    248|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
                    if (getEDNSSubnetOptsFromString(reinterpret_cast<const char*>(&packet.at(optRDPosition + ecsOptionStartPosition + (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE))), ecsOptionSize - (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE), &eso) == true) {
  ------------------
  |  |  226|    248|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
                    if (getEDNSSubnetOptsFromString(reinterpret_cast<const char*>(&packet.at(optRDPosition + ecsOptionStartPosition + (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE))), ecsOptionSize - (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE), &eso) == true) {
  ------------------
  |  |  227|    248|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
  |  Branch (63:11): [True: 86, False: 162]
  ------------------
   64|     86|        subnet = eso.source;
   65|     86|        return true;
   66|     86|      }
   67|    248|    }
   68|    541|  }
   69|       |
   70|    815|  return false;
   71|    901|}
_ZN18DNSDistPacketCache6getKeyERKN5boost9container12basic_stringIcNSt3__111char_traitsIcEEvEEmRKNS3_6vectorIh14noinit_adaptorINS3_9allocatorIhEEEEEb:
  433|  1.80k|{
  434|  1.80k|  uint32_t result = 0;
  435|       |  /* skip the query ID */
  436|  1.80k|  if (packet.size() < sizeof(dnsheader)) {
  ------------------
  |  Branch (436:7): [True: 0, False: 1.80k]
  ------------------
  437|      0|    throw std::range_error("Computing packet cache key for an invalid packet size (" + std::to_string(packet.size()) +")");
  438|      0|  }
  439|       |
  440|  1.80k|  result = burtle(&packet.at(2), sizeof(dnsheader) - 2, result);
  441|  1.80k|  result = burtleCI((const unsigned char*) qname.c_str(), qname.length(), result);
  442|  1.80k|  if (packet.size() < sizeof(dnsheader) + qnameWireLength) {
  ------------------
  |  Branch (442:7): [True: 0, False: 1.80k]
  ------------------
  443|      0|    throw std::range_error("Computing packet cache key for an invalid packet (" + std::to_string(packet.size()) + " < " + std::to_string(sizeof(dnsheader) + qnameWireLength) + ")");
  444|      0|  }
  445|  1.80k|  if (packet.size() > ((sizeof(dnsheader) + qnameWireLength))) {
  ------------------
  |  Branch (445:7): [True: 1.80k, False: 0]
  ------------------
  446|  1.80k|    if (!d_optionsToSkip.empty()) {
  ------------------
  |  Branch (446:9): [True: 901, False: 901]
  ------------------
  447|       |      /* skip EDNS options if any */
  448|    901|      result = PacketCache::hashAfterQname(std::string_view(reinterpret_cast<const char*>(packet.data()), packet.size()), result, sizeof(dnsheader) + qnameWireLength, d_optionsToSkip);
  449|    901|    }
  450|    901|    else {
  451|    901|      result = burtle(&packet.at(sizeof(dnsheader) + qnameWireLength), packet.size() - (sizeof(dnsheader) + qnameWireLength), result);
  452|    901|    }
  453|  1.80k|  }
  454|  1.80k|  result = burtle((const unsigned char*) &receivedOverUDP, sizeof(receivedOverUDP), result);
  455|  1.80k|  return result;
  456|  1.80k|}
_ZN18DNSDistPacketCache17setSkippedOptionsERKNSt3__113unordered_setItNS0_4hashItEENS0_8equal_toItEENS0_9allocatorItEEEE:
  511|  1.18k|{
  512|  1.18k|  d_optionsToSkip = optionsToSkip;
  513|  1.18k|}

_ZN18DNSDistPacketCache10CacheShard7setSizeEm:
  118|  2.36k|    {
  119|  2.36k|      d_map.write_lock()->reserve(maxSize);
  120|  2.36k|    }
_ZN18DNSDistPacketCache10CacheShardC2Ev:
  111|  2.36k|    {
  112|  2.36k|    }
_ZN18DNSDistPacketCache20setECSParsingEnabledEb:
   80|  2.36k|  {
   81|  2.36k|    d_parseECS = enabled;
   82|  2.36k|  }

_Z19getEDNSOptionsStartRKNSt3__16vectorIh14noinit_adaptorINS_9allocatorIhEEEEEmPtPm:
  390|    901|{
  391|    901|  assert(optRDPosition != nullptr);
  392|      0|  assert(remaining != nullptr);
  393|      0|  const struct dnsheader* dh = reinterpret_cast<const struct dnsheader*>(packet.data());
  394|       |
  395|    901|  if (offset >= packet.size()) {
  ------------------
  |  Branch (395:7): [True: 0, False: 901]
  ------------------
  396|      0|    return ENOENT;
  397|      0|  }
  398|       |
  399|    901|  if (ntohs(dh->qdcount) != 1 || ntohs(dh->ancount) != 0 || ntohs(dh->arcount) != 1 || ntohs(dh->nscount) != 0)
  ------------------
  |  Branch (399:7): [True: 57, False: 844]
  |  Branch (399:34): [True: 10, False: 834]
  |  Branch (399:61): [True: 9, False: 825]
  |  Branch (399:88): [True: 3, False: 822]
  ------------------
  400|     79|    return ENOENT;
  401|       |
  402|    822|  size_t pos = sizeof(dnsheader) + offset;
  403|    822|  pos += DNS_TYPE_SIZE + DNS_CLASS_SIZE;
  ------------------
  |  |  220|    822|#define DNS_TYPE_SIZE (2)
  ------------------
                pos += DNS_TYPE_SIZE + DNS_CLASS_SIZE;
  ------------------
  |  |  221|    822|#define DNS_CLASS_SIZE (2)
  ------------------
  404|       |
  405|    822|  if (pos >= packet.size())
  ------------------
  |  Branch (405:7): [True: 8, False: 814]
  ------------------
  406|      8|    return ENOENT;
  407|       |
  408|    814|  if ((pos + /* root */ 1 + DNS_TYPE_SIZE + DNS_CLASS_SIZE) >= packet.size()) {
  ------------------
  |  |  220|    814|#define DNS_TYPE_SIZE (2)
  ------------------
                if ((pos + /* root */ 1 + DNS_TYPE_SIZE + DNS_CLASS_SIZE) >= packet.size()) {
  ------------------
  |  |  221|    814|#define DNS_CLASS_SIZE (2)
  ------------------
  |  Branch (408:7): [True: 16, False: 798]
  ------------------
  409|     16|    return ENOENT;
  410|     16|  }
  411|       |
  412|    798|  if (packet[pos] != 0) {
  ------------------
  |  Branch (412:7): [True: 98, False: 700]
  ------------------
  413|       |    /* not the root so not an OPT record */
  414|     98|    return ENOENT;
  415|     98|  }
  416|    700|  pos += 1;
  417|       |
  418|    700|  uint16_t qtype = packet.at(pos)*256 + packet.at(pos+1);
  419|    700|  pos += DNS_TYPE_SIZE;
  ------------------
  |  |  220|    700|#define DNS_TYPE_SIZE (2)
  ------------------
  420|    700|  pos += DNS_CLASS_SIZE;
  ------------------
  |  |  221|    700|#define DNS_CLASS_SIZE (2)
  ------------------
  421|       |
  422|    700|  if (qtype != QType::OPT || (packet.size() - pos) < (DNS_TTL_SIZE + DNS_RDLENGTH_SIZE)) {
  ------------------
  |  |  222|    546|#define DNS_TTL_SIZE (4)
  ------------------
                if (qtype != QType::OPT || (packet.size() - pos) < (DNS_TTL_SIZE + DNS_RDLENGTH_SIZE)) {
  ------------------
  |  |  223|    546|#define DNS_RDLENGTH_SIZE (2)
  ------------------
  |  Branch (422:7): [True: 154, False: 546]
  |  Branch (422:30): [True: 5, False: 541]
  ------------------
  423|    159|    return ENOENT;
  424|    159|  }
  425|       |
  426|    541|  pos += DNS_TTL_SIZE;
  ------------------
  |  |  222|    541|#define DNS_TTL_SIZE (4)
  ------------------
  427|    541|  *optRDPosition = pos;
  428|    541|  *remaining = packet.size() - pos;
  429|       |
  430|    541|  return 0;
  431|    700|}

_ZN7DNSNameC2ENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
   57|      4|{
   58|      4|  const char* p = sw.data();
   59|      4|  size_t length = sw.length();
   60|       |
   61|      4|  if(length == 0 || (length == 1 && p[0]=='.')) {
  ------------------
  |  Branch (61:6): [True: 0, False: 4]
  |  Branch (61:22): [True: 4, False: 0]
  |  Branch (61:37): [True: 2, False: 2]
  ------------------
   62|      2|    d_storage.assign(1, '\0');
   63|      2|  } else {
   64|      2|    if(!std::memchr(p, '\\', length)) {
  ------------------
  |  Branch (64:8): [True: 2, False: 0]
  ------------------
   65|      2|      unsigned char lenpos=0;
   66|      2|      unsigned char labellen=0;
   67|      2|      const char* const pbegin=p, *pend=p+length;
   68|       |
   69|      2|      d_storage.reserve(length+1);
   70|      4|      for(auto iter = pbegin; iter != pend; ) {
  ------------------
  |  Branch (70:31): [True: 2, False: 2]
  ------------------
   71|      2|        lenpos = d_storage.size();
   72|      2|        if(*iter=='.')
  ------------------
  |  Branch (72:12): [True: 0, False: 2]
  ------------------
   73|      0|          throwSafeRangeError("Found . in wrong position in DNSName: ", p, length);
   74|      2|        d_storage.append(1, '\0');
   75|      2|        labellen=0;
   76|      2|        auto begiter=iter;
   77|      4|        for(; iter != pend && *iter!='.'; ++iter) {
  ------------------
  |  Branch (77:15): [True: 2, False: 2]
  |  Branch (77:31): [True: 2, False: 0]
  ------------------
   78|      2|          labellen++;
   79|      2|        }
   80|      2|        d_storage.append(begiter,iter);
   81|      2|        if(iter != pend)
  ------------------
  |  Branch (81:12): [True: 0, False: 2]
  ------------------
   82|      0|          ++iter;
   83|      2|        if(labellen > 63)
  ------------------
  |  Branch (83:12): [True: 0, False: 2]
  ------------------
   84|      0|          throwSafeRangeError("label too long to append: ", p, length);
   85|       |
   86|      2|        if(iter-pbegin > static_cast<ptrdiff_t>(s_maxDNSNameLength - 1)) // reserve two bytes, one for length and one for the root label
  ------------------
  |  Branch (86:12): [True: 0, False: 2]
  ------------------
   87|      0|          throwSafeRangeError("name too long to append: ", p, length);
   88|       |
   89|      2|        d_storage[lenpos]=labellen;
   90|      2|      }
   91|      2|      d_storage.append(1, '\0');
   92|      2|    }
   93|      0|    else {
   94|      0|      d_storage=segmentDNSNameRaw(p, length);
   95|      0|      if(d_storage.size() > s_maxDNSNameLength) {
  ------------------
  |  Branch (95:10): [True: 0, False: 0]
  ------------------
   96|      0|        throwSafeRangeError("name too long: ", p, length);
   97|      0|      }
   98|      0|    }
   99|      2|  }
  100|      4|}
_ZN7DNSNameC2EPKciibPtS2_Pjt:
  104|  1.18k|{
  105|  1.18k|  if (offset >= len)
  ------------------
  |  Branch (105:7): [True: 8, False: 1.17k]
  ------------------
  106|      8|    throw std::range_error("Trying to read past the end of the buffer ("+std::to_string(offset)+ " >= "+std::to_string(len)+")");
  107|       |
  108|  1.17k|  if(!uncompress) {
  ------------------
  |  Branch (108:6): [True: 1.17k, False: 0]
  ------------------
  109|  1.17k|    if(const void * fnd=memchr(pos+offset, 0, len-offset)) {
  ------------------
  |  Branch (109:21): [True: 1.13k, False: 38]
  ------------------
  110|  1.13k|      d_storage.reserve(2+(const char*)fnd-(pos+offset));
  111|  1.13k|    }
  112|  1.17k|  }
  113|       |
  114|  1.17k|  packetParser(pos, len, offset, uncompress, qtype, qclass, consumed, 0, minOffset);
  115|  1.17k|}
_ZN7DNSName12packetParserEPKciibPtS2_Pjit:
  119|  1.17k|{
  120|  1.17k|  const unsigned char* pos=(const unsigned char*)qpos;
  121|  1.17k|  unsigned char labellen;
  122|  1.17k|  const unsigned char *opos = pos;
  123|       |
  124|  1.17k|  if (offset >= len)
  ------------------
  |  Branch (124:7): [True: 0, False: 1.17k]
  ------------------
  125|      0|    throw std::range_error("Trying to read past the end of the buffer ("+std::to_string(offset)+ " >= "+std::to_string(len)+")");
  126|  1.17k|  if (offset < (int) minOffset)
  ------------------
  |  Branch (126:7): [True: 0, False: 1.17k]
  ------------------
  127|      0|    throw std::range_error("Trying to read before the beginning of the buffer ("+std::to_string(offset)+ " < "+std::to_string(minOffset)+")");
  128|       |
  129|  1.17k|  const unsigned char* end = pos + len;
  130|  1.17k|  pos += offset;
  131|  7.41k|  while((labellen=*pos++) && pos < end) { // "scan and copy"
  ------------------
  |  Branch (131:9): [True: 6.46k, False: 950]
  |  Branch (131:30): [True: 6.37k, False: 85]
  ------------------
  132|  6.37k|    if(labellen >= 0xc0) {
  ------------------
  |  Branch (132:8): [True: 65, False: 6.31k]
  ------------------
  133|     65|      if(!uncompress)
  ------------------
  |  Branch (133:10): [True: 65, False: 0]
  ------------------
  134|     65|        throw std::range_error("Found compressed label, instructed not to follow");
  135|       |
  136|      0|      labellen &= (~0xc0);
  137|      0|      int newpos = (labellen << 8) + *(const unsigned char*)pos;
  138|       |
  139|      0|      if(newpos < offset) {
  ------------------
  |  Branch (139:10): [True: 0, False: 0]
  ------------------
  140|      0|        if(newpos < (int) minOffset)
  ------------------
  |  Branch (140:12): [True: 0, False: 0]
  ------------------
  141|      0|          throw std::range_error("Invalid label position during decompression ("+std::to_string(newpos)+ " < "+std::to_string(minOffset)+")");
  142|      0|        if (++depth > 100)
  ------------------
  |  Branch (142:13): [True: 0, False: 0]
  ------------------
  143|      0|          throw std::range_error("Abort label decompression after 100 redirects");
  144|      0|        packetParser((const char*)opos, len, newpos, true, nullptr, nullptr, nullptr, depth, minOffset);
  145|      0|      } else
  146|      0|        throw std::range_error("Found a forward reference during label decompression");
  147|      0|      pos++;
  148|      0|      break;
  149|  6.31k|    } else if(labellen & 0xc0) {
  ------------------
  |  Branch (149:15): [True: 53, False: 6.25k]
  ------------------
  150|     53|      throw std::range_error("Found an invalid label length in qname (only one of the first two bits is set)");
  151|     53|    }
  152|  6.25k|    if (pos + labellen < end) {
  ------------------
  |  Branch (152:9): [True: 6.23k, False: 19]
  ------------------
  153|  6.23k|      appendRawLabel((const char*)pos, labellen);
  154|  6.23k|    }
  155|     19|    else
  156|     19|      throw std::range_error("Found an invalid label length in qname");
  157|  6.23k|    pos+=labellen;
  158|  6.23k|  }
  159|  1.03k|  if(d_storage.empty())
  ------------------
  |  Branch (159:6): [True: 747, False: 288]
  ------------------
  160|    747|    d_storage.append(1, (char)0); // we just parsed the root
  161|  1.03k|  if(consumed)
  ------------------
  |  Branch (161:6): [True: 1.02k, False: 7]
  ------------------
  162|  1.02k|    *consumed = pos - opos - offset;
  163|  1.03k|  if(qtype) {
  ------------------
  |  Branch (163:6): [True: 1.02k, False: 7]
  ------------------
  164|  1.02k|    if (pos + 2 > end) {
  ------------------
  |  Branch (164:9): [True: 126, False: 902]
  ------------------
  165|    126|      throw std::range_error("Trying to read qtype past the end of the buffer ("+std::to_string((pos - opos) + 2)+ " > "+std::to_string(len)+")");
  166|    126|    }
  167|    902|    *qtype=(*(const unsigned char*)pos)*256 + *((const unsigned char*)pos+1);
  168|    902|  }
  169|    909|  pos+=2;
  170|    909|  if(qclass) {
  ------------------
  |  Branch (170:6): [True: 902, False: 7]
  ------------------
  171|    902|    if (pos + 2 > end) {
  ------------------
  |  Branch (171:9): [True: 1, False: 901]
  ------------------
  172|      1|      throw std::range_error("Trying to read qclass past the end of the buffer ("+std::to_string((pos - opos) + 2)+ " > "+std::to_string(len)+")");
  173|      1|    }
  174|    901|    *qclass=(*(const unsigned char*)pos)*256 + *((const unsigned char*)pos+1);
  175|    901|  }
  176|    909|}
_ZN7DNSName14appendRawLabelEPKcj:
  341|  6.23k|{
  342|  6.23k|  if(length==0)
  ------------------
  |  Branch (342:6): [True: 0, False: 6.23k]
  ------------------
  343|      0|    throw std::range_error("no such thing as an empty label to append");
  344|  6.23k|  if(length > 63)
  ------------------
  |  Branch (344:6): [True: 0, False: 6.23k]
  ------------------
  345|      0|    throw std::range_error("label too long to append");
  346|  6.23k|  if(d_storage.size() + length > s_maxDNSNameLength - 1) // reserve one byte for the label length
  ------------------
  |  Branch (346:6): [True: 7, False: 6.23k]
  ------------------
  347|      7|    throw std::range_error("name too long to append");
  348|       |
  349|  6.23k|  if(d_storage.empty()) {
  ------------------
  |  Branch (349:6): [True: 391, False: 5.84k]
  ------------------
  350|    391|    d_storage.append(1, (char)length);
  351|    391|  }
  352|  5.84k|  else {
  353|  5.84k|    *d_storage.rbegin()=(char)length;
  354|  5.84k|  }
  355|  6.23k|  d_storage.append(start, length);
  356|  6.23k|  d_storage.append(1, (char)0);
  357|  6.23k|}

_Z11dns_tolowerh:
   55|  47.6k|{
   56|  47.6k|  return dns_tolower_table[c];
   57|  47.6k|}
_ZNK7DNSName10getStorageEv:
  183|  1.80k|  const string_t& getStorage() const {
  184|  1.80k|    return d_storage;
  185|  1.80k|  }

_Z17getNextEDNSOptionPKcmRtS1_:
   27|  27.2k|{
   28|  27.2k|  if (data == nullptr || dataLen < (sizeof(uint16_t) + sizeof(uint16_t))) {
  ------------------
  |  Branch (28:7): [True: 0, False: 27.2k]
  |  Branch (28:26): [True: 103, False: 27.1k]
  ------------------
   29|    103|    return false;
   30|    103|  }
   31|       |
   32|  27.1k|  size_t pos = 0;
   33|  27.1k|  const uint8_t* p = reinterpret_cast<const uint8_t*>(data);
   34|       |
   35|  27.1k|  optionCode = (static_cast<uint16_t>(p[pos]) * 256) + p[pos + 1];
   36|  27.1k|  pos += EDNS_OPTION_CODE_SIZE;
  ------------------
  |  |  226|  27.1k|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
   37|       |
   38|  27.1k|  optionLen = (static_cast<uint16_t>(p[pos]) * 256) + p[pos + 1];
   39|  27.1k|  pos += EDNS_OPTION_LENGTH_SIZE;
  ------------------
  |  |  227|  27.1k|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
   40|  27.1k|  (void) pos;
   41|       |
   42|  27.1k|  return true;
   43|  27.2k|}
_Z13getEDNSOptionPKcmtPmS1_:
   47|    541|{
   48|    541|  assert(optRR != nullptr);
   49|      0|  assert(optionValuePosition != nullptr);
   50|      0|  assert(optionValueSize != nullptr);
   51|      0|  size_t pos = 0;
   52|    541|  if (len < DNS_RDLENGTH_SIZE)
  ------------------
  |  |  223|    541|#define DNS_RDLENGTH_SIZE (2)
  ------------------
  |  Branch (52:7): [True: 0, False: 541]
  ------------------
   53|      0|    return EINVAL;
   54|       |
   55|    541|  const uint16_t rdLen = (((unsigned char) optRR[pos]) * 256) + ((unsigned char) optRR[pos+1]);
   56|    541|  size_t rdPos = 0;
   57|    541|  pos += DNS_RDLENGTH_SIZE;
  ------------------
  |  |  223|    541|#define DNS_RDLENGTH_SIZE (2)
  ------------------
   58|    541|  if ((pos + rdLen) > len) {
  ------------------
  |  Branch (58:7): [True: 132, False: 409]
  ------------------
   59|    132|    return EINVAL;
   60|    132|  }
   61|       |
   62|  3.58k|  while(len >= (pos + EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE) &&
  ------------------
  |  |  226|  3.58k|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
                while(len >= (pos + EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE) &&
  ------------------
  |  |  227|  3.58k|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
  |  Branch (62:9): [True: 3.51k, False: 69]
  ------------------
   63|  3.58k|        rdLen >= (rdPos + EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE)) {
  ------------------
  |  |  226|  3.51k|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
                      rdLen >= (rdPos + EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE)) {
  ------------------
  |  |  227|  3.51k|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
  |  Branch (63:9): [True: 3.49k, False: 15]
  ------------------
   64|  3.49k|    uint16_t optionCode;
   65|  3.49k|    uint16_t optionLen;
   66|  3.49k|    if (!getNextEDNSOption(optRR + pos, len-pos, optionCode, optionLen)) {
  ------------------
  |  Branch (66:9): [True: 0, False: 3.49k]
  ------------------
   67|      0|      break;
   68|      0|    }
   69|       |
   70|  3.49k|    pos += EDNS_OPTION_CODE_SIZE;
  ------------------
  |  |  226|  3.49k|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
   71|  3.49k|    rdPos += EDNS_OPTION_CODE_SIZE;
  ------------------
  |  |  226|  3.49k|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
   72|  3.49k|    pos += EDNS_OPTION_LENGTH_SIZE;
  ------------------
  |  |  227|  3.49k|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
   73|  3.49k|    rdPos += EDNS_OPTION_LENGTH_SIZE;
  ------------------
  |  |  227|  3.49k|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
   74|       |
   75|  3.49k|    if (optionLen > (rdLen - rdPos) || optionLen > (len - pos)) {
  ------------------
  |  Branch (75:9): [True: 71, False: 3.42k]
  |  Branch (75:40): [True: 0, False: 3.42k]
  ------------------
   76|     71|      return EINVAL;
   77|     71|    }
   78|       |
   79|  3.42k|    if (optionCode == wantedOption) {
  ------------------
  |  Branch (79:9): [True: 254, False: 3.17k]
  ------------------
   80|    254|      *optionValuePosition = pos - (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE);
  ------------------
  |  |  226|    254|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
                    *optionValuePosition = pos - (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE);
  ------------------
  |  |  227|    254|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
   81|    254|      *optionValueSize = optionLen + EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE;
  ------------------
  |  |  226|    254|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
                    *optionValueSize = optionLen + EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE;
  ------------------
  |  |  227|    254|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
   82|    254|      return 0;
   83|    254|    }
   84|  3.17k|    else {
   85|       |      /* skip this option */
   86|  3.17k|      pos += optionLen;
   87|  3.17k|      rdPos += optionLen;
   88|  3.17k|    }
   89|  3.42k|  }
   90|       |
   91|     84|  return ENOENT;
   92|    409|}

_Z27getEDNSSubnetOptsFromStringPKcjP14EDNSSubnetOpts:
   44|    248|{
   45|    248|  EDNSSubnetOptsWire esow;
   46|    248|  static_assert (sizeof(esow) == 4, "sizeof(EDNSSubnetOptsWire) must be 4 bytes");
   47|    248|  if(len < sizeof(esow))
  ------------------
  |  Branch (47:6): [True: 14, False: 234]
  ------------------
   48|     14|    return false;
   49|    234|  memcpy(&esow, options, sizeof(esow));
   50|    234|  esow.family = ntohs(esow.family);
   51|       |  //cerr<<"Family when parsing from string: "<<esow.family<<endl;
   52|    234|  ComboAddress address;
   53|    234|  unsigned int octetsin = esow.sourceMask > 0 ? (((esow.sourceMask - 1)>> 3)+1) : 0;
  ------------------
  |  Branch (53:27): [True: 166, False: 68]
  ------------------
   54|       |  //cerr<<"octetsin:"<<octetsin<<endl;
   55|    234|  if(esow.family == 1) {
  ------------------
  |  Branch (55:6): [True: 80, False: 154]
  ------------------
   56|     80|    if(len != sizeof(esow)+octetsin)
  ------------------
  |  Branch (56:8): [True: 42, False: 38]
  ------------------
   57|     42|      return false;
   58|     38|    if(octetsin > sizeof(address.sin4.sin_addr.s_addr))
  ------------------
  |  Branch (58:8): [True: 5, False: 33]
  ------------------
   59|      5|      return false;
   60|     33|    address.reset();
   61|     33|    address.sin4.sin_family = AF_INET;
   62|     33|    if(octetsin > 0)
  ------------------
  |  Branch (62:8): [True: 12, False: 21]
  ------------------
   63|     12|      memcpy(&address.sin4.sin_addr.s_addr, options+sizeof(esow), octetsin);
   64|    154|  } else if(esow.family == 2) {
  ------------------
  |  Branch (64:13): [True: 87, False: 67]
  ------------------
   65|     87|    if(len != sizeof(esow)+octetsin)
  ------------------
  |  Branch (65:8): [True: 33, False: 54]
  ------------------
   66|     33|      return false;
   67|     54|    if(octetsin > sizeof(address.sin6.sin6_addr.s6_addr))
  ------------------
  |  Branch (67:8): [True: 1, False: 53]
  ------------------
   68|      1|      return false;
   69|       |
   70|     53|    address.reset();
   71|     53|    address.sin4.sin_family = AF_INET6;
   72|     53|    if(octetsin > 0)
  ------------------
  |  Branch (72:8): [True: 33, False: 20]
  ------------------
   73|     33|      memcpy(&address.sin6.sin6_addr.s6_addr, options+sizeof(esow), octetsin);
   74|     53|  }
   75|     67|  else
   76|     67|    return false;
   77|       |  //cerr<<"Source address: "<<address.toString()<<", mask: "<<(int)esow.sourceMask<<endl;
   78|     86|  eso->source = Netmask(address, esow.sourceMask);
   79|       |  /* 'address' has more bits set (potentially) than scopeMask. This leads to odd looking netmasks that promise
   80|       |     more precision than they have. For this reason we truncate the address to scopeMask bits */
   81|       |  
   82|     86|  address.truncate(esow.scopeMask); // truncate will not throw for odd scopeMasks
   83|     86|  eso->scope = Netmask(address, esow.scopeMask);
   84|       |
   85|     86|  return true;
   86|    234|}

LLVMFuzzerTestOneInput:
   27|  1.18k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   28|       |
   29|  1.18k|  if (size > std::numeric_limits<uint16_t>::max()) {
  ------------------
  |  Branch (29:7): [True: 5, False: 1.18k]
  ------------------
   30|      5|    return 0;
   31|      5|  }
   32|       |
   33|       |  /* dnsdist's version */
   34|  1.18k|  DNSDistPacketCache pcSkipCookies(10000);
   35|       |  // By default, cookies are not hashed
   36|  1.18k|  pcSkipCookies.setECSParsingEnabled(true);
   37|       |
   38|  1.18k|  DNSDistPacketCache pcHashCookies(10000);
   39|  1.18k|  pcHashCookies.setECSParsingEnabled(true);
   40|       |  // Do not skip cookies
   41|  1.18k|  pcHashCookies.setSkippedOptions({});
   42|       |
   43|  1.18k|  try {
   44|  1.18k|    uint16_t qtype;
   45|  1.18k|    uint16_t qclass;
   46|  1.18k|    unsigned int consumed;
   47|  1.18k|    PacketBuffer vect(data, data+size);
   48|  1.18k|    const DNSName qname(reinterpret_cast<const char*>(data), size, sizeof(dnsheader), false, &qtype, &qclass, &consumed);
   49|  1.18k|    pcSkipCookies.getKey(qname.getStorage(), consumed, vect, false);
   50|  1.18k|    pcHashCookies.getKey(qname.getStorage(), consumed, vect, false);
   51|  1.18k|    boost::optional<Netmask> subnet;
   52|  1.18k|    DNSDistPacketCache::getClientSubnet(vect, consumed, subnet);
   53|  1.18k|  }
   54|  1.18k|  catch(const std::exception& e) {
   55|    279|  }
   56|  1.18k|  catch(const PDNSException& e) {
   57|      0|  }
   58|       |
   59|  1.18k|  return 0;
   60|  1.18k|}

_ZN12ComboAddress8truncateEj:
  319|     86|{
  320|     86|  uint8_t* start;
  321|     86|  int len=4;
  322|     86|  if(sin4.sin_family==AF_INET) {
  ------------------
  |  Branch (322:6): [True: 33, False: 53]
  ------------------
  323|     33|    if(bits >= 32)
  ------------------
  |  Branch (323:8): [True: 17, False: 16]
  ------------------
  324|     17|      return;
  325|     16|    start = (uint8_t*)&sin4.sin_addr.s_addr;
  326|     16|    len=4;
  327|     16|  }
  328|     53|  else {
  329|     53|    if(bits >= 128)
  ------------------
  |  Branch (329:8): [True: 9, False: 44]
  ------------------
  330|      9|      return;
  331|     44|    start = (uint8_t*)&sin6.sin6_addr.s6_addr;
  332|     44|    len=16;
  333|     44|  }
  334|       |
  335|     60|  auto tozero= len*8 - bits; // if set to 22, this will clear 1 byte, as it should
  336|       |
  337|     60|  memset(start + len - tozero/8, 0, tozero/8); // blot out the whole bytes on the right
  338|       |
  339|     60|  auto bitsleft=tozero % 8; // 2 bits left to clear
  340|       |
  341|       |  // a b c d, to truncate to 22 bits, we just zeroed 'd' and need to zero 2 bits from c
  342|       |  // so and by '11111100', which is ~((1<<2)-1)  = ~3
  343|     60|  uint8_t* place = start + len - 1 - tozero/8;
  344|     60|  *place &= (~((1<<bitsleft)-1));
  345|     60|}

_ZN12ComboAddressC2Ev:
  182|    730|  {
  183|    730|    sin4.sin_family=AF_INET;
  184|    730|    sin4.sin_addr.s_addr=0;
  185|    730|    sin4.sin_port=0;
  186|    730|    sin6.sin6_scope_id = 0;
  187|    730|    sin6.sin6_flowinfo = 0;
  188|    730|  }
_ZNK12ComboAddress6isIPv4Ev:
  228|    172|  {
  229|    172|    return sin4.sin_family == AF_INET;
  230|    172|  }
_ZN12ComboAddress5resetEv:
  356|     86|  {
  357|     86|    memset(&sin4, 0, sizeof(sin4));
  358|     86|    memset(&sin6, 0, sizeof(sin6));
  359|     86|  }
_ZN7NetmaskC2Ev:
  476|    496|  {
  477|    496|    d_network.sin4.sin_family = 0; // disable this doing anything useful
  478|    496|    d_network.sin4.sin_port = 0; // this guarantees d_network compares identical
  479|    496|    d_mask = 0;
  480|    496|    d_bits = 0;
  481|    496|  }
_ZN7NetmaskC2ERK12ComboAddressh:
  484|    172|  {
  485|    172|    d_network.sin4.sin_port = 0;
  486|    172|    setBits(network.isIPv4() ? std::min(bits, static_cast<uint8_t>(32)) : std::min(bits, static_cast<uint8_t>(128)));
  ------------------
  |  Branch (486:13): [True: 66, False: 106]
  ------------------
  487|    172|  }
_ZN7Netmask7setBitsEh:
  500|    172|  {
  501|    172|    d_bits = value;
  502|       |
  503|    172|    if (d_bits < 32) {
  ------------------
  |  Branch (503:9): [True: 96, False: 76]
  ------------------
  504|     96|      d_mask = ~(0xFFFFFFFF >> d_bits);
  505|     96|    }
  506|     76|    else {
  507|       |      // note that d_mask is unused for IPv6
  508|     76|      d_mask = 0xFFFFFFFF;
  509|     76|    }
  510|       |
  511|    172|    if (isIPv4()) {
  ------------------
  |  Branch (511:9): [True: 66, False: 106]
  ------------------
  512|     66|      d_network.sin4.sin_addr.s_addr = htonl(ntohl(d_network.sin4.sin_addr.s_addr) & d_mask);
  513|     66|    }
  514|    106|    else if (isIPv6()) {
  ------------------
  |  Branch (514:14): [True: 106, False: 0]
  ------------------
  515|    106|      uint8_t bytes = d_bits/8;
  516|    106|      uint8_t *us = (uint8_t*) &d_network.sin6.sin6_addr.s6_addr;
  517|    106|      uint8_t bits = d_bits % 8;
  518|    106|      uint8_t mask = (uint8_t) ~(0xFF>>bits);
  519|       |
  520|    106|      if (bytes < sizeof(d_network.sin6.sin6_addr.s6_addr)) {
  ------------------
  |  Branch (520:11): [True: 96, False: 10]
  ------------------
  521|     96|        us[bytes] &= mask;
  522|     96|      }
  523|       |
  524|    957|      for(size_t idx = bytes + 1; idx < sizeof(d_network.sin6.sin6_addr.s6_addr); ++idx) {
  ------------------
  |  Branch (524:35): [True: 851, False: 106]
  ------------------
  525|    851|        us[idx] = 0;
  526|    851|      }
  527|    106|    }
  528|    172|  }
_ZNK7Netmask6isIPv6Ev:
  619|    106|  {
  620|    106|    return d_network.sin6.sin6_family == AF_INET6;
  621|    106|  }
_ZNK7Netmask6isIPv4Ev:
  624|    172|  {
  625|    172|    return d_network.sin4.sin_family == AF_INET;
  626|    172|  }

_ZN17SharedLockGuardedINSt3__113unordered_mapIjN18DNSDistPacketCache10CacheValueENS0_4hashIjEENS0_8equal_toIjEENS0_9allocatorINS0_4pairIKjS3_EEEEEEE10write_lockEv:
  436|  2.36k|  {
  437|  2.36k|    return SharedLockGuardedHolder<T>(d_value, d_mutex);
  438|  2.36k|  }
_ZN23SharedLockGuardedHolderINSt3__113unordered_mapIjN18DNSDistPacketCache10CacheValueENS0_4hashIjEENS0_8equal_toIjEENS0_9allocatorINS0_4pairIKjS3_EEEEEEEC2ERSD_RNS0_12shared_mutexE:
  307|  2.36k|  {
  308|  2.36k|  }
_ZNK23SharedLockGuardedHolderINSt3__113unordered_mapIjN18DNSDistPacketCache10CacheValueENS0_4hashIjEENS0_8equal_toIjEENS0_9allocatorINS0_4pairIKjS3_EEEEEEEptEv:
  314|  2.36k|  T* operator->() const noexcept {
  315|  2.36k|    return &d_value;
  316|  2.36k|  }
_ZN17SharedLockGuardedINSt3__113unordered_mapIjN18DNSDistPacketCache10CacheValueENS0_4hashIjEENS0_8equal_toIjEENS0_9allocatorINS0_4pairIKjS3_EEEEEEEC2Ev:
  427|  2.36k|  {
  428|  2.36k|  }

_ZN14noinit_adaptorINSt3__19allocatorIhEEE7destroyIhEEvPT_:
   40|  4.62M|  void destroy(U* p) {
   41|  4.62M|    p->~U();
   42|  4.62M|  }
_ZN14noinit_adaptorINSt3__19allocatorIhEEE9constructIhRKhJEEEvPT_OT0_DpOT1_:
   35|  4.62M|  void construct(U* p, V&& v, Args&&... args) {
   36|  4.62M|    ::new((void*)p) U(std::forward<V>(v), std::forward<Args>(args)...);
   37|  4.62M|  }
_ZN14noinit_adaptorINSt3__19allocatorIhEEEC2Ev:
   21|  1.18k|  noinit_adaptor(): Allocator() { }

_ZN11PacketCache14hashAfterQnameERKNSt3__117basic_string_viewIcNS0_11char_traitsIcEEEEjmRKNS0_13unordered_setItNS0_4hashItEENS0_8equal_toItEENS0_9allocatorItEEEE:
   37|    901|  {
   38|    901|    const size_t packetSize = packet.size();
   39|    901|    assert(packetSize >= sizeof(dnsheader));
   40|       |
   41|       |    /* we need at least 2 (QTYPE) + 2 (QCLASS)
   42|       |
   43|       |       + OPT root label (1), type (2), class (2) and ttl (4)
   44|       |       + the OPT RR rdlen (2)
   45|       |       = 15
   46|       |    */
   47|      0|    const dnsheader_aligned dnsheaderdata(packet.data());
   48|    901|    const struct dnsheader *dh = dnsheaderdata.get();
   49|    901|    if (ntohs(dh->qdcount) != 1 || ntohs(dh->ancount) != 0 || ntohs(dh->nscount) != 0 || ntohs(dh->arcount) != 1 || (pos + 15) >= packetSize) {
  ------------------
  |  Branch (49:9): [True: 57, False: 844]
  |  Branch (49:36): [True: 10, False: 834]
  |  Branch (49:63): [True: 8, False: 826]
  |  Branch (49:90): [True: 4, False: 822]
  |  Branch (49:117): [True: 95, False: 727]
  ------------------
   50|    174|      if (packetSize > pos) {
  ------------------
  |  Branch (50:11): [True: 174, False: 0]
  ------------------
   51|    174|        currentHash = burtle(reinterpret_cast<const unsigned char*>(&packet.at(pos)), packetSize - pos, currentHash);
   52|    174|      }
   53|    174|      return currentHash;
   54|    174|    }
   55|       |
   56|    727|    currentHash = burtle(reinterpret_cast<const unsigned char*>(&packet.at(pos)), 15, currentHash);
   57|       |    /* skip the qtype (2), qclass (2) */
   58|       |    /* root label (1), type (2), class (2) and ttl (4) */
   59|       |    /* already hashed above */
   60|    727|    pos += 13;
   61|       |
   62|    727|    const uint16_t rdLen = ((static_cast<uint16_t>(packet.at(pos)) * 256) + static_cast<uint16_t>(packet.at(pos + 1)));
   63|       |    /* skip the rd length */
   64|       |    /* already hashed above */
   65|    727|    pos += 2;
   66|       |
   67|    727|    if (rdLen > (packetSize - pos)) {
  ------------------
  |  Branch (67:9): [True: 142, False: 585]
  ------------------
   68|    142|      if (pos < packetSize) {
  ------------------
  |  Branch (68:11): [True: 142, False: 0]
  ------------------
   69|    142|        currentHash = burtle(reinterpret_cast<const unsigned char*>(&packet.at(pos)), packetSize - pos, currentHash);
   70|    142|      }
   71|    142|      return currentHash;
   72|    142|    }
   73|       |
   74|    585|    uint16_t rdataRead = 0;
   75|    585|    uint16_t optionCode;
   76|    585|    uint16_t optionLen;
   77|       |
   78|  24.0k|    while (pos < packetSize && rdataRead < rdLen && getNextEDNSOption(&packet.at(pos), rdLen - rdataRead, optionCode, optionLen)) {
  ------------------
  |  Branch (78:12): [True: 23.8k, False: 198]
  |  Branch (78:32): [True: 23.8k, False: 91]
  |  Branch (78:53): [True: 23.6k, False: 103]
  ------------------
   79|  23.6k|      if (optionLen > (rdLen - rdataRead - 4)) {
  ------------------
  |  Branch (79:11): [True: 193, False: 23.5k]
  ------------------
   80|    193|        if (packetSize > pos) {
  ------------------
  |  Branch (80:13): [True: 193, False: 0]
  ------------------
   81|    193|          currentHash = burtle(reinterpret_cast<const unsigned char*>(&packet.at(pos)), packetSize - pos, currentHash);
   82|    193|        }
   83|    193|        return currentHash;
   84|    193|      }
   85|       |
   86|  23.5k|      if (optionsToSkip.count(optionCode) == 0) {
  ------------------
  |  Branch (86:11): [True: 22.2k, False: 1.21k]
  ------------------
   87|       |        /* hash the option code, length and content */
   88|  22.2k|        currentHash = burtle(reinterpret_cast<const unsigned char*>(&packet.at(pos)), 4 + optionLen, currentHash);
   89|  22.2k|      }
   90|  1.21k|      else {
   91|       |        /* skip option: hash only its code and length */
   92|  1.21k|        currentHash = burtle(reinterpret_cast<const unsigned char*>(&packet.at(pos)), 4, currentHash);
   93|  1.21k|      }
   94|       |
   95|  23.5k|      pos += 4 + optionLen;
   96|  23.5k|      rdataRead += 4 + optionLen;
   97|  23.5k|    }
   98|       |
   99|    392|    if (pos < packetSize) {
  ------------------
  |  Branch (99:9): [True: 194, False: 198]
  ------------------
  100|    194|      currentHash = burtle(reinterpret_cast<const unsigned char*>(&packet.at(pos)), packetSize - pos, currentHash);
  101|    194|    }
  102|       |
  103|    392|    return currentHash;
  104|    585|  }

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

_ZN4pdns12stat_t_traitImEC2Em:
   38|  18.8k|    stat_t_trait(const base_t x) {
   39|  18.8k|      new(&counter) atomic_t(x);
   40|  18.8k|    }
_ZN4pdns12stat_t_traitImED2Ev:
   41|  18.8k|    ~stat_t_trait() {
   42|  18.8k|      reinterpret_cast<atomic_t *>(&counter)->~atomic_t();
   43|  18.8k|    }

