]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
style: remove latest warnings 6528/head
authorPhilippe Antoine <contact@catenacyber.fr>
Fri, 24 Sep 2021 13:42:50 +0000 (15:42 +0200)
committerVictor Julien <victor@inliniac.net>
Sat, 16 Oct 2021 15:46:27 +0000 (17:46 +0200)
about unused variables

(cherry picked from commit cb30772372234b88787676eff865e43ce6793cad)

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

index ba159e8d30086f1730a473f1d2af96432a698633..19131b0fb325db91dafbb1f35c28050be413f7e9 100644 (file)
@@ -50,7 +50,6 @@ impl FileChunk {
 
 #[derive(Debug)]
 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,
@@ -71,7 +70,6 @@ pub struct FileTransferTracker {
 impl FileTransferTracker {
     pub fn new() -> FileTransferTracker {
         FileTransferTracker {
-            file_size:0,
             tracked:0,
             cur_ooo:0,
             track_id:0,
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 2d48bbf545b07ccc7897514f5c67b0eee51772f0..a87329f274001669a9c3a6da5e5f7351efcbb452 100644 (file)
@@ -1116,9 +1116,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;
     }
@@ -1185,7 +1186,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 ecd21f868429275ae60e1ceb4e0ef9918cd91f76..238f8449563f8b5f83f73fe1a6436a09a3f07b3a 100644 (file)
@@ -628,7 +628,6 @@ static json_t *RulesGroupPrintSghStats(const SigGroupHead *sgh,
     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;
 
@@ -737,7 +736,6 @@ static json_t *RulesGroupPrintSghStats(const SigGroupHead *sgh,
             }
 
             uint32_t w = PatternStrength(cd->content, cd->content_len);
-            mpms_total += w;
             if (mpms_min == 0)
                 mpms_min = w;
             if (w < mpms_min)
index 76d6ac852a25f09096cbd1c1f016e7ec7a557eb8..e0adc83c5ec8e69ba745864e4a748c5227d12763 100644 (file)
@@ -796,8 +796,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();
@@ -893,9 +895,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 */
@@ -911,8 +915,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;