[Click] About checksum computation ?

Beyers Cronje bcronje at cs.co.za
Mon Nov 1 06:36:00 EST 2004


Hi Yacine,

You have two options:

(A) Use SetIPChecksum element. If you only want to set certain packets then push those packets out a seperate output port which connects to SetIPChecksum element.
(B) You were using the ip packet length: ip_len, where only the ip header length is needed: ip_hl. From SetIPChecksum() element, correct code to set IP checksum:

  hlen = ip->ip_hl << 2;
  ip->ip_sum = 0;
  ip->ip_sum = click_in_cksum((unsigned char *)ip, hlen);

The above works in my code.

Regards

Beyers


-----Original Message-----
From: click-bounces at amsterdam.lcs.mit.edu
[mailto:click-bounces at amsterdam.lcs.mit.edu]On Behalf Of yacine.djemaiel
Sent: Monday, November 01, 2004 11:33 AM
To: bart.braem
Cc: click
Subject: Re: [Click] About checksum computation ?


I need to compute checksum only for some packets selected and
not for all traffic. If, i have not found a solution, i will
use this element.

Thanks Bart for your help


> Op maandag 1 november 2004 10:03, schreef u:
> > Hi,
> > i would like to compute checksum after modifying an ip header
> > field. I have followed set_cksum method (fromtcpdump.cc), but
> > i get all the time an incorrect ip header checksum. Lines of
> > code that i am using are :
> >
> Why not use the SetIPChecksum element? That's a fine element
that works 
> perfectly...
> 
> Bart
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> 

Accédez au courrier électronique de La Poste : www.laposte.net ; 
3615 LAPOSTENET (0,34EUR/mn) ; tél : 08 92 68 13 50 (0,34EUR/mn)




_______________________________________________
click mailing list
click at amsterdam.lcs.mit.edu
https://amsterdam.lcs.mit.edu/mailman/listinfo/click
This is an email from CS Holdings. It is confidential to the 
ordinary user of the email address to which it is addressed 
and may contain copyright and/or legally privileged information.
No one else may read, print, store, copy, forward or act in 
reliance upon all or any part of it or its attachments. If you 
received this email in error please notify its sender.



More information about the click mailing list