-
Notifications
You must be signed in to change notification settings - Fork 720
Added const qualified match methods to BfpFilterWrapper. #1957
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
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #1957 +/- ##
==========================================
- Coverage 83.52% 83.51% -0.02%
==========================================
Files 310 310
Lines 54917 54956 +39
Branches 12223 12241 +18
==========================================
+ Hits 45871 45894 +23
- Misses 7780 7805 +25
+ Partials 1266 1257 -9
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:
|
bool matches(const uint8_t* packetData, uint32_t packetDataLength, timespec timestamp, uint16_t linkType, | ||
LinkMismatchBehaviour onLinkmismatch = LinkMismatchBehaviour::RecompileFilter) const; |
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.
@seladb I would like a second opinion on if the onLinkMismatch
is a good addition.
I can see it going two ways:
-
The filter is considered
filter string
+compiled BPF program
. Then it would make sense to control if a recompile is desired. In that case, having a flag to control it is a potential improvement. -
The filter is considered only
filter string
and thecompiled program
is considered part of the match procedure. If that is the case, then the program being cached in the object is an optimization. Recompiling it as needed is fine, as the program is expected to be compiled every time anyway. In this case, the user does not need an ability to affect the recompilation, as that is internal implementation.
This PR updates
BpfFilterWrapper
to allow matching with a packet while the filter is marked asconst
.It also extends the wrapper with C++11 move constructors and a new constructor to create an instance with a set filter.