-
Notifications
You must be signed in to change notification settings - Fork 23
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
tcpslice can't read capture file with just one packet #23
Comments
Thank you for reporting this bug, it reproduces as described. |
@infrastation Tried a little bit of debugging, I think the problem is in the find_header() function. In sf_find_end, we expect that find_header will return HEADER_DEFINITELY:
But HEADER_DEFINITELY is never set in find_header function unless there are at least two packets:
Only HEADER_PERHAPS is set for the first packet:
So at the end of the function:
Status is always HEADER_PERHAPS. Not sure if the solution would be to simply assume that HEADER_DEFINITELY could be returned instead since saw_PERHAPS_clash is 0? |
Thank you for looking into this. A pcap savefile with one packet is a valid file and as far as the man page and the command-line options go, there seems to be no fundamental reason to require more than one packet to process pcap savefile(s) as described. So ideally it would be nice to have this edge case bug fixed. However, if due to implementation details fixing the bug would be too difficult, at the very least it would be appropriate to document it and to print a more useful error message. |
If you do:
With a pcap file (11 packets), no error. |
So two issues have come up here:
|
|
Hi guys, just checking whether there is some update here. Is there a consensus on what would be the best approach? |
Perhaps updating the man page could be the easiest starting point. |
Mention the imperfections from GH issue #23, fix a formatting inconsistency for the time example. [skip ci]
Apparently, tcpslice also fails to handle correctly an input file with 0 packets. tcpslice(1) now mentions that and the problems above. |
When using tcpslice to merge two capture files, if one of those files has just one packet, tcpslice will fail with following error:
tcpslice: problems finding end packet of file capture-file
This does not have to be just the action of merging two files. Just reading the one file with one packet ends up the same. This is reproducible in a following ways:
The error appears even when the captures are merged with a different tool like mergecap:
The text was updated successfully, but these errors were encountered: