opcode *OPNUM*
Use opcode *OPNUM* instead of 0 (Query). For example, ``sdig 192.0.2.1 53 example.com SOA opcode 4`` sends a ``NOTIFY``.
cookie *COOKIE*
- if *COOKIE* is -d send a random client cookie. Otherwise send the given cookie, which should be a hex string received from a server earlier.
+ if *COOKIE* is - send a random client cookie. Otherwise send the given cookie, which should be a hex string received from a server earlier.
Examples
--------
uint32_t lower = dns_random_uint32();
uint32_t upper = dns_random_uint32();
client = string();
- client.resize(8);
+ client.resize(sizeof(lower) + sizeof(upper));
memcpy(client.data(), &lower, sizeof(lower));
- memcpy(&client.at(4), &upper, sizeof(upper));
+ memcpy(&client.at(sizeof(lower)), &upper, sizeof(upper));
}
bool EDNSCookiesOpt::makeServerCookie([[maybe_unused]] const string& secret, [[maybe_unused]] const ComboAddress& source)
{
DNSPacketWriter pw(packet, DNSName(q), DNSRecordContent::TypeToNumber(t), qclass, opcode);
- if (dnssec || ednsnm || getenv("SDIGBUFSIZE") != nullptr || cookie) { // NOLINT(concurrency-mt-unsafe) we'resingle threaded
- char* sbuf = getenv("SDIGBUFSIZE"); // NOLINT(concurrency-mt-unsafe) we'resingle threaded
+ if (dnssec || ednsnm || getenv("SDIGBUFSIZE") != nullptr || cookie) { // NOLINT(concurrency-mt-unsafe) we're single threaded
+ char* sbuf = getenv("SDIGBUFSIZE"); // NOLINT(concurrency-mt-unsafe) we're single threaded
int bufsize;
if (sbuf)
bufsize = atoi(sbuf);
bool dumpluaraw = false;
std::optional<string> cookie;
- // NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic, concurrency-mt-unsafe) it's the argv API and w're single-threaded
+ // NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic, concurrency-mt-unsafe) it's the argv API and we're single-threaded
for (int i = 1; i < argc; i++) {
if ((string)argv[i] == "--help") {
usage();