Skip to content

Conversation

Dimi1010
Copy link
Collaborator

The parseUntil is now fully inclusive and parses until it exhausts a sequence of target protocol types. This allows specifying target protocols that allow chaining of the same protocol types.

Simplified the rollback mechanism.

- The `parseUntil` is now fully inclusive and parses until it exhausts a sequence of target protocol types. This is to allow parsing until recursive layers that are followed by a layer of the same type.
- Readability improvements.
@Dimi1010 Dimi1010 changed the title Refactored the main packet parse loop. Fix inclusive parseUntil condition the main packet parse loop. Sep 12, 2025
@Dimi1010 Dimi1010 changed the title Fix inclusive parseUntil condition the main packet parse loop. Fix inclusive parseUntil condition in the main packet parse loop. Sep 12, 2025
Copy link

codecov bot commented Sep 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.50%. Comparing base (098dd4b) to head (580a14e).
⚠️ Report is 4 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1964      +/-   ##
==========================================
- Coverage   83.51%   83.50%   -0.01%     
==========================================
  Files         310      310              
  Lines       54884    54881       -3     
  Branches    12220    11896     -324     
==========================================
- Hits        45834    45827       -7     
- Misses       7786     7802      +16     
+ Partials     1264     1252      -12     
Flag Coverage Δ
alpine320 75.95% <100.00%> (-0.01%) ⬇️
fedora42 76.11% <100.00%> (+<0.01%) ⬆️
macos-13 81.64% <100.00%> (+<0.01%) ⬆️
macos-14 81.64% <100.00%> (+<0.01%) ⬆️
macos-15 81.64% <100.00%> (+<0.01%) ⬆️
mingw32 70.29% <91.66%> (-0.02%) ⬇️
mingw64 70.28% <91.66%> (+0.09%) ⬆️
npcap ?
rhel94 75.80% <100.00%> (-0.01%) ⬇️
ubuntu2004 60.22% <100.00%> (-0.03%) ⬇️
ubuntu2004-zstd 60.33% <100.00%> (-0.03%) ⬇️
ubuntu2204 75.76% <100.00%> (-0.01%) ⬇️
ubuntu2204-icpx 60.75% <95.45%> (-0.04%) ⬇️
ubuntu2404 75.98% <100.00%> (+0.01%) ⬆️
ubuntu2404-arm64 75.60% <100.00%> (-0.03%) ⬇️
unittest 83.50% <100.00%> (-0.01%) ⬇️
windows-2022 85.50% <100.00%> (+0.14%) ⬆️
windows-2025 85.52% <100.00%> (+0.11%) ⬆️
winpcap 85.52% <100.00%> (-0.08%) ⬇️
xdp 53.55% <100.00%> (-0.01%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@Dimi1010 Dimi1010 marked this pull request as ready for review September 12, 2025 20:02
@Dimi1010 Dimi1010 requested a review from seladb as a code owner September 12, 2025 20:02
m_LastLayer->m_NextLayer = nullptr;
}

/*
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The old code is kept mostly so it does not interfere with the diff.
It would probably be better to be removed prior to merge.

// As the stop conditions are inclusive, the parse must go one layer further and then roll back if needed
bool rollbackLastLayer = false;
bool foundTargetProtocol = false;
for (Layer* curLayer = m_FirstLayer; curLayer != nullptr; curLayer = curLayer->getNextLayer())
Copy link
Owner

Choose a reason for hiding this comment

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

nit: we can use auto* instead of Layer*

Copy link
Owner

Choose a reason for hiding this comment

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

Can we add tests to prove correct parsing when there is chaining of the same protocol type (both with parseUntil and parseUntilLayer)?

Copy link
Collaborator Author

@Dimi1010 Dimi1010 Sep 20, 2025

Choose a reason for hiding this comment

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

Sure, BGP will probably be easiest to set up.

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

Successfully merging this pull request may close these issues.

2 participants