tests: verify pcap_filename on alert and flow events - v2#2932
Open
oferda4 wants to merge 1 commit intoOISF:masterfrom
Open
tests: verify pcap_filename on alert and flow events - v2#2932oferda4 wants to merge 1 commit intoOISF:masterfrom
oferda4 wants to merge 1 commit intoOISF:masterfrom
Conversation
Add three suricata-verify tests that together cover all code paths in the pcap_filename output for pcap-file mode: pcap-filename-alert-and-flow: single pcap, verifies pcap_filename is present in alert events (p != NULL path in OutputJsonBuilderBuffer) and flow events (p == NULL, falls back to FlowGetPcapFileVars). pcap-filename-pseudo-pkts: verifies pcap_filename is present in fileinfo events generated by stream pseudo-packets (PKT_SRC_STREAM_TCP_DETECTLOG_FLUSH), which carry pcap_v.pfv propagated from the flow. pcap-filename-recursive: two pcap files fed with --pcap-file-recursive. alert.pcap is processed first; http.pcap is processed last. Verifies that the flow event for the alert.pcap connection still reports alert.pcap (via the per-flow pfv), not the stale global that has advanced to http.pcap. This is the primary race-condition regression test for #5255. Ticket: #5255
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.
Add a regression test that checks the pcap_filename field is present and correct in EVE JSON output for both alert events (packet-based) and flow events (non-packet-based).
These two code paths use different sources for the filename in OutputJsonBuilderBuffer: per-packet pfv->filename when a packet is available, and the global PcapFileGetFilename() fallback for flow/netflow events where no packet exists.
Previous PR: #2927
v2:
- Fix recursive test and readme.
Redmine ticket: https://redmine.openinfosecfoundation.org/issues/5255
Suricata PR: OISF/suricata#14868