]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
src: fix remaining cppclean warnings
authorPhilippe Antoine <pantoine@oisf.net>
Thu, 3 Nov 2022 09:09:11 +0000 (10:09 +0100)
committerVictor Julien <vjulien@oisf.net>
Fri, 18 Nov 2022 07:27:01 +0000 (08:27 +0100)
35 files changed:
scripts/cppclean_check.py
src/alert-fastlog.c
src/alert-syslog.c
src/decode.c
src/decode.h
src/defrag-queue.h
src/defrag.h
src/detect-engine-alert.c
src/detect-engine-threshold.c
src/detect-http-headers-stub.h
src/detect-parse.c
src/detect.c
src/device-storage.c
src/device-storage.h
src/flow-bypass.h
src/flow-storage.c
src/flow-storage.h
src/output-json-alert.c
src/output-json-drop.c
src/packet.c
src/reputation.c
src/reputation.h
src/source-af-packet.c
src/source-dpdk.c
src/stream-tcp-cache.c
src/stream-tcp-cache.h
src/stream-tcp.c
src/threads-profile.h
src/tmqh-packetpool.c
src/util-debug-filters.h
src/util-exception-policy.c
src/util-lua-common.c
src/util-privs.h
src/util-profiling.h
src/util-unittest-helper.h

index 6689ab392f7fe827f1d2a112bc32c9e598eef045..ccd2a4d9ea2f949a5fe65b6f1a51c8b8e95ee916 100644 (file)
@@ -17,12 +17,27 @@ for l in sys.stdin:
     if included == "conf.h" and includer == "src/suricata-plugin.h":
         # SCEveFileType structure field Init being a function pointer using a parameter ConfNode defined in conf.h
         continue
+    if included == "util-prefilter.h" and includer == "src/util-mpm.h":
+        # MpmTableElmt_ structure field Search being a function pointer using a parameter PrefilterRuleStore
+        continue
+    if included == "flow.h" and includer == "src/output-tx.h":
+        # TxLogger type being a function pointer using a parameter Flow
+        continue
     if included == "util-debug-filters.h" and includer == "src/util-debug.h":
         # Macro SCEnter using SCLogCheckFDFilterEntry defined in util-debug-filters.h
         continue
     if included == "util-spm-bs.h" and includer == "src/util-spm.h":
         # Macro SpmSearch using BasicSearch defined in util-spm-bs.h
         continue
+    if included == "util-cpu.h" and includer == "src/threads-profile.h":
+        # Macro SCSpinLock_profile using UtilCpuGetTicks
+        continue
+    if included == "util-profiling-locks.h" and includer == "src/util-profiling.h":
+        # Macro SCSpinLock_profile using SCProfilingAddPacketLocks
+        continue
+    if included == "threads.h" and includer == "src/util-debug-filters.h":
+        # pthread_t needed on Windows
+        continue
 
     print("Unnecessary include from %s for %s" % (includer, included))
     retcode = 1
index d0b5e5353c329626e2584972a1773d80c13a75e5..f71744698167052983cbaf7ba0da87ff3258e6c1 100644 (file)
@@ -54,6 +54,8 @@
 #include "util-logopenfile.h"
 #include "util-time.h"
 
+#include "action-globals.h"
+
 #define DEFAULT_LOG_FILENAME "fast.log"
 
 #define MODULE_NAME "AlertFastLog"
index d1397fd85d3a14f2a4e6894240f2c44dbf253fb3..86593f54dae45fdf88c740295765ff1dfa212b10 100644 (file)
@@ -48,6 +48,7 @@
 #include "util-syslog.h"
 #include "util-optimize.h"
 #include "util-logopenfile.h"
+#include "action-globals.h"
 
 #ifndef OS_WIN32
 
index 3ffb7a54f4fd29bc54cc0b6910aafefed27bc41d..a4e7e2a16a0f06a21c7889b599c840da93c918c8 100644 (file)
@@ -67,6 +67,7 @@
 #include "util-print.h"
 #include "util-profiling.h"
 #include "util-validate.h"
+#include "action-globals.h"
 
 uint32_t default_packet_size = 0;
 extern bool stats_decoder_events;
index 92ba3a29264e122b16e1d36df606fe32b2b93621..df2613aefa97f01f532bffab25640999cf38ddaa 100644 (file)
@@ -79,8 +79,6 @@ enum PktSrcEnum {
 #include "source-pfring.h"
 #endif
 
-#include "action-globals.h"
-
 #include "decode-ethernet.h"
 #include "decode-gre.h"
 #include "decode-ppp.h"
index 4607770bdf45d9d5462e5dbc41e74da8485bf56b..63a58d0786450175aad8b103636d9234cb2978f5 100644 (file)
@@ -25,7 +25,6 @@
 #define __DEFRAG_QUEUE_H__
 
 #include "suricata-common.h"
-#include "decode.h"
 #include "defrag.h"
 
 /** Spinlocks or Mutex for the defrag tracker queues. */
index ac964823b84a91483b23aa2e07ef2e5aeef75508..854766299cefc74d3f3c0af3732d01a787549096 100644 (file)
@@ -26,6 +26,8 @@
 
 #include "threads.h"
 #include "util-pool.h"
+#include "threadvars.h"
+#include "decode.h"
 
 /**
  * A context for an instance of a fragmentation re-assembler, in case
index cc917a5a8456c4fd68b4020be2d1abd74edacdeb..b9440b8abf6be0aa793bd8643a16a5856d61fb76 100644 (file)
@@ -35,6 +35,8 @@
 #include "util-profiling.h"
 #include "util-validate.h"
 
+#include "action-globals.h"
+
 /** tag signature we use for tag alerts */
 static Signature g_tag_signature;
 /** tag packet alert structure for tag alerts */
index 3952ecc2cd4bde0471001c88d26a53b1036eb8dc..c007197c07aed218184f8f022fa2c983dbcb773f 100644 (file)
@@ -68,6 +68,8 @@
 #include "util-var-name.h"
 #include "tm-threads.h"
 
+#include "action-globals.h"
+
 static HostStorageId host_threshold_id = { .id = -1 };     /**< host storage id for thresholds */
 static IPPairStorageId ippair_threshold_id = { .id = -1 }; /**< ip pair storage id for thresholds */
 
index f158a2c0e0f7a7d8de594af5f5017fe1f26583ac..ef3712b6714e222f5ad233e6a49665b5ea144cbb 100644 (file)
@@ -29,7 +29,7 @@
 #include "suricata-common.h"
 #include "flow.h"
 
-#include "app-layer-htp.h"
+#include <htp/htp.h>
 
 #include "detect.h"
 #include "detect-parse.h"
index b0c3e5a574770edfb6df051cf2e97a537076667f..dca3b3e06d80c2aa24bd91c6e1d8f931f3d46858 100644 (file)
@@ -70,6 +70,8 @@
 #include "detect-engine-iponly.h"
 #include "app-layer-detect-proto.h"
 
+#include "action-globals.h"
+
 /* Table with all SigMatch registrations */
 SigTableElmt sigmatch_table[DETECT_TBLSIZE];
 
index 298fb22df2ad66f68a5c5e3a1699673187d37467..083af5c87a92aa19a86acbca4bad38221be52b17 100644 (file)
@@ -65,6 +65,8 @@
 #include "util-detect.h"
 #include "util-profiling.h"
 
+#include "action-globals.h"
+
 typedef struct DetectRunScratchpad {
     const AppProto alproto;
     const uint8_t flow_flags; /* flow/state flags: STREAM_* */
index d01ff41f2bff1c80c8064a09b9cbcfb9d7ee5908..f424888ecfccbda337c5ab1c37188352e1cfc05d 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "suricata-common.h"
 #include "device-storage.h"
+#include "util-storage.h"
 #include "util-unittest.h"
 
 unsigned int LiveDevStorageSize(void)
index 87ef61ff4401e8d5ff28e5c7c49faba0fd0575ef..49fb59761df4e269ab3dfc835716928d07292abe 100644 (file)
@@ -27,7 +27,6 @@
 #define __DEVICE_STORAGE_H__
 
 #include "util-device.h"
-#include "util-storage.h"
 
 typedef struct LiveDevStorageId_ {
     int id;
index 4e2721583f24ebeafc3a670bcd8c7411332a1d17..d1a764b50d4e31f1ca6b1519321c4a2e094e5096 100644 (file)
@@ -24,7 +24,6 @@
 #ifndef __FLOW_BYPASS_H__
 #define __FLOW_BYPASS_H__
 
-#include "threadvars.h"
 #include "flow.h"
 
 struct flows_stats {
index d1146542d92d085fe7871656d5d86a5b49fddb0b..1ce9c07948d626a8ac06f5df69c338abb4941861 100644 (file)
@@ -29,6 +29,7 @@
 #include "flow-storage.h"
 #include "flow-hash.h"
 #include "flow-util.h"
+#include "util-storage.h"
 #include "util-unittest.h"
 
 unsigned int FlowStorageSize(void)
index 29a0496a385892b0d1d6adc6a540b22437d3a206..6fd8beef32a9dc6ba62beba2856813061a61f7c7 100644 (file)
@@ -27,7 +27,6 @@
 #define __FLOW_STORAGE_H__
 
 #include "flow.h"
-#include "util-storage.h"
 
 typedef struct FlowStorageId {
     int id;
index bedf12e13a2927109643db8a66289b791e33f4f1..824e7ea680610f4b40d7428f0479b7dacde23436 100644 (file)
@@ -88,6 +88,8 @@
 #include "util-buffer.h"
 #include "util-validate.h"
 
+#include "action-globals.h"
+
 #define MODULE_NAME "JsonAlertLog"
 
 #define LOG_JSON_PAYLOAD           BIT_U16(0)
index 1177c326079c95635f5a36dee366fb822fe7e5d3..0b7609c435205a21cd9942b8a27364ae89a4814c 100644 (file)
@@ -56,6 +56,8 @@
 #include "util-time.h"
 #include "util-buffer.h"
 
+#include "action-globals.h"
+
 #define MODULE_NAME "JsonDropLog"
 
 #define LOG_DROP_ALERTS 1
index b85e3dcff0eca76cd96870e45562a53c878d9595..6619df47f572f5393b09f0770677817251f9260f 100644 (file)
@@ -21,6 +21,7 @@
 #include "host.h"
 #include "util-profiling.h"
 #include "util-validate.h"
+#include "action-globals.h"
 
 /** \brief issue drop action
  *
index 18c5c157417242f33d4efdeaee108a7ccf4cb163..e6907c8b159f045cd50ac3709a19fc8dda7c03e1 100644 (file)
@@ -26,6 +26,7 @@
  */
 
 #include "suricata-common.h"
+#include "detect.h"
 #include "reputation.h"
 #include "threads.h"
 #include "conf.h"
index 8c8369dd7477dcd6cdff510e5924f547eb80710e..3ed94d9851596aca8c8b68cda6d02efd7c3fc6b9 100644 (file)
@@ -42,8 +42,6 @@ typedef struct SReputation_ {
     uint8_t rep[SREP_MAX_CATS];
 } SReputation;
 
-#include "detect.h"
-
 void SRepFreeHostData(Host *h);
 uint8_t SRepCatGetByShortname(char *shortname);
 int SRepInit(struct DetectEngineCtx_ *de_ctx);
index b0445eef23ef9e9abda523a83b101203888c256e..dcdce96501f581bc229687a3cd95617388b87807 100644 (file)
@@ -60,6 +60,7 @@
 #include "runmodes.h"
 #include "flow-storage.h"
 #include "util-validate.h"
+#include "action-globals.h"
 
 #ifdef HAVE_AF_PACKET
 
index ce9cc8618f3e60813987d0b740e3ce546f565104..207d56d701ba0041dca909a16b3feceeafd41dfb 100644 (file)
@@ -41,6 +41,7 @@
 #include "tm-threads.h"
 #include "tmqh-packetpool.h"
 #include "util-privs.h"
+#include "action-globals.h"
 
 #ifndef HAVE_DPDK
 
index 60b0aa2afe1dc03c60207772deab987a6e9202db..c5a9e30e473fdee6c6ed161ccce64d6abed1e110 100644 (file)
@@ -25,6 +25,7 @@
 #include "suricata.h"
 #include "stream-tcp-private.h"
 #include "stream-tcp-cache.h"
+#include "util-debug.h"
 
 typedef struct TcpPoolCache {
     bool cache_enabled; /**< cache should only be enabled for worker threads */
index 1a61532a153d88c645fed3028644e1bef79c10be..fc67bc82eb9bf71881cb45cd633c1a87e43dd5c7 100644 (file)
@@ -24,8 +24,6 @@
 #ifndef __STREAM_TCP_CACHE_H__
 #define __STREAM_TCP_CACHE_H__
 
-#include "suricata.h"
-#include "flow.h"
 #include "stream-tcp-private.h"
 
 void StreamTcpThreadCacheEnable(void);
index 36a51511194540822e7780b5348eccd055def310..ddd0f89f198af34b5cbb87b2f2a25c5f44e86020 100644 (file)
@@ -78,6 +78,7 @@
 #include "util-time.h"
 
 #include "source-pcap-file.h"
+#include "action-globals.h"
 
 //#define DEBUG
 
index 6df3b4be67aa39d2fac42e2902f10b21c2fafac4..43606ae982907f0f144ecebdfcc5086dd7695ab0 100644 (file)
@@ -26,6 +26,7 @@
 #ifndef __THREADS_PROFILE_H__
 #define __THREADS_PROFILE_H__
 
+// UtilCpuGetTicks
 #include "util-cpu.h"
 
 #define PROFILING_MAX_LOCKS 64
index 7e36e0fef92c1948374ae20c89d437c564f63605..a7d33b8b6dd67d1e22b0de77cb61ac2d6a6b452b 100644 (file)
@@ -33,6 +33,7 @@
 #include "packet.h"
 #include "util-profiling.h"
 #include "util-validate.h"
+#include "action-globals.h"
 
 /* Number of freed packet to save for one pool before freeing them. */
 #define MAX_PENDING_RETURN_PACKETS 32
index a7994dccd0db032bb4a3e39b620e55afceefebda..e8e8e3fb1338afe2e70c665c53dd01fa61c49638 100644 (file)
@@ -24,6 +24,7 @@
 #ifndef __DEBUG_FILTERS_H__
 #define __DEBUG_FILTERS_H__
 
+// pthread_t
 #include "threads.h"
 
 /**
index 79f72013eb63f0381b91ada821d6c5203a4e1d24..2b0eaf379015e45933f38aff26f4cc0efc8a545c 100644 (file)
@@ -25,6 +25,7 @@
 #include "util-exception-policy.h"
 #include "util-misc.h"
 #include "stream-tcp-reassemble.h"
+#include "action-globals.h"
 
 void ExceptionPolicyApply(Packet *p, enum ExceptionPolicy policy, enum PacketDropReason drop_reason)
 {
index a014ae7bba4f62fd5a9f7c2d46099d9a6f0cca72..604c99e4b6a2e5ae89047eae29a06fa6ab3d52d0 100644 (file)
@@ -56,6 +56,7 @@
 
 #include "util-lua.h"
 #include "util-lua-common.h"
+#include "action-globals.h"
 
 int LuaCallbackError(lua_State *luastate, const char *msg)
 {
index 05592f63f9acd37496aae7470e5ba145f1c86ec4..739b0926eb074d0186b3fb7dae5276cf379f945c 100644 (file)
@@ -24,8 +24,6 @@
 #ifndef _UTIL_PRIVS_H
 #define        _UTIL_PRIVS_H
 
-#include "threadvars.h"
-
 #define SC_CAP_NONE             0x01
 #define SC_CAP_SYS_ADMIN        0x02
 #define SC_CAP_SYS_RAW_IO       0x04
 #define SC_CAP_NET_BIND_SERVICE 0x40
 #define SC_CAP_NET_BROADCAST    0x80
 
-#ifndef HAVE_LIBCAP_NG
-#define SCDropCaps(...)
-#define SCDropMainThreadCaps(...)
-#else
+#ifdef HAVE_LIBCAP_NG
 #include <cap-ng.h>
+#include "threadvars.h"
 
 /**Drop the previliges of the given thread tv, based on the thread cap_flags
  * which implies the capability requirement of the given thread. Initially all
@@ -89,6 +85,9 @@ void SCDropCaps(ThreadVars *tv);
 */
 void SCDropMainThreadCaps(uint32_t , uint32_t );
 
+#else
+#define SCDropCaps(...)
+#define SCDropMainThreadCaps(...)
 #endif /* HAVE_LIBCAP_NG */
 
 int SCGetUserID(const char *, const char *, uint32_t *, uint32_t *);
index b54f764d3a857cd938cdc0c9b2f3596bd31bebf2..11eb4c804afe38dfd0d6b1273b0deaf644b63c62 100644 (file)
@@ -28,7 +28,6 @@
 #ifdef PROFILING
 
 #include "detect.h"
-#include "util-cpu.h"
 #include "util-profiling-locks.h"
 
 extern int profiling_rules_enabled;
index edae52893c82b3ab778aeda315a798002282a599..b3b6d18aa4b0166b460b95f0bd4aa0b43dc39041 100644 (file)
@@ -25,7 +25,6 @@
 #define __UTIL_UNITTEST_HELPER__
 
 #if defined(UNITTESTS)
-#include "packet.h"
 #include "flow.h"
 #include "detect.h"
 #elif defined(FUZZ)