pcap-file: synchronize PCAP filename output v4#13656
Closed
lukashino wants to merge 3 commits into
Closed
Conversation
PcapFileInfo is a structure which will be referenced by packets/flows. Ticket: 5255
When RX thread was reading packets from multiple PCAPs, it held internally pcap_filename variable of the currently processed PCAP. This variable, accessed through PcapFileGetFilename(), was used to add pcap_filename property to all eve.json events by all threads. However, as RX thread is connected to Worker/Detect threads with queues, packets of previous PCAPs were still in queues, while RX thread was reading different PCAPs. This is a synchronizaiton issue. PcapFileInfo structure is used to reference the PCAP file name. RX thread associates the structure with all packets, Workers in turn associate the flow with the filename. PcapFileGetFilename() is still used when reporting stats events. Ticket: 5255
When reading with Unix socket the same file over and over again, Suricata crashed when it did not have permissions to write to a logging directory.
catenacyber
reviewed
Jul 28, 2025
| static uint32_t OutputTxLoggerGetActiveCount(void) | ||
| { | ||
| uint32_t cnt = 0; | ||
| if (list == NULL) { |
Contributor
There was a problem hiding this comment.
This is done better in #13616 (ie with ticket number in message) ;-)
Contributor
Author
There was a problem hiding this comment.
Good point, thanks, I'll retract the commit.
Contributor
Author
|
New PR in #13657 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #13656 +/- ##
==========================================
+ Coverage 83.69% 83.71% +0.01%
==========================================
Files 1011 1012 +1
Lines 275071 275121 +50
==========================================
+ Hits 230230 230312 +82
+ Misses 44841 44809 -32
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up of #13653
Link to ticket: https://redmine.openinfosecfoundation.org/issues/5255
Describe changes:
v4:
v3:
v2:
v1:
When RX thread was reading packets from multiple PCAPs, it held
internally pcap_filename variable of the currently processed PCAP.
This variable, accessed through PcapFileGetFilename(), was used to add
pcap_filename property to all eve.json events by all threads.
However, as RX thread is connected to Worker/Detect threads with queues,
packets of previous PCAPs were still in queues, while RX thread was
reading different PCAPs. This is a synchronizaiton issue.
PcapFileInfo structure is used to reference the PCAP file name. RX
thread associates the structure with all packets, Workers in turn
associate the flow with the filename. PcapFileGetFilename() is still
used when reporting stats events.