-
Notifications
You must be signed in to change notification settings - Fork 721
Fix inclusive parseUntil
condition in the main packet parse loop.
#1964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
- 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.
parseUntil
condition the main packet parse loop.
parseUntil
condition the main packet parse loop.parseUntil
condition in the main packet parse loop.
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
m_LastLayer->m_NextLayer = nullptr; | ||
} | ||
|
||
/* |
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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*
There was a problem hiding this comment.
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
)?
There was a problem hiding this comment.
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.
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.