Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

stream: improve 3whs completed by ACK with data #11805

Closed

Conversation

victorjulien
Copy link
Member

@victorjulien victorjulien commented Sep 20, 2024

If the ACK completing the 3whs, the stream engine will transition to "established". However, the packet itself will not be tagged as "established". This will only happen for the next packet after the 3whs, so that flow:established only matches after the 3whs.

It is also possible that the ACK completing the 3whs was lost. Since the ACK packets themself are not acknoledged, there will be no retransmission of them. Instead, the next packet can have the ACK flag as well as data.

This case was mishandled in a suble way. The stream engine state transition was done correctly, as well as the data handling and app-layer updates. However, the packet itself was not tagged as "established", which meant that flow:established would not yet match.

This patch detects this case and tags the packet as established if ACK with data is received that completes the 3whs.

Bug: #7264.

SV_BRANCH=OISF/suricata-verify#2051

If the ACK completing the 3whs, the stream engine will transition
to "established". However, the packet itself will not be tagged as
"established". This will only happen for the next packet after the 3whs,
so that `flow:established` only matches after the 3whs.

It is also possible that the ACK completing the 3whs was lost. Since the
ACK packets themself are not acknoledged, there will be no
retransmission of them. Instead, the next packet can have the ACK flag
as well as data.

This case was mishandled in a suble way. The stream engine state
transition was done correctly, as well as the data handling and
app-layer updates. However, the packet itself was not tagged as
"established", which meant that `flow:established` would not yet match.

This patch detects this case and tags the packet as established if ACK
with data is received that completes the 3whs.

Bug: OISF#7264.
Copy link

codecov bot commented Sep 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (master@1420c83). Learn more about missing BASE report.
Report is 23 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master   #11805   +/-   ##
=========================================
  Coverage          ?   82.59%           
=========================================
  Files             ?      919           
  Lines             ?   249009           
  Branches          ?        0           
=========================================
  Hits              ?   205664           
  Misses            ?    43345           
  Partials          ?        0           
Flag Coverage Δ
fuzzcorpus 60.47% <100.00%> (?)
livemode 18.71% <0.00%> (?)
pcap 44.17% <100.00%> (?)
suricata-verify 61.91% <100.00%> (?)
unittests 58.99% <50.00%> (?)

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

@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 22761

Copy link
Contributor

@catenacyber catenacyber left a comment

Choose a reason for hiding this comment

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

Thanks for the work.
Mostly ok, the commit message can be improved a bit I think.

CI : ok
Commits segmentation : ok
Commit messages : 🟠 typos acknoledged suble, also If the ACK completing the 3whs does not seem right English syntax to me...
Git ID set : ok
CLA : you already contributed
Doc update : not needed
Redmine ticket : 🟡 should it not be back ported ?
Rustfmt : no rust
Tests : nice, thanks
Dependencies added: none
Code : good

@jufajardini
Copy link
Contributor

jufajardini commented Sep 23, 2024

CI : ok Commits segmentation : ok Commit messages : 🟠 typos acknoledged suble, also If the ACK completing the 3whs does not seem right English syntax to me...

not sure, but, I think it should also be s/themself/themselves

@victorjulien
Copy link
Member Author

replaced by #11821

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants