As suggested by Otto.
return true;
}
-static bool slowParseEDNSOptions(const PacketBuffer& packet, std::map<uint16_t, EDNSOptionView>& options)
+static bool slowParseEDNSOptions(const PacketBuffer& packet, EDNSOptionViewMap& options)
{
if (packet.size() < sizeof(dnsheader)) {
return false;
return true;
}
- dq.ednsOptions = std::make_unique<std::map<uint16_t, EDNSOptionView> >();
+ // dq.ednsOptions is mutable
+ dq.ednsOptions = std::make_unique<EDNSOptionViewMap>();
if (ntohs(dh->arcount) == 0) {
/* nothing in additional so no EDNS */
InternalQueryState& ids;
std::unique_ptr<Netmask> ecs{nullptr};
std::string sni; /* Server Name Indication, if any (DoT or DoH) */
- mutable std::unique_ptr<std::map<uint16_t, EDNSOptionView> > ednsOptions; /* this needs to be mutable because it is parsed just in time, when DNSQuestion is read-only */
+ mutable std::unique_ptr<EDNSOptionViewMap> ednsOptions; /* this needs to be mutable because it is parsed just in time, when DNSQuestion is read-only */
std::unique_ptr<std::vector<ProxyProtocolValue>> proxyProtocolValues{nullptr};
uint16_t ecsPrefixLength;
uint8_t ednsRCode{0};
static constexpr size_t EDNSOptionCodeSize = 2;
static constexpr size_t EDNSOptionLengthSize = 2;
-typedef std::map<uint16_t, EDNSOptionView> EDNSOptionViewMap;
+using EDNSOptionViewMap = std::map<uint16_t, EDNSOptionView>;
/* extract all EDNS0 options from a pointer on the beginning rdLen of the OPT RR */
int getEDNSOptions(const char* optRR, size_t len, EDNSOptionViewMap& options);