]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: More clang-tidy delinting
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 13 Oct 2023 15:44:13 +0000 (17:44 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 13 Oct 2023 15:44:13 +0000 (17:44 +0200)
pdns/dnsdist-lua.cc
pdns/dnsdist.cc

index d75d85017a4312eca08d756806188120bc423e20..e39748e8c2ad2f735fefec183891e322390bc86b 100644 (file)
@@ -2484,6 +2484,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck)
 #endif /* HAVE_DNS_OVER_HTTPS */
   });
 
+  // NOLINTNEXTLINE(performance-unnecessary-value-param): somehow clang-tidy gets confused about the fact vars could be const while it cannot
   luaCtx.writeFunction("addDOQLocal", [client](const std::string& addr, const boost::variant<std::string, std::shared_ptr<TLSCertKeyPair>, LuaArray<std::string>, LuaArray<std::shared_ptr<TLSCertKeyPair>>>& certFiles, const boost::variant<std::string, LuaArray<std::string>>& keyFiles, boost::optional<localbind_t> vars) {
     if (client) {
       return;
index a54aed88f6db3831b40f91f56e09e33ca0c668e4..cf2bf9c5315dbf86a97549d70d1f75999409bb9d 100644 (file)
@@ -607,7 +607,7 @@ static size_t getMaximumIncomingPacketSize(const ClientState& cs)
 bool sendUDPResponse(int origFD, const PacketBuffer& response, const int delayMsec, const ComboAddress& origDest, const ComboAddress& origRemote)
 {
 #ifndef DISABLE_DELAY_PIPE
-  if (delayMsec && g_delay != nullptr) {
+  if (delayMsec > 0 && g_delay != nullptr) {
     DelayedPacket dp{origFD, response, origRemote, origDest};
     g_delay->submit(dp, delayMsec);
     return true;
@@ -2296,7 +2296,7 @@ static void setupLocalSocket(ClientState& clientState, const ComboAddress& addr,
 #ifdef HAVE_EBPF
   if (g_defaultBPFFilter && !g_defaultBPFFilter->isExternal()) {
     clientState.attachFilter(g_defaultBPFFilter, socket);
-    vinfolog("Attaching default BPF Filter to %s frontend %s", (!tcp ? "UDP" : "TCP"), addr.toStringWithPort());
+    vinfolog("Attaching default BPF Filter to %s frontend %s", std::string(!tcp ? "UDP" : "TCP"), addr.toStringWithPort());
   }
 #endif /* HAVE_EBPF */
 
@@ -2772,7 +2772,9 @@ int main(int argc, char** argv)
 #endif /* DISABLE_COMPLETION */
 #endif /* HAVE_LIBEDIT */
 
+    // NOLINTNEXTLINE(cppcoreguidelines-pro-type-cstyle-cast): SIG_IGN macro
     signal(SIGPIPE, SIG_IGN);
+    // NOLINTNEXTLINE(cppcoreguidelines-pro-type-cstyle-cast): SIG_IGN macro
     signal(SIGCHLD, SIG_IGN);
     signal(SIGTERM, sigTermHandler);
 
@@ -2781,7 +2783,7 @@ int main(int argc, char** argv)
 #ifdef HAVE_LIBSODIUM
     if (sodium_init() == -1) {
       cerr<<"Unable to initialize crypto library"<<endl;
-      // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic): argv
+      // NOLINTNEXTLINE(concurrency-mt-unsafe): only on thread at this point
       exit(EXIT_FAILURE);
     }
 #endif