The UDP datagram is discarded if the receiving end detects a test and has errors. The upd test and calculation is similar to the IP header check and, the UDP test and is an end-to-end test and is computed by the sender and then validated by the receiving end. Repeat the 2nd step until the high 16 bits are 0, the lower 16 bits are reversed, and the checksum is obtained. If this 32-bit number, the high 16-bit is not 0, then the high 16-bit plus-low 16-bit is then given a 32-bit number ģ. A 32-digit number according to the sum of each 16 bits Ģ. The UDP test and calculation methods are:ġ. The pseudo-header +UDP header + data calculates the checksum together. This pseudo-header refers to the source address, destination address, UDP data length, protocol type (0X11), the protocol type is one byte, but needs to complement one byte of 0x0, constituting 12 bytes. UDP checksum needs to calculate the UDP header plus data load, but also need to add a UDP pseudo-header. The above is the IP, TCP, UDP checksum calculation principle, if we write the corresponding checksum function, the problem is not too large, as long as the basis of its calculation principle can be. UDP checksum needs to divide the IP pseudo header, UDP header, UDP data into 16-bit words, and then accumulate (if the total length is an odd number of bytes, then add a bit to 0 bytes at the end), and finally the cumulative and bitwise reverse. The UDP checksum is basically consistent with the TCP checksum. The IP pseudo header includes the source IP address (4 bytes), the destination IP address (4 bytes), the protocol number (two bytes), the TCP Kanenaga (2 bytes), and a total of 12 bytes.Ĭalculation principle of 1.3 UDP checksum The TCP checksum needs to divide the IP pseudo header, TCP header, TCP data into 16-bit words, and then accumulate (if the total length is an odd number of bytes, then add a bit to 0 bytes at the end), and finally the cumulative and bitwise reverse. Reverse the obtained and bitwise in 2 and get the checksum.Ĭalculation principle of 1.2 TCP checksumįor the IP layer protocol, its checksum as long as the IP header can be computed, the relative, for the four layer protocol, its checksum needs to calculate four layers of head and four layer of data. Calculate the sum of all 16bit words in the IP headerģ. IP check is for the IP header, that is, only the IP header, and for the IP data part of the verification, the corresponding four times the agreement to ensure that the IP head of the test and the field is 16bit.Ģ.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |