pcap-file icon indicating copy to clipboard operation
pcap-file copied to clipboard

Stuck on pcap

Open prorealize opened this issue 4 months ago • 4 comments

On the attached pcap this library ends up in a forever loop with:

pcap_reader: &mut PcapReader<File> pcap_reader.next_packet()

pcap version 2.0.0

external_smtp.pcap: pcap capture file, microsecond ts (little-endian) - version 2.4 (Ethernet, capture length 1500)

It works for other pcaps

external_smtp.zip

prorealize avatar Jul 09 '25 19:07 prorealize

Thanks for reporting this bug. I found out the root cause. When a packet is malformed an error is returned but the parser doesn't advance. In your case that's caused by an invalid global pcap header snaplen value of 1500 when you have packets with a size > 1500.

I'll add the fix in the upcoming 3.0 version.

courvoif avatar Jul 14 '25 08:07 courvoif

Hi! Just wanted to check if this issue is supposed to be resolved in version 3.0.0-rc1. I'm still experiencing the same problem, and after testing with that release candidate, the infinite loop persists.

In my case, the .pcap file is malformed due to the last packet. However, I’ve confirmed that the issue is not related to the packet’s position — even if I move that malformed packet to the middle of the file, the infinite loop still occurs. So it seems the problem is triggered by the packet itself, regardless of where it appears.

Thanks in advance, and let me know if I can help further with debugging or testing.

ghost avatar Sep 03 '25 16:09 ghost

Hi, you're right it's not resolved in the 6.0.0-rc1. I found out the root cause but to fix it "well" I need to make a big change in the API and unfortunately I don't have the time to work on it right now. I'll keep you updated when I have the time to work on it.

courvoif avatar Sep 03 '25 17:09 courvoif

Oh, I see. Thank you very much.

ghost avatar Sep 03 '25 17:09 ghost