SetIPChecksum standard element

Ruetee Chitpranee <[email protected]>
Newsgroups gmane.network.routing.click
Message-ID <CABG77Of36PVzHMKQ3T-L4+EYj8_3ot_XS1RDHQGLpSCy6gXd7g@mail.gmail.com>
Hi,

I have a doubt regarding SetIPChecksum standard element.
I test it with *test.click* configuration file (put it before
CheckIPHeader) and I got bad lengths error.
Why it returns error since input packet has network header, good header
length and good packet length?

SetIPChecksum: bad lengths



Packet *

SetIPChecksum::simple_action(Packet *p_in)

{

    if (WritablePacket *p = p_in->uniqueify()) {

         click_ip *ip;

         unsigned plen, hlen;



         if (!p->has_network_header())

             goto bad;

         plen = p->network_length();

         if (plen < sizeof(click_ip))

             goto bad;

         ip = p->ip_header();

         hlen = ip->ip_hl << 2;

         if (hlen < sizeof(click_ip) || hlen > plen)

             goto bad;



         ip->ip_sum = 0;

         ip->ip_sum = click_in_cksum((unsigned char *)ip, hlen);

         return p;



      bad:

         click_chatter("SetIPChecksum: bad lengths");

         p->kill();

    }

    return 0;

}

ref: test.click

InfiniteSource(DATA \<00 00 c0 ae 67 ef  00 00 00 00 00 00  08 00

45 00 00 28  00 00 00 00  40 11 77 c3  01 00 00 01

02 00 00 02  13 69 13 69  00 14 d6 41  55 44 50 20

70 61 63 6b  65 74 21 0a>, LIMIT 5, STOP true)

         -> Strip(14)

         //-> Align(4, 0)    // in case we're not on x86

         -> CheckIPHeader(BADSRC 18.26.4.255 2.255.255.255 1.255.255.255)

          -> Print(ok)

         -> Discard;

-- 
Ruetee C.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.