Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security Libnet
[Top] [All Lists]

Re: Bug#284729: libnet1: UDP checksums are bogus in odd sized packets

Subject: Re: Bug#284729: libnet1: UDP checksums are bogus in odd sized packets
Date: Thu, 9 Dec 2004 14:08:49 +0100
On Thu, Dec 09, 2004 at 01:06:59PM +0100, Domenico Andreoli wrote:


On Thu, Dec 09, 2004 at 06:16:30AM +0100, Frédéric Raynal wrote:

Hi,

hi, thank you for the fast response :)

Here is a replacement function for libnet_in_cksum() (file
libnet/src/libnet_checksum.c) Several fix have been proposed on
libnet's ML, and that the one _I_ prefer, but I dont know if that is
the one Mike kept.

i'm leaving few days to Mike to comment the thread, then i'll use
your fix.


Note that I did not said it was my fix, but the one I adopted. We had
long discussion on libnet's ML, and that fix have been proposed by Wu
Yongwei.

Cheers, 

        Fred

int
libnet_in_cksum(u_int16_t *addr, size_t len)
{
    int sum;
    u_int16_t last_byte;

    sum = 0;
    last_byte = 0;
    while (len > 1)
    {
        sum += *addr++;
        len -= 2;
    }
    if (len == 1)
    {
        *(u_int8_t*)&last_byte = *(u_int8_t*)addr;
        sum += last_byte;
    }
    return sum;
}

<Prev in Thread] Current Thread [Next in Thread>