HI all!! I am trying to do nat through my applictaion..But i am not able to calculate the right checksum..The code i am using for calculating checksum is the standarad one..but i am not getting the right checksum..Just for testing purposes, i set the checksum field of ip header to 0 and calculated the checksum of ip header without any changes..but i am getting a different answer.. This is what i am doing: /////Printing original checksum printf(" CHECKSUM:%d ", ntohs(ip->check)); /////Recalculating the checksum of same pkt after setting checksum field to 0 ip->check=0; prinf("checksum %d",ntohs(csum_part(ip,iplen, 0))); The code for calculating checksum i am using is: u_int16_t csum_part(void *buffer, unsigned int len, u_int16_t prevsum) { u_int32_t sum = 0; u_int16_t *ptr = buffer; while (len > 1) { sum += *ptr++; len -= 2; } if (len) { union { u_int8_t byte; u_int16_t wyde; } odd; odd.wyde = 0; odd.byte = *((u_int8_t *)ptr); sum += odd.wyde; } sum = (sum >> 16) + (sum & 0xFFFF); sum += prevsum; return (sum + (sum >> 16)); } Can somebody tell me where exactly is the problem..Why am i not getting the right checksum,???????????/// Thanx in advance, Paridhi __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/