Ip checksum, Computer Networking

Assignment Help:

This code properly implements the IP checksum function on a 32-bit machine: unsigned short cksum(unsigned short *buf, int count)
{
unsigned long sum = 0;
while (count--) {
sum += *buf++;
if (sum & 0xFFFF0000) {
sum &= 0xFFFF;
sum++;
}
}
return ~(sum & 0xFFFF);
}
The if statement performs "wraparound" if the sum over?ows 16 bits. That is, it takes the 1 that over?owed into the 17th bit and adds it to the lower 16 bits of the sum.

Here's how to compute and check the checksum. The sender should perform these actions:

1. Completely ?ll in the IP header, with zero in the checksum ?eld.

2. Compute the checksum and store it in the checksum ?eld.

The receiver should perform these actions:

1. Copy the checksum ?eld's value into a variable.

2. Zero the IP header's checksum ?eld.

3. Compute the checksum over the IP header.

4. Compare the computed checksum value with the value in the variable.


Related Discussions:- Ip checksum

Dns message - application layer, DNS Message There are  the only  two ...

DNS Message There are  the only  two kinds  of DNS message DNS query and reply messages. Further mote both query  and reply message have  the same  format  as shown in figure.

Define topologies other than basic topologies, What are the popular topolog...

What are the popular topologies other than basic Topologies? Apart from basic topologies some other topologies worth considering are: mesh topology (each device linked to all o

Show the crc-performance, Q. Show the CRC-Performance ? CRC-Performanc...

Q. Show the CRC-Performance ? CRC-Performance CRC is able to detect all burst errors that affect an odd number of bits CRC is able to detect all burst errors of

Tcp, how tcp is redefined for wireless network

how tcp is redefined for wireless network

Enable wireless security - ccna, Enable Wireless Security Step : Confi...

Enable Wireless Security Step : Configure Windows to use WEP authentication.  Navigate to the Network Connections page again and right-click the Wireless Network Connection

Dns - server attacks, DNS - Server Attacks It’s not so easy to list al...

DNS - Server Attacks It’s not so easy to list all the associated attacks as they are evolving way so fast. As any error of flaw is identified, a patch is released in response

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd