Hacker News new | ask | show | jobs
by p0cc 2284 days ago
> The choice to store two lengths in the packet header means that you can record both the actual wire length--the number of bytes that came in--and a bigger number that says where the next record starts, and any metadata you like in the gap.

> There is a very complicated "NG" pcap format, but nobody uses it.

This is the reason that pcapng was created - to formalize the structure of this metadata. pcapng "Pcap Next Generation" (2006) is an update to the pcap format (which originated with libpcap/tcpdump in the 90s). It's used in the networking industry as it's the default output file of wireshark, tshark, and tcpdump to capture traffic. If you use these tools, chances are that you have pcapng files.

The biggest reason to use it over pcap (in networking) is that you can save packets from multiple network interfaces. If you have a wireless access point and want to capture both ethernet and 802.11 traffic in the same capture, pcapng would be necessary.

2 comments

Oh come on. Ported my pcap parser in 3 hours, and that included reading the docs and looking up a example capture.

SDB is the 'file header' packet. IDB is the 'interface description' packet. EPB is the 'data' packet.

The rest you should ignore except if you need to look through other block kinds, and in this case you're quite happy to have pcap-ng. No custom block in pcap, except forking wireshark...

All the ethernet/ppp/802.11 after that is the same as with pcap. What do people find so complicated there ?

Also pcap-ng is quite the generic data-recording format. Merging internal logs, network capture, interface stats, system configuration state, whatever you might want... In a /simple/ unique format. Easy to write, easy to have it read by wireshark... Even if it's not only network related.

The real strength of pcap-ng is that you can read it in both directions. Size is at the start /and/ end of each block. Seems stupid but it's very useful for some kind of analysis. Used to build indexes for pcap files... Not so useful now. And anyway, if you want to build an index, you can just add it as custom packet at the end.

The reason it is not used in fintech is that it is extremely complex.

The greatest failing of wireshark et al today is not understanding lz4 and zstd compression.