javanetwork-programmingchecksumpcaptcpreplay

How to correct all packet frame check sequences(FCS) of a pcap to send with tcpreplay?


I used pcap4j to manipulate pcap files in java. Unfortunately, pcap4j can fix all checksums except frame check sequence(FCS). I want to send pcaps using tcpreplay. I am looking for a tool, library or package that can resolve FCS of every packet in a pcap file.

I expected pcap4j, tcpreplay or network card interface solve my problem at first, but i'm disappointed from them at all.

I couldn't find any tool after many search for this simple purpose, all I could do was using PureJavaCrc32 to calculate Ethernet FCS. But I'm not happy with this solution. because I guess it's not enough to just calculate Ethernet FCS, I think there is differences in FCS calculation between Ethernet and other layer 2 protocols which I like to support. I hoped I could use tshark because it is calculating FCS in wireshark, even I tried to review wireshark code see if I could make a tool for this purpose or not, but it was too complicated. So any advise?


Solution

  • I am looking for a tool, library or package that can resolve FCS of every packet in a pcap file.

    If you're trying to replay a capture file, you probably do not need to fix the FCS. Normally, when a packet is transmitted, the network adapter computes a correct FCS and adds that to the packet; the host computer doesn't provide an FCS to the adapter, even if you're using a program such as tcpreplay to do raw packet injection.

    (Note also that not all capture files have layer 2 FCS values. Most of them don't, because either:

    1. the network adapter used for the capture doesn't supply the FCS to the host;
    2. the network adapter used for the capture can be configured to supply the FCS to the host, but the operating system's driver for the adapter doesn't configure the adapter to do so.)