Skip to content

Fix/12397 Prepare for prerealese for Suriconf 1.1.0-dev.2 v2 - #37

Merged
KEIAHNY merged 6 commits into
mainfrom
12397-fix-1.1.0-dev.2-v2
Oct 2, 2026
Merged

KEIAHNY merged 6 commits into
mainfrom
12397-fix-1.1.0-dev.2-v2

Conversation

@KEIAHNY

@KEIAHNY KEIAHNY commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

PR Type

Bug fix, Documentation


Description

  • Fix CPU affinity module to parse CPU set ranges

  • Apply 4x correction factor to defrag memcap

  • Increase Suricata shutdown timeout to 60s

  • Bump version to 1.1.0-dev.2, update docs


Diagram Walkthrough

flowchart LR
  A["max_cpu_usage_vec answers"] -- "parse ranges via yaml::insert_cpu" --> B["CpuAffinityModule::get_max_cpu_usage_vec"]
  C["yaml.rs helpers"] -- "made public" --> B
  D["defrag memcap calc"] -- "apply 4x factor" --> E["MemoryModule"]
  F["kill_suricata"] -- "timeout 30s to 60s" --> G["Suricata shutdown"]
Loading

File Walkthrough

Relevant files
Bug fix
3 files
cpu_affinity.rs
Add CPU set range parsing for max_cpu_usage_vec                   
+28/-4   
memory_usage.rs
Apply 4x correction factor to defrag memcap                           
+1/-1     
suricata.rs
Increase Suricata shutdown timeout to 60 seconds                 
+1/-1     
Enhancement
1 files
yaml.rs
Make CPU range parsing helpers public                                       
+2/-2     
Configuration changes
2 files
Cargo.toml
Bump version to 1.1.0-dev.2                                                           
+1/-1     
suriconf.yaml
Update version and CPU vector example range                           
+2/-2     
Documentation
2 files
ISSUES.md
Update known issues list                                                                 
+3/-2     
README.md
Update version references to 1.1.0-dev.2                                 
+6/-6     

@KEIAHNY KEIAHNY self-assigned this Oct 2, 2026
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Reject non-integer CPU numbers explicitly

A floating-point JSON number (e.g., 2.0) will be stringified as "2.0" and then fail
to parse as a CPU index inside insert_cpu. Restrict the numeric arm to integers so
invalid values are rejected with the clear "Invalid CPU" message instead of a
confusing parse error.

src/cpu_affinity.rs [466-470]

             let s = match item {
-                Value::Number(n) => n.to_string(),
+                Value::Number(n) if n.is_u64() => n.to_string(),
                 Value::String(s) => s.clone(),
                 u => panic!("Invalid CPU {:?}.", u)
             };
Suggestion importance[1-10]: 3

__

Why: Adding the n.is_u64() guard correctly prevents floats like 2.0 from being stringified and producing a confusing downstream parse error in insert_cpu. It is a valid but minor robustness/readability improvement to error handling.

Low
Name the hotfix multiplier constant

*The bare 4.0 is an undocumented hotfix multiplier that significantly changes the
computed defrag_memcap. Extract it into a named constant with a comment referencing
the open analysis item in ISSUES.md so its purpose and temporary nature are clear to
future maintainers.

src/memory_usage.rs [455]

-        hashsize*DEFRAG_TRACKER_HASHROW+(max_defrag_tracker_active+(self.get_ippair_host_defrag_stream_reassembly_prealloc(answers, &HashType::Defrag) as f64)*MULTIPLIER)*DEFRAG_TRACKER*4.0
+        // Temporary hotfix multiplier for defrag_memcap; accounts for unmodeled memory
+        // components. Needs further analysis (see ISSUES.md).
+        const DEFRAG_MEMCAP_HOTFIX_MULTIPLIER: f64 = 4.0;
+        hashsize*DEFRAG_TRACKER_HASHROW+(max_defrag_tracker_active+(self.get_ippair_host_defrag_stream_reassembly_prealloc(answers, &HashType::Defrag) as f64)*MULTIPLIER)*DEFRAG_TRACKER*DEFRAG_MEMCAP_HOTFIX_MULTIPLIER
Suggestion importance[1-10]: 2

__

Why: Replacing the magic number *4.0 with a named, commented constant slightly improves readability given the hotfix note in ISSUES.md. However, it is a purely cosmetic/documentation change with no functional impact on the PR's correctness.

Low
  • Author self-review: I have reviewed the PR code suggestions, and addressed the relevant ones.

@KEIAHNY
KEIAHNY merged commit 325c4af into main Oct 2, 2026
3 checks passed
@KEIAHNY
KEIAHNY deleted the 12397-fix-1.1.0-dev.2-v2 branch October 2, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant