Re: tcp checksum

[email protected] Thu, 27 May 2004 11:57:05 +0530
Newsgroups gmane.comp.security.libnet
Message-ID <[email protected]>



Hi Jee

    thats wierd ... i havent tried filling checksum by setting the sum
paramter to libnet_build_tcp to 0, but just saw libnet help, it says it
autofills when sum parameter is set to 0, so what you are doing seems fine
and yes for checksum calculation purposes the pseudo header is also used,
so incase you have the same checksum for both the packets then thats really
wierd. You can try filling the checksum field yourself, and then compare
the two checksum fields ( one you calculate and one filled in by libnet).
Maybe we are missing some simple libnet trick here ...

Amit




"Jee J.Z." <[email protected]> on 05/26/2004 10:36:24 PM

To:    <[email protected]>
cc:    Amit Kumar Singh/HSS@HSS

Subject:    tcp checksum


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