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
tcpprep with pcap containing >1020 packets produces invalid cache file #415
Comments
As a workaround I adjusted the |
@petegallagher Thanks for digging into this. I plan to finalize a fix for next release which will probably be before the end of the month. |
seems has't been fixed... @fklassen |
Yeah, life caught up to me. I will take some time off in December to work on this project. |
Fixed in #426 |
Version: 4.2.5
Steps to reproduce
Using a pcap file containing >1020 packets e.g.:
Call
tcpprep
using auto-split mode e.g.:Call
tcprewrite
using cache file above e.g.:Error is displayed on console e.g.:
Description
When running
tcpprep
with a large pcap file (my example is ~4GB, containing 5763149 packets) it appears as though the cachedata packet count (e.g.mycache->packets
) is only ever a maximum of 1020, subsequently only 256 bytes (1020/4=255) of cachedata is written to the cache file. This ultimately causes the following error when the cache file is used later (e.g. withtcprewrite
):From the debugging I've done so far and my rudimentary understanding of the code, I believe the cause of the issue is that cachedata packet count is not correctly incremented once we begin to use linked lists of caches (see common/cache.c:276).
It seems the first cachedata item has its packet count correctly incremented up to the maximum 1020. However for each subsequent packet (>1020), a new cache is created and appended to the linked list, and this cache contains a single packet only. This means that if you have 1024 packets, you would have 5 caches in the linked list. This can be observed by running with
--dbug=1
e.g. see below for the debug logs showing the packet counts for each cache:My example pcap contains 5763149 packets. The output above shows that the first cache is continuously incremented up to 1020, subsequently we have 5762129 caches created with a single packet each (5762129+1020=5763149).
So there appears to be 2 defects here:
The text was updated successfully, but these errors were encountered: