user2066445
user2066445

Reputation: 1

libtrace's function to calculate packet checksum

I am using libtrace to modify the payload of captured packet due to some research reason. In this case, I have to calculate the new checksum for the modified packet. My question is that is there an easy way to do this, for example, is there a function in libtrace can do this? Any comment is appreciate.

Upvotes: 0

Views: 225

Answers (1)

Shane Alcock
Shane Alcock

Reputation: 51

There's no API function in libtrace specifically for this at present, but there is code that generates correct IPv4, TCP and UDP checksums for packets inside of the tracereplay tool which you could use as the basis for writing your own functions to do it.

The code itself can be found in tools/tracereplay/tracereplay.c in the libtrace source. The libtrace source itself can be downloaded from here (in case you got libtrace via a packaging system).

There's also a mailing list for libtrace questions that is more likely to get prompt responses.

Upvotes: 1

Related Questions