]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
style: remove latest warnings
authorPhilippe Antoine <contact@catenacyber.fr>
Fri, 24 Sep 2021 13:42:50 +0000 (15:42 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 29 Sep 2021 12:51:59 +0000 (14:51 +0200)
about unused variables

rust/src/filetracker.rs
rust/src/jsonbuilder.rs
src/detect-engine-analyzer.c
src/detect-engine-build.c
src/flow-manager.c

index d820dd8aa4fd5ba8668a8ede590d9620b970de98..bf9d5be96f05592dcaabbad7bf637c4991292e27 100644 (file)
@@ -51,7 +51,6 @@ impl FileChunk {
 #[derive(Debug)]
 #[derive(Default)]
 pub struct FileTransferTracker {
-    file_size: u64,
     pub tracked: u64,
     cur_ooo: u64,   // how many bytes do we have queued from ooo chunks
     track_id: u32,
index f8549af34b6c7e032a5cb3763598bc90efe301a0..7f8569224641a0acb9e716582adcf8208c270df9 100644 (file)
@@ -78,13 +78,6 @@ impl State {
     }
 }
 
-#[derive(Debug, Clone)]
-struct Mark {
-    position: usize,
-    state_index: usize,
-    state: State,
-}
-
 /// A "mark" or saved state for a JsonBuilder object.
 ///
 /// The name is full, and the types are u64 as this object is used
index bf6f3affd12841a70a4d14f7ce9a73ff1271bd33..7ca4bf357350570a88c29788f099a5fc3d70bf60 100644 (file)
@@ -1468,9 +1468,10 @@ void EngineAnalysisRules(const DetectEngineCtx *de_ctx,
     if (rule_content == 1) {
          //todo: warning if content is weak, separate warning for pcre + weak content
     }
-    if (rule_flow == 0 && rule_flags == 0
-        && !(s->proto.flags & DETECT_PROTO_ANY) && DetectProtoContainsProto(&s->proto, IPPROTO_TCP)
-        && (rule_content || rule_content_http || rule_pcre || rule_pcre_http || rule_flowbits || rule_flowint)) {
+    if (rule_flow == 0 && rule_flags == 0 && !(s->proto.flags & DETECT_PROTO_ANY) &&
+            DetectProtoContainsProto(&s->proto, IPPROTO_TCP) &&
+            (rule_content || rule_content_http || rule_pcre || rule_pcre_http || rule_flowbits ||
+                    rule_flowint)) {
         rule_warning += 1;
         warn_tcp_no_flow = 1;
     }
@@ -1537,7 +1538,8 @@ void EngineAnalysisRules(const DetectEngineCtx *de_ctx,
         if (rule_ipv6_only) fprintf(rule_engine_analysis_FD, "    Rule is IPv6 only.\n");
         if (rule_ipv4_only) fprintf(rule_engine_analysis_FD, "    Rule is IPv4 only.\n");
         if (packet_buf) fprintf(rule_engine_analysis_FD, "    Rule matches on packets.\n");
-        if (!rule_flow_nostream && stream_buf && (rule_flow || rule_flowbits || rule_flowint || rule_content || rule_pcre)) {
+        if (!rule_flow_nostream && stream_buf &&
+                (rule_flow || rule_flowbits || rule_flowint || rule_content || rule_pcre)) {
             fprintf(rule_engine_analysis_FD, "    Rule matches on reassembled stream.\n");
         }
         for(size_t i = 0; i < ARRAY_SIZE(analyzer_items); i++) {
index c5eef029f4bf5eb5c307486e2784ef0617d43790..b86c2c2045d34d6d922e8b3ba56c13c9615d4cf6 100644 (file)
@@ -629,7 +629,6 @@ static json_t *RulesGroupPrintSghStats(const DetectEngineCtx *de_ctx, const SigG
     uint32_t payload_no_mpm_cnt = 0;
     uint32_t syn_cnt = 0;
 
-    uint32_t mpms_total = 0;
     uint32_t mpms_min = 0;
     uint32_t mpms_max = 0;
 
@@ -741,7 +740,6 @@ static json_t *RulesGroupPrintSghStats(const DetectEngineCtx *de_ctx, const SigG
             }
 
             uint32_t w = PatternStrength(cd->content, cd->content_len);
-            mpms_total += w;
             if (mpms_min == 0)
                 mpms_min = w;
             if (w < mpms_min)
index cc07fed446ed567c31b9522bcc1d342aebd37637..0bba6ac586b34ef00af851027a863ed22aeab0f5 100644 (file)
@@ -807,8 +807,10 @@ static TmEcode FlowManager(ThreadVars *th_v, void *thread_data)
 */
     memset(&ts, 0, sizeof(ts));
     uint32_t hash_passes = 0;
+#ifdef FM_PROFILE
     uint32_t hash_row_checks = 0;
     uint32_t hash_passes_chunks = 0;
+#endif
     uint32_t hash_full_passes = 0;
 
     const uint32_t min_timeout = FlowTimeoutsMin();
@@ -904,9 +906,11 @@ static TmEcode FlowManager(ThreadVars *th_v, void *thread_data)
                 FlowTimeoutHash(&ftd->timeout, &ts, ftd->min, ftd->max, &counters);
                 hash_passes++;
                 hash_full_passes++;
-                hash_passes_chunks += 1;
                 hash_passes++;
+#ifdef FM_PROFILE
+                hash_passes_chunks += 1;
                 hash_row_checks += counters.rows_checked;
+#endif
                 StatsIncr(th_v, ftd->cnt.flow_mgr_full_pass);
             } else {
                 /* non-emergency mode: scan part of the hash */
@@ -922,8 +926,10 @@ static TmEcode FlowManager(ThreadVars *th_v, void *thread_data)
                     }
                 }
                 hash_passes++;
+#ifdef FM_PROFILE
                 hash_row_checks += counters.rows_checked;
                 hash_passes_chunks += chunks;
+#endif
             }
             flow_last_sec = rt;