rust-pcap / pcap

Rust language pcap library
Apache License 2.0
619 stars 142 forks source link

Add a binding for pcap_loop #310

Closed saethlin closed 7 months ago

saethlin commented 1 year ago

I recently ran into a situation where a tool I help maintain and tcpdump had different behavior with a somewhat exotic libpcap implementation. I eventually tracked this down to the fact that tcpdump uses pcap_loop and since said tool is going through this crate, it was using pcap_next_ex. This difference was actually a bug in the libpcap implementation, I spent a frustrating amount of time convincing people that the bug was in libpcap, because I couldn't closely imitate the libpcap calls of tcpdump.

Since that time, I've been wanting a way to call pcap_loop from this crate, because that would have made my life a lot easier. So I finally got around to putting one together, here it is.

I don't really care about the public API. Ideas like a better name are very welcome.

Wojtek242 commented 7 months ago

Due to significant changes on main since this was proposed, I will close it. If you get around to addressing the comments and adapting to the current code base, I'll be happy to review it.

saethlin commented 7 months ago

sigh I force-pushed to the branch before re-opening the PR which has killed the PR. I'll open a fresh one.