-
Notifications
You must be signed in to change notification settings - Fork 1.6k
pcap: refactor delete-when-done to support non-alerts; handle pseudo-… #14442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…packet alerts Refactor pcap file deletion to use a single delete-when-done option with three values instead of separate boolean options: - false (default): No deletion - true: Always delete files - "non-alerts": Delete only files with no alerts Also account for alerts produced by pseudo packets (flow timeout / shutdown flush): - Introduce small capture hooks and invoke on pseudo-packet creation so the capture layer can retain references and observe alerts emitted after the last live packet - Call the hook from both TmThreadDisableReceiveThreads and TmThreadDrainPacketThreads Key changes: - Replace should_delete/delete_non_alerts_only bools with enum - Move alert counter from global to per-file PcapFileFileVars - Relocate alert counting from PacketAlertFinalize to pcap module - Ensure thread safety for both single and continuous pcap modes - Add unit tests for configuration parsing and pseudo-packet alert path The --pcap-file-delete command line option overrides YAML config and forces "always delete" mode for backward compatibility. Documentation updated to reflect the new three-value configuration. Fixes OISF#7786
|
NOTE: This PR may contain new authors. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #14442 +/- ##
==========================================
+ Coverage 84.20% 84.22% +0.02%
==========================================
Files 1013 1014 +1
Lines 262383 262788 +405
==========================================
+ Hits 220936 221345 +409
+ Misses 41447 41443 -4
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
|
||
| **For more control**, use the ``pcap-file.delete-when-done`` configuration | ||
| option instead, which supports three values: | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit extra space
catenacyber
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the big work :-)
CI : ✅
Code : was the capture hooks design validated ? Does it mean that one alert on flow timeout can belong to multiple pcaps ?
Commits segmentation : ok... was it not possible to split in smaller commits ?
Commit messages : really good
Git ID set : looks fine for me
CLA : you say you signed it
Doc update : looks good to me
Redmine ticket : ok
Rustfmt : no rust
Tests : put some comments there, but look good
Dependencies added: none
Make sure these boxes are checked accordingly before submitting your Pull Request -- thank you.
Contribution style:
https://docs.suricata.io/en/latest/devguide/contributing/contribution-process.html
Our Contribution agreements:
https://suricata.io/about/contribution-agreement/ (note: this is only required once)
Changes (if applicable):
(including schema descriptions)
https://redmine.openinfosecfoundation.org/issues/7786?next_issue_id=7785
Describe changes:
Allowing change the behaviour of --pcap-file-delete to only delete pcaps with no alerts via config.
Previous PR: #14151
Changes:
Provide values to any of the below to override the defaults.
link to the pull request in the respective
_BRANCHvariable.SV_BRANCH=OISF/suricata-verify#2799