Skip to content
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

Extension for IPv4Reassembler to prevent a possible memory leak #301

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

erikbasargin
Copy link

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 :).

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

Successfully merging this pull request may close these issues.

None yet

1 participant