From: Philippe Antoine Date: Fri, 24 Sep 2021 13:42:50 +0000 (+0200) Subject: style: remove latest warnings X-Git-Tag: suricata-6.0.4~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f992e2adb1898d203905cc728f364e12d0a47b0e;p=thirdparty%2Fsuricata.git style: remove latest warnings about unused variables (cherry picked from commit cb30772372234b88787676eff865e43ce6793cad) --- diff --git a/rust/src/filetracker.rs b/rust/src/filetracker.rs index ba159e8d30..19131b0fb3 100644 --- a/rust/src/filetracker.rs +++ b/rust/src/filetracker.rs @@ -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, diff --git a/rust/src/jsonbuilder.rs b/rust/src/jsonbuilder.rs index f8549af34b..7f85692246 100644 --- a/rust/src/jsonbuilder.rs +++ b/rust/src/jsonbuilder.rs @@ -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 diff --git a/src/detect-engine-analyzer.c b/src/detect-engine-analyzer.c index 2d48bbf545..a87329f274 100644 --- a/src/detect-engine-analyzer.c +++ b/src/detect-engine-analyzer.c @@ -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++) { diff --git a/src/detect-engine-build.c b/src/detect-engine-build.c index ecd21f8684..238f844956 100644 --- a/src/detect-engine-build.c +++ b/src/detect-engine-build.c @@ -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) diff --git a/src/flow-manager.c b/src/flow-manager.c index 76d6ac852a..e0adc83c5e 100644 --- a/src/flow-manager.c +++ b/src/flow-manager.c @@ -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;