string EDNSCookiesOpt::toDisplayString() const
{
- std::string ret = makeHexDump(client, "");
+ std::ostringstream str;
+ str << makeHexDump(client, "");
if (!server.empty()) {
- ret += '|';
+ str << '|';
if (server.length() != 16) {
// It isn't a rfc9018 one
- ret += makeHexDump(server, "");
+ str << makeHexDump(server, "");
}
else {
// It very likely is a rfc9018 one
- ret += makeHexDump(server.substr(0, 1), ""); // Version
- ret += '|';
- ret += makeHexDump(server.substr(1, 3), ""); // Reserved
- ret += '|';
- ret += makeHexDump(server.substr(4, 4), ""); // Timestamp
- ret += '|';
- ret += makeHexDump(server.substr(8, 8), ""); // Hash
+ str << makeHexDump(server.substr(0, 1), ""); // Version
+ str << '|';
+ str << makeHexDump(server.substr(1, 3), ""); // Reserved
+ str << '|';
+ str << makeHexDump(server.substr(4, 4), ""); // Timestamp
+ str << '|';
+ str << makeHexDump(server.substr(8, 8), ""); // Hash
}
}
- return ret;
+ return str.str();
}
void EDNSCookiesOpt::getEDNSCookiesOptFromString(const char* option, unsigned int len)
Socket sock(remote.sin4.sin_family, SOCK_STREAM);
sock.setNonBlocking();
setTCPNoDelay(sock.getHandle());
+ // Bind to the same address the cookie is associated with (RFC 9018 section 3 last paragraph)
ComboAddress localip = localBind ? *localBind : pdns::getQueryLocalAddress(remote.sin4.sin_family, 0);
if (localBind) {
VLOG(log, "Connecting TCP to " << remote.toString() << " with specific local address " << localip.toString() << endl);
"clear-nta [DOMAIN]... Clear the Negative Trust Anchor for DOMAINs, if no DOMAIN is specified, remove all\n"
"clear-ta [DOMAIN]... Clear the Trust Anchor for DOMAINs\n"
"dump-cache <filename> [type...] dump cache contents to the named file, type is r, n, p or a\n"
- "dump-cookies <filename> dump the contents of the cookie data to the namewd file\n"
+ "dump-cookies <filename> dump the contents of the cookie jar to the named file\n"
"dump-dot-probe-map <filename> dump the contents of the DoT probe map to the named file\n"
"dump-edns [status] <filename> dump EDNS status to the named file\n"
"dump-failedservers <filename> dump the failed servers to the named file\n"