Re: a problem with tcp checksum

Frédéric Raynal <[email protected]> Mon, 31 May 2004 21:20:19 +0200
Newsgroups gmane.comp.security.libnet
Message-ID <[email protected]>
Hi,

on what architecture and system are you using libnet? I fixed a
similar bug some times ago that caused that behavior: it was caused by
an endianess problem (bad casting). And what version of libnet are you
using ?

	Fred Raynal

On Mon, May 31, 2004 at 08:44:09AM +0530, [email protected] wrote:
> 
> 
> 
> 
> Hi Jeez,
> 
>    This seems wierd, as i said I havent worked with tcp checksum in libnet
> yet, but my guess says that this might be your problem, whenever we
> calculate checksum for a TCP segment its mandatory that header+text length
> is even, if its odd just for checksum calculation purposes the last byte(on
> the right) is padded(all zeros). This byte is not transmitted as part of
> the segment though, maybe libnet doesnt do it itself, this is completely a
> guess cos I dont know how checksumming with libnet works.
> 
> cheers
> Amit
> 
> 
> 
> 
> 
> "Jee J.Z." <[email protected]> on 05/31/2004 05:18:02 AM
> 
> To:    <[email protected]>
> cc:
> 
> Subject:    a problem with tcp checksum
> 
> 
> Hi all,
> 
> I am going frustrated since a wired problem with tcp checksum seem to
> always
> happen. ;-( I really wish to see somebody throw some light on it. The
> situation is as follows:
> 
> I am trying to inject TCP packets using libnet_build_tcp_options(),
> libnet_build_tcp() and libnet_build_ipv4() (checksum automatically built).
> When TCP payload size is odd in byte, the tcp checksum is always incorrect
> (using ethereal to capture injected packets and check them); while if TCP
> payload size is even in byte, everything seems working very well.
> 
> What I wish to know is do I need to manually change some parameters of
> libnet_build_tcp_options(), libnet_build_tcp() or libnet_build_ipv4() when
> the tcp payload size is odd in byte, in order to let libnet compute tcp
> checksum correctly? If not, what shall I do to fix the problem? I am
> looking
> forward to your help. Thank you very much in advance!
> 
> Regards,
> Jee
> 
> 
> 
>