Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Remi Gacogne <[email protected]>
  • Loading branch information
omoerbeek and rgacogne authored Feb 11, 2025
1 parent 75acdf4 commit 1b5e53a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/manpages/sdig.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ tlsProvider *name*
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
--------
Expand Down
4 changes: 2 additions & 2 deletions pdns/ednscookies.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ void EDNSCookiesOpt::makeClientCookie()
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)
Expand Down
6 changes: 3 additions & 3 deletions pdns/sdig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ static void fillPacket(vector<uint8_t>& packet, const string& q, const string& t
{
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);
Expand Down Expand Up @@ -246,7 +246,7 @@ try {
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();
Expand Down

0 comments on commit 1b5e53a

Please sign in to comment.