Extension for IPv4Reassembler to prevent a possible memory leak #301
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello!
I noticed that there is no removal of obsolete packages. If there is a loss in traffic, there will be a memory leak in IPv4Reassembler (IPv4Stream::fragments_type).
Added two options to prevent this.
On the similarity
pcapplusplus
added the ability to limit the streams (set_max_number_packets_to_stream
).And also added the removal of expired streams by the calculation of the time of their lives (
set_timeout_to_stream
).In a hurry, added support for C++ below 11 version. :) But we need to check in more detail - could be broken cross-platform.
Tested in Linux: Arch [gcc 8.1.1 or clang++ 6.0.0] and CentOS7 [gcc 4.8.3].
Problems occurred in the tests for СentOS7, when we set the flag
-DLIBTINS_ENABLE_CXX11=0
.The error is related to enum in class IPv6 (While it did not fix it, but maybe it could be similar):
/home/dev/work/projects/libtins-origin/tests/src/ipv6_test.cpp: В функции-члене «virtual void IPv6Test_HopByHopPadding_Test::TestBody()»: /home/dev/work/projects/libtins-origin/tests/src/ipv6_test.cpp:366:34: ошибка: «Tins::IPv6::ExtensionHeader» is not a class or namespace ipv6_header.add_header(IPv6::ExtensionHeader::HOP_BY_HOP); ^ /home/dev/work/projects/libtins-origin/tests/src/ipv6_test.cpp: В функции-члене «virtual void IPv6Test_HopByHopParsing_Test::TestBody()»: /home/dev/work/projects/libtins-origin/tests/src/ipv6_test.cpp:377:67: ошибка: «Tins::IPv6::ExtensionHeader» is not a class or namespace const IPv6::ext_header* ext_header = ipv6.search_header(IPv6::ExtensionHeader::HOP_BY_HOP);
Is there a need for C++ support below version 11? I would say that this is an old version :).