Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!julius.cs.uiuc.edu!zaphod.mps.ohio-state.edu!think.com!mintaka!mit-eddie!uw-beaver!milton!sumax!ole!thebes!amc-gw!brian From: brian@amc-gw.amc.com (Brian Crowley) Newsgroups: comp.protocols.tcp-ip Subject: IP Header Checksum Calculation Message-ID: <5212@amc-gw.amc.com> Date: 29 Jan 91 22:11:49 GMT Organization: Applied Microsystems Corp.; Redmond, WA Lines: 27 I wonder if someone can't give me some pointers on what I feel should be a simple operation, but one that I just can't seem to get a handle on. I am building an IP packet for transmission over an Ethernet Network. No problem building the packet, big problems getting the IP header checksum to come out correctly! According to the RFC in front of me, the IP header checksum is calculated by treating the IP header as a sequence of 16-bit values, which are added together using one's complement arithmetic, and then the one's complement of the result is used as the checksum. To test my algorithm, I pulled some IP packets off our local network and ran the IP headers through. Alas, the results of my program do not match the checksums stored in the packets! Would some kind soul please send me their algorithm to accomplish this feat? A "C" code fragment, a written algorithm, any help you can give would be appreciated. --------------------------------------------------------------------------- |Brian Crowley | DNS: brian@amc.com | |Applied Microsystems Corp. | UUCP: uunet!amc-gw!brian | |Redmond, WA | ATT: 206-882-2000 Ext. 328 | ---------------------------------------------------------------------------