Skip to content

stream/tcp: add tcp.async_stream stats counter - v2#15089

Open
jufajardini wants to merge 1 commit intoOISF:mainfrom
jufajardini:8339-async-counters/v2
Open

stream/tcp: add tcp.async_stream stats counter - v2#15089
jufajardini wants to merge 1 commit intoOISF:mainfrom
jufajardini:8339-async-counters/v2

Conversation

@jufajardini
Copy link
Copy Markdown
Contributor

@jufajardini jufajardini commented Mar 23, 2026

The counter is incremented when the engine detects an asynchronous TCP stream and stream.async-oneside: true.

Same as with midstream pickups, we want more visibility into when the engine is applying this setting.

Task #8339
Link to ticket: https://redmine.openinfosecfoundation.org/issues/

Previous PR: #14967

Describe changes:

  • remove commit that removed logic for setting the ASYNC flag in a valid packet (we first want to make sure there's "harm" in flagging, and that this isn't something that would impact negatively the engine (since the engine removes the flag in a further step, if it interprets if the stream isn't async)
  • decrease the async.oneside counter when the engine sees traffic from the other direction
  • rebase

Provide values to any of the below to override the defaults.

SV_BRANCH=OISF/suricata-verify#2955

The counter is incremented when the engine detects an asynchronous TCP
stream and stream.async-oneside: true.

Same as with midstream pickups, we want more visibility into when the
engine is applying this setting.

Task OISF#8339
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.58%. Comparing base (bc4a055) to head (a3282da).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15089      +/-   ##
==========================================
- Coverage   82.61%   82.58%   -0.03%     
==========================================
  Files         990      990              
  Lines      271655   271661       +6     
==========================================
- Hits       224415   224347      -68     
- Misses      47240    47314      +74     
Flag Coverage Δ
fuzzcorpus 61.03% <16.66%> (-0.01%) ⬇️
livemode 18.34% <16.66%> (-0.05%) ⬇️
netns 18.38% <16.66%> (-0.02%) ⬇️
pcap 45.26% <16.66%> (-0.02%) ⬇️
suricata-verify 66.12% <83.33%> (-0.02%) ⬇️
unittests 58.83% <50.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@suricata-qa
Copy link
Copy Markdown

WARNING:

field baseline test %
SURI_TLPR1_stats_chk
.app_layer.flow.ftp-data 607 577 95.06%
.tcp.async_stream - 0 -

Pipeline = 30478

Comment thread src/stream-tcp.c
if (!stream_config.async_oneside)
return 0;

StatsCounterIncr(&tv->stats, stt->counter_tcp_async_stream);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure we count the flow only once ?

If I have an async flow with client only : I see first syn, then packet ack

It looks like we update in StreamTcpPacketStateNone before doing StreamTcpPacketSetState(p, ssn, TCP_SYN_SENT);, then a second time here for the same flow

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, a flow with a single syn packet does not increase the counter, but has STREAMTCP_FLAG_ASYNC

Maybe DEBUG_VALIDATION to ensure we count the flow only once

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants