Re: IP cheksum and libnet_pblock_coalesce
Frédéric Raynal <[email protected]> Fri, 24 Sep 2004 19:30:42 +0200
| Newsgroups | gmane.comp.security.libnet |
|---|---|
| Message-ID | <[email protected]> |
Hi,
On Thu, Sep 23, 2004 at 05:00:04PM -0700, Kenichi MORI wrote:
>
>
> Hi jarppe
>
> > Hello everybody,
> >
> > Should libnet_pblock_coalesce() set the IP checksum correctly? I'm
> > using libnet 1.1.2.1, compiled with GCC 3.2.2 20030222 on Linux.
> >
> > When I create packet using libnet_build_[udp|tcp]() +
> > libnet_build_ip(), then get the packet using
> > libnet_pblock_coalesce() and then call libnet_ip_check() over the
> > returned buffer, I get non-zero reply, indicating wrong IP
> > checksum.
> >
> > Interestingly enough, if I create the packet with
> > libnet_build_icmpv4_echo() + libnet_build_ip(), then
> > libnet_ip_check() returns zero (checksum ok).
> >
> > Am I doing something wrong, or is there a bug?
> >
> > -jarppe
>
> I had something similar situation. I'm also using libnet 1.1.2.1
> with GCC (Redhat9).
>
> I also found some wrong checksum packets created by libnet. So, I
> replace the function libnet_in_checksum() (libnet_checksum.c) with
> the same name function of libnet-1.0.2a, there is no wrong packet.
>
> -Kenichi
>
I dont understand why you call libnet_ip_check() :
u_int16_t
libnet_ip_check(u_int16_t *addr, int len)
{
int sum;
sum = libnet_in_cksum(addr, len);
return (LIBNET_CKSUM_CARRY(sum));
}
When you call libnet_pblock_coalesce() checksums are computed, so you
dont have to force any re-computation.
Fred