-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
flow: Add cfg for optional flow reuse during low memory #10232
flow: Add cfg for optional flow reuse during low memory #10232
Conversation
By default, force flow reuse to reuse an existing flows no matter the state of the flow. Add a configuration option flow.force-reuse, enabled by default, that can turn off the above behaviour. Ticket: OISF#6293
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #10232 +/- ##
==========================================
+ Coverage 82.18% 82.24% +0.05%
==========================================
Files 977 977
Lines 271894 271900 +6
==========================================
+ Hits 223465 223617 +152
+ Misses 48429 48283 -146
Flags with carried forward coverage won't be shown. Click here to find out more. |
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.
See inline comments.
Additionally:
- formatting needs fixing up
- documentation in userguide needs to be added
Thanks!
@@ -687,6 +687,10 @@ static Flow *FlowGetNew(ThreadVars *tv, FlowLookupStruct *fls, Packet *p) | |||
FlowWakeupFlowManagerThread(); | |||
} | |||
|
|||
if (!flow_config.force_reuse) { |
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.
how should this behave in IPS mode? We don't call NoFlowHandleIPS()
here
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.
I think we could also enforce this option at the start of FlowGetUsedFlow
@@ -286,6 +286,7 @@ typedef struct FlowCnf_ | |||
uint32_t hash_rand; | |||
uint32_t hash_size; | |||
uint32_t prealloc; | |||
int force_reuse; |
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.
bool
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.
also, please add a line to document the field
@@ -1424,6 +1424,7 @@ flow: | |||
emergency-recovery: 30 | |||
#managers: 1 # default to one flow manager | |||
#recyclers: 1 # default to one flow recycler thread | |||
force-reuse: 1 # Default to forcing flow reuse in low memory conditions |
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.
we can enable it by default in the code, and leave it commented out here
additionally, it should use true/false
instead of suggesting it is a numeric value
Updated in #10257 |
By default, force flow reuse to reuse an existing flows no matter the state of the flow.
Add a configuration option flow.force-reuse, enabled by default, that can turn off the above behavior.
Ticket: #6293
Make sure these boxes are signed before submitting your Pull Request -- thank you.
https://docs.suricata.io/en/latest/devguide/contributing/contribution-process.html
https://suricata.io/about/contribution-agreement/ (note: this is only required once)
Link to redmine ticket:
https://redmine.openinfosecfoundation.org/issues/6293
Describe changes:
Add a configuration option flow.force-reuse, enabled by default, that can turn off flow reuse in low memory situations.
Provide values to any of the below to override the defaults.