IP sharding, ip sharding

Source: Internet
Author: User

IP sharding, ip sharding

When the data exceeds the maximum byte allowed at the underlying layer (A 1514-byte Ethernet frame, 14-byte Ethernet header, 20-byte IP header, UDP8/TCP20, the maximum size of the IP packet is 1500 = MTU each time. Remove 1472 bytes of UDP valid data from the protocol header, and 1460 bytes of TCP .) Slice the IP address. The maximum IP address allowed by LwIP is determined by the following: IP_REASS_MAX_PBUFS determines the maximum number of pbuf allowed by the IP segment, and the survival time of IP_REASS_MAXAGE segment. If the time exceeds the limit, the IP segment received earlier is discarded.

If the data size is greater than IP_REASS_MAX_PBUFS, there are two options: one is to directly Delete the data and return the data; the other is to delete the IP segment PBUF with the longest survival time, which can be enabled through IP_REASS_FREE_OLDEST.

When UDP is used, if the buffer descriptor is smaller than the complete IP packet, when the IP segment packet arrives, the descriptor will soon be used up, and the later IP packet will be discarded because there is no buffer descriptor, UDP has no retransmission mechanism and may never receive a complete IP segment package. Therefore, an error occurs when the value is greater than IP_REASS_MAXAGE. Therefore, the buffer descriptor should be increased to adapt to IP shard reinstallation.

When TCP sends data, it segments the data larger than the MSS (segments are not called fragments), and the MSS is generally 1460. Therefore, TCP packets are not sliced at the IP layer.

The IP header has a three-digit flag field, indicating whether it is a multipart package. The first digit is useless. The second digit 0 indicates that parts are allowed. The second digit 0 indicates that parts are not allowed. The third digit 0: the last one, and 1: the last part. The 13-bit offset indicates the offset, which is used to sort data during IP address reorganization. Therefore, the maximum IP packet size is 8192 bytes.

As shown in the implementation of the standard BSD Protocol, two struct types are used, and IPQ is the header. Each IP segment header is connected and IP information is stored. Ipasfrag is the specific partition data.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.