tcp checksum

"Jee J.Z." <[email protected]> Wed, 26 May 2004 18:06:24 +0100
Newsgroups gmane.comp.security.libnet
Message-ID <00d301c44343$c6590890$68892090@grouse>
Hi all,

I am struggling with the TCP checksum using libnet_build_tcp() and
libnet_build_ip(). I set the checksum parameter to 0 in order for libnet to
calculate the checksum automatically. However, using ethereal to see what I
injected, the checksum are always incorrect while other information seems no
problem.

The whole story is that I capture packets using the libipq library provided
by netfilter, copy them into a buffer before drop them using libipq, modify
their src or dst (actually something like nat), and sometime later re-inject
them using libnet. However, after I modify the dst or src address, the TCP
checksum seems still the same with the checksum in the previously dropped
packet -- that is, the calculation of TCP checksum seems not including the
information of dst and src ip address, which is inconsistance with the
standard method (counting in the pseudo header of TCP, which includes the
src and dst IP address).

Am I missing something obvious? Any ideas are welcome! Thank you in advance.

Jee