[Click] About checksum computation ?

yacine.djemaiel yacine.djemaiel at laposte.net
Mon Nov 1 03:46:40 EST 2004


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 :   

assert(wp_iph == wp->ip_header());   
wp_iph->ip_len = htons(wp->length() - wp->ip_header_offset());
wp_iph->ip_sum = 0;
wp_iph->ip_sum = click_in_cksum((uint8_t *)wp_iph,
(ntohs(wp_iph->ip_len)) << 2);  

I have modified the identification field and the reserved flag.

Thanks for any help
Yacine

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






More information about the click mailing list