A switch out-of-order fragment message forwarding and following method and system
By adding custom message headers to the switch and performing virtual reorganization, the problem of inconsistent forwarding paths of out-of-order IP sharded packets is solved, and the path consistency of sharded packets is achieved, and network transmission efficiency and reliability are improved.
Patent Information
- Application Number
- CN202510039530.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2045-01-10
AI Technical Summary
When existing switches process out-of-order IP shard messages, they cannot ensure that shard messages pass through the same forwarding path, resulting in uneven loading of the member ports of the link aggregation group.
After filtering out IP shard messages in the switch and adding custom message headers, they are forwarded to the network processor for virtual reorganization. The network processor uses the source IP address, destination IP address and identification ID as indexes to virtually reorganize out-of-order IP shard packets, and writes the path selection hash value of the first chip to the custom message header of each shard.
Ensure that all sharded messages are forwarded through the same path, achieving path consistency between sharded and non-sliced messages, as well as path consistency of out-of-order sharded messages, and improving network transmission efficiency and reliability.
Smart Images

Figure CN119484452B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of switches, and in particular to a switch out-of-order fragment message forwarding and following method and system. Background Art
[0002] For IP fragment packets, only the first fragment contains Layer 4 port information (such as TCP / UDP). In order to make the fragment packets take the same forwarding path when forwarding to the Link-Aggregation Group (LAG) or ECMP, the L4 port information of the fragment packets needs to be masked as the key for calculating the hash value, that is, the hash value is calculated from a five-tuple to a three-tuple, which may cause uneven load on the member ports of the link aggregation group.
[0003] The existing solution is to create a message header record table when the forwarding chip receives the first fragment of the message. The table content includes: message ID (identify), source IP address, destination IP address, source port, destination port and exit. Subsequent fragments (middle fragment and tail fragment) messages query the header record table according to the message ID, source IP address and destination address and forward them to the same exit.
[0004] The drawback of this solution is that the IP fragmented packets received on the switch may be out of order. If the middle fragment or the last fragment arrives before the first fragment, the header record table cannot be established and the packets cannot go through the same link aggregation group member port. Summary of the invention
[0005] In view of this, an object of the present invention is to provide a switch out-of-order fragment message forwarding and following method and system to improve the above-mentioned problem.
[0006] An embodiment of the present invention provides a switch out-of-order fragment message forwarding and following method, which includes:
[0007] S101, the switch filters out IP fragment messages, adds a custom message header to the IP fragment messages, and then forwards them to the network processor; the IP fragment messages include a first fragment, a middle fragment, and a last fragment;
[0008] S102, the network processor uses the source IP address, destination IP address, and identification ID of the IP fragment message as a reassembly index to virtually reassemble the cached out-of-order IP fragment message;
[0009] S103, the network processor replaces the routing hash value of the custom message header carried by each IP fragment message with the hash value of the first fragment for the IP fragment message that has completed the virtual reassembly, and then sends it to the switch;
[0010] S104: The switch forwards the message according to the custom message header of the IP fragment message.
[0011] Preferably, in step S101, the service board panel port of the switch uses ACL to filter out IP fragment messages.
[0012] Preferably, in step S102, when the network processor virtually reassembles the fragmented messages, the reassembly of the out-of-order fragmented messages is achieved through the fragment reassembly function of the network protocol stack, and the original fragmented message receiving order is retained.
[0013] Preferably, in step S103, after the network processor replaces the routing hash value in the custom message header of the IP fragment message with the hash value of the first fragment, it sends the IP fragment message in the order of reception or the order after fragment offset sorting, and releases the memory occupied by the fragment message.
[0014] Preferably, it also includes:
[0015] The network processor notifies the sending module to send the fragmented message in the original order for the IP fragmented message whose virtual reassembly is not completed within the fragment reassembly timeout period, and the custom message header of the fragmented message remains unchanged.
[0016] Preferably, it also includes:
[0017] The network processor determines whether the IP fragment message exceeds the maximum memory for reassembly. If so, the reassembly memory resource shortage task module notifies the sending module to send the IP fragment message according to the index, and the custom message header of the IP fragment message remains unchanged.
[0018] Preferably, in step S104, after receiving the IP fragment message with the custom message header sent by the network processor, the switch extracts the routing hash value in the custom message header, and selects a member port of the link aggregation group or ECMP to forward the IP fragment message according to the value.
[0019] The embodiment of the present invention further provides a switch out-of-order fragment message forwarding and following system, which includes:
[0020] The switch is used to filter out IP fragment messages, and forward the IP fragment messages to the network processor after adding a custom message header to the IP fragment messages; the IP fragment messages include a first fragment, a middle fragment, and a last fragment;
[0021] A network processor is used to virtually reassemble the cached out-of-order IP fragment messages by using the source IP address, the destination IP address, and the identification ID of the IP fragment message as the reassembly index;
[0022] The network processor is further used to replace the routing hash value of the custom message header carried by each IP fragment message with the hash value of the first fragment for the IP fragment message that has completed the virtual reassembly, and then send it to the switch;
[0023] The switch is also used to forward messages according to the custom message header of the IP fragment message.
[0024] The technical solution provided by the embodiment of the present invention may have the following beneficial effects:
[0025] When receiving an out-of-order IP fragment message, the present invention forwards it to a network processor for virtual reassembly. For a successfully reassembled message, the routing hash value of the first fragment is extracted and written into the custom message header of each fragment to ensure that all fragments are forwarded through the same path. For a message that fails to be reassembled, the original fragment form is maintained for forwarding. The switching chip determines the forwarding path based on the hash value in the custom message header, thereby achieving path consistency of fragmented and non-fragmented messages, as well as path consistency of out-of-order fragment messages. Finally, the custom message header is stripped off, and the IP fragment message is forwarded from a determined egress port. The present invention effectively improves network transmission efficiency and reliability, and is particularly suitable for processing a complex network environment with a large number of out-of-order fragment messages. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 The present invention provides a flow chart of a switch out-of-order fragment message forwarding and following method according to the first embodiment of the present invention.
[0027] Figure 2 This is a hardware topology diagram of a switch service card provided in the first embodiment of the present invention.
[0028] Figure 3 A flowchart of processing IP fragment messages on a network processor provided in the first embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.
[0030] like Figure 1 and Figure 2 As shown, the first embodiment of the present invention provides a switch out-of-order fragment message forwarding and following method, which may specifically include:
[0031] An embodiment of the present invention provides a switch out-of-order fragment message forwarding and following method, which includes:
[0032] S101, the switch filters out IP fragment messages, adds a custom message header to the IP fragment messages, and then forwards them to the network processor; the IP fragment messages include a first fragment, a middle fragment, and a last fragment.
[0033] In this embodiment, the service card panel port of the switch uses ACL to filter out IP fragment messages, and then determines whether the received IP fragment message is the first fragment, the middle fragment or the last fragment by identifying the flag bit and the offset of the IP fragment message.
[0034] For example, for IPv4, you can read the flags and fragment offset of the IPv4 header of the message, and identify the type of the message based on the flags and fragment offset of the message:
[0035] First piece: flags=3'b001, fragment offset=13'b0
[0036] Intermediate slice: flags = 3'b001, fragment offset ≠ 13'b0
[0037] Trailer: flags=3'b000
[0038] For IPv6, an extension header is introduced, and the Fragment Header (44) is one of the categories that represents the fragmentation information in IPv6. The type of the message is identified based on the M flag (More flag) and fragment offset in the Fragment Header:
[0039] First fragment: M flag=1'b1, fragment offset=13'b0
[0040] Middle slice: M flag = 1'b1, fragment offset ≠ 13'b0
[0041] Tail piece: M flag=1'b0
[0042] In this embodiment, after the identification is completed, the switching chip extracts the five-tuple information such as the source IP address, the destination IP address, the source port number and the destination port number, and calculates the routing hash value using, for example, the CRC32 algorithm. The switching chip encapsulates the fragmented message and the routing hash value in a custom message header and forwards it to the network processor through the fabric interface.
[0043] S102: The network processor uses the source IP address, the destination IP address, and the identification ID of the IP fragment message as a reassembly index to virtually reassemble the cached out-of-order IP fragment messages.
[0044] S103, the network processor replaces the routing hash value of the custom message header carried by each IP fragment message with the hash value of the first fragment, and sends the IP fragment message that has completed virtual reassembly to the switch.
[0045] like Figure 3 As shown, in this embodiment, after receiving the IP fragment message, the network processor extracts the hash value in the custom message header, and at the same time, based on the information such as the fragment identifier and the fragment offset, uses the reassembly algorithm defined by the virtual reassembly module of the network protocol stack (such as the LUlea algorithm) to virtually reassemble the fragment messages that arrive out of order in the memory, and writes the hash value of the first fragment into the custom message header of each fragment after reassembly. Then, the network processor sends the fragment carrying the hash value back to the switch through the fabric port based on the original fragment information such as the fragment offset and the receiving order.
[0046] In this embodiment, for fragmented messages that have exceeded the fragment reassembly timeout of the network protocol stack (configuration parameters ipfrag_time and ip6frag_time of the Linux network protocol stack) and whose virtual reassembly is not completed, the reassembly timeout task module executes the reassembly timeout task and notifies the sending module on the network processor to send the cached IP fragmented message. The sent IP fragmented message can be sent in the order in which the network processor receives it, or in the order after the fragment offset is sorted. After sending, the memory occupied by the fragmented message is released. The custom message header carried by the sent IP fragmented message is original and has not been modified.
[0047] In this embodiment, for the cached IP fragmented message, it is further determined whether it exceeds the maximum memory used when reassembling IP fragments (configuration parameters ipfrag_high_thresh and ip6frag_high_thresh of the Linux network protocol stack). If it does not exceed, step S101 is executed, otherwise the reassembly memory resource shortage task module executes the reassembly memory resource shortage task, and notifies the sending module on the network processor to send the IP fragmented message cached on the specified index based on the source IP address, destination IP address, and identification ID as indexes. The sent IP fragmented message can be sent in the order in which the network processor receives it, or in the order after the fragment offset is sorted. The memory occupied by the fragmented message is released after the sending is completed. The custom message header carried by the sent IP fragmented message is original and has not been modified.
[0048] S104: The switch forwards the message according to the custom message header of the IP fragment message.
[0049] In this embodiment, after receiving the IP fragment message with the custom message header sent by the network processor, the switch extracts the routing hash value in the custom message header, and selects a member port of the link aggregation group or ECMP to forward the IP fragment message according to the value.
[0050] Specifically, after the switch receives the IP fragment message returned by the network processor, it extracts the routing hash value in the custom message header. Based on the routing hash value, the switching chip selects the same member port as the first fragment message in the link aggregation group to determine the forwarding path of the IP fragment message. The switching chip forwards the IP fragment message from the selected member port, so that the fragment message and the non-fragment message take the same forwarding path. Since each IP fragment message carries the same routing hash value, the forwarding path of the out-of-order fragment message can be guaranteed to be consistent regardless of the arrival order of the IP fragment messages.
[0051] When receiving an out-of-order IP fragment message, the embodiment of the present invention forwards it to the network processor for virtual reassembly. For the message that is successfully reassembled, the routing hash value of the first fragment is extracted and written into the custom message header of each fragment to ensure that all fragments are forwarded through the same path. For the message that fails to be reassembled, the original fragment form is maintained for forwarding. The switching chip determines the forwarding path according to the hash value in the custom message header, realizes the path consistency of fragmented and non-fragmented messages, and the path consistency of out-of-order fragment messages. Finally, the custom message header is stripped off and the IP fragment message is forwarded from the determined egress port. The present invention effectively improves the network transmission efficiency and reliability, and is particularly suitable for complex network environments that process a large number of out-of-order fragment messages.
[0052] The second embodiment of the present invention further provides a switch out-of-order fragment message forwarding and following system, which includes:
[0053] The switch is used to filter out IP fragment messages, and forward the IP fragment messages to the network processor after adding a custom message header to the IP fragment messages; the IP fragment messages include a first fragment, a middle fragment, and a last fragment;
[0054] A network processor, configured to virtually reassemble the cached IP fragmented message by using the source IP address, the destination IP address, and the identification ID of the IP fragmented message as the reassembly index;
[0055] The network processor is further used to replace the routing hash value of the custom message header carried by each IP fragment message with the hash value of the first fragment for the IP fragment message that has completed the virtual reassembly, and then send it to the switch;
[0056] The switch is also used to forward messages according to the custom message header of the IP fragment message.
[0057] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A switch out-of-order fragment message forwarding and following method, characterized in that: include: S101, the switch filters out IP fragment messages, adds a custom message header to the IP fragment messages, and forwards them to the network processor; The IP fragment message includes a first fragment, a middle fragment and a last fragment; S102, the network processor uses the source IP address, destination IP address, and identification ID of the IP fragment message as a reassembly index to virtually reassemble the cached out-of-order IP fragment message; S103, the network processor replaces the routing hash value of the custom message header carried by each IP fragment message with the hash value of the first fragment for the IP fragment message that has completed the virtual reassembly, and then sends it to the switch; S104: The switch forwards the message according to the custom message header of the IP fragment message.
2. The switch out-of-order fragment message forwarding and following method according to claim 1, characterized in that: In step S101, the service board panel port of the switch uses ACL to filter out IP fragment messages.
3. The switch out-of-order fragment message forwarding and following method according to claim 1, characterized in that: In step S102, when the network processor virtually reassembles the fragmented messages, the fragmented messages in disorder are reassembled through the fragment reassembly function of the network protocol stack, and the original receiving order of the fragmented messages is retained.
4. The switch out-of-order fragment message forwarding and following method according to claim 1, characterized in that: In step S103, after replacing the routing hash value in the custom message header of the IP fragment message with the hash value of the first fragment, the network processor sends the IP fragment message in the order of reception or the order after fragment offset sorting, and releases the memory occupied by the fragment message.
5. The switch out-of-order fragment message forwarding and following method according to claim 1, characterized in that: Also includes: The network processor notifies the sending module to send the fragmented message in the original order for the IP fragmented message whose virtual reassembly is not completed within the fragment reassembly timeout period, and the custom message header of the fragmented message remains unchanged.
6. The switch out-of-order fragment message forwarding and following method as claimed in claim 5, characterized in that: Also includes: The network processor determines whether the IP fragment message exceeds the maximum memory for reassembly. If so, the reassembly memory resource shortage task module notifies the sending module to send the IP fragment message according to the index, and the custom message header of the IP fragment message remains unchanged.
7. The switch out-of-order fragment message forwarding and following method according to claim 1, characterized in that: In step S104, after receiving the IP fragment message with the custom message header sent by the network processor, the switch extracts the routing hash value in the custom message header, and selects a member port of a link aggregation group or ECMP to forward the IP fragment message according to the value.
8. A switch out-of-order fragment message forwarding and following system, characterized in that: include: The switch is used to filter out the IP fragment message, and forward the IP fragment message to the network processor after adding a custom message header to the IP fragment message; The IP fragment message includes a first fragment, a middle fragment and a last fragment; A network processor is used to virtually reassemble the cached out-of-order IP fragment messages by using the source IP address, the destination IP address, and the identification ID of the IP fragment message as the reassembly index; The network processor is further used to replace the routing hash value of the custom message header carried by each IP fragment message with the hash value of the first fragment for the IP fragment message that has completed the virtual reassembly, and then send it to the switch; The switch is also used to forward messages according to the custom message header of the IP fragment message.
Citation Information
Patent Citations
IP (Internet protocol) fragment processing method based on two-level table storage and transport layer information inquiry
CN102123090A
Message forwarding method and device
CN113542131A