Data forwarding method and apparatus, computer device, storage medium, and program product

By acquiring and reassembling the information of the initial fragmented message, and fragmenting it according to its length, the problem of transmission failure caused by fixed-size fragmentation is solved, and the successful transmission of fragmented messages is achieved.

CN119484548BActive Publication Date: 2026-02-10CHINA TELECOM CLOUD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411781854.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2026-02-10
Estimated Expiration
2044-12-05

AI Technical Summary

Technical Problem

In existing technologies, fixed-size data fragmentation may lead to fragmented message transmission failures.

Method used

By obtaining the message information of the initial fragmented message, reassembling it according to the message identifier, determining the target receiver identifier, and fragmenting the reassembled message according to the length of the initial fragmented message, the target fragmented message is obtained.

Benefits of technology

This avoids the problem of mismatch between fragmented message length and transmission link, ensuring successful transmission of fragmented messages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119484548B_ABST
    Figure CN119484548B_ABST
Patent Text Reader

Abstract

The application relates to a data forwarding method and device, a computer device, a storage medium and a program product. Initial fragmented messages and message information of the initial fragmented messages are acquired; the initial fragmented messages are reorganized according to message identifiers corresponding to the initial fragmented messages, and reorganized messages are obtained; the reorganized messages are fragmented according to initial lengths of the initial fragmented messages contained in the reorganized messages, and target fragmented messages are obtained; and the target fragmented messages are sent to target receiving ends corresponding to target receiving end identifiers. When the reorganized messages are fragmented, the reorganized messages are fragmented according to the initial lengths of the initial fragmented messages contained in the reorganized messages, so that the lengths of the fragmented messages are the same as the lengths of the initial fragmented messages, the problem that the lengths of the fragmented messages obtained after the reorganized messages are fragmented are not adapted to transmission links is avoided, and the problem that the fragmented messages fail to be sent is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer information processing technology, and in particular to a data forwarding method, apparatus, computer equipment, storage medium, and program product. Background Technology

[0002] In network transmission, when the size of an Internet Protocol (IP) datagram exceeds the network's Maximum Transmission Unit (MTU), the IP datagram needs to be fragmented for transmission. For example, an IP datagram sent by a client is fragmented and then sent to a load balancer. Since the headers of non-first fragments do not contain the server's IP information, the load balancer needs to reassemble the fragments, determine the server for each fragment based on the reassembled datagram, and then fragment the reassembled datagram again before sending it to the server.

[0003] In related technologies, reassembled data packets are usually divided into fixed-size data fragments. Fixed-size data fragments may not be compatible with the transmission link, which may lead to the failure of fragment packet transmission. Summary of the Invention

[0004] Therefore, it is necessary to provide a data forwarding method, apparatus, computer equipment, storage medium, and program product to address the above-mentioned technical problems, which can avoid the problem of fragmented packet transmission failure due to the use of fixed-size data fragments.

[0005] In a first aspect, this application provides a data forwarding method, the method comprising:

[0006] Obtain each initial fragment packet and its packet information; wherein, the packet information includes the initial length, packet identifier, and initial receiver identifier of the initial fragment packet;

[0007] Based on the message identifier corresponding to each initial fragment message, the initial fragment messages are reassembled to obtain a reassembled message; wherein, the reassembled message includes the target receiver identifier;

[0008] Based on the initial length of each initial fragment packet contained in the reassembled packet, the reassembled packet is fragmented to obtain each target fragment packet;

[0009] Each target fragment message is sent to the target receiver corresponding to the target receiver identifier.

[0010] In one embodiment, the step of fragmenting the reassembled message according to the initial length of each initial fragment message contained in the reassembled message to obtain each target fragment message includes:

[0011] Determine the maximum length among the initial lengths of the initial fragments contained in the reassembled message;

[0012] The reassembled message is fragmented according to the maximum length to obtain target fragment messages; wherein the message length of the last target fragment message is less than or equal to the maximum length.

[0013] In one embodiment, the step of fragmenting the reassembled message according to the initial length of each initial fragment message contained in the reassembled message to obtain each target fragment message includes:

[0014] The message length of each initial fragment message contained in the reconstructed message is taken as the message length of each target fragment message;

[0015] The reassembled message is fragmented according to the message length of each target fragment message to obtain each target fragment message.

[0016] In one embodiment, the step of reassembling the initial fragmented packets according to the packet identifier corresponding to each initial fragmented packet to obtain a reassembled packet includes:

[0017] Based on the message identifier corresponding to each initial fragment message, the initial fragment messages are reassembled to obtain intermediate messages;

[0018] Replace the initial receiver identifier corresponding to the intermediate message with the target receiver identifier to obtain the reassembled message.

[0019] In one embodiment, the step of fragmenting the reassembled message according to the initial length of each initial fragment message contained in the reassembled message to obtain each target fragment message includes:

[0020] Verify that the reassembled message is complete;

[0021] If the reassembled message is complete, the reassembled message is fragmented according to the initial length of each initial fragment message contained in the reassembled message.

[0022] In one embodiment, obtaining each initial fragment packet and the packet information of each initial fragment packet includes:

[0023] Obtain each original fragment of the packet sent by the sender;

[0024] The Internet Protocol header, User Datagram Protocol header, and Virtual Extended LAN header are removed from each original fragmented message to obtain each initial fragmented message and its message information.

[0025] Secondly, this application also provides a data forwarding apparatus, the apparatus comprising:

[0026] The acquisition module is used to acquire each initial fragment packet and the packet information of each initial fragment packet; wherein, the packet information includes the initial length, packet identifier, and initial receiver identifier of the initial fragment packet;

[0027] The reassembly module is used to reassemble each initial fragment packet according to the packet identifier corresponding to each initial fragment packet to obtain a reassembled packet; wherein, the reassembled packet includes a target receiver identifier;

[0028] The fragmentation module is used to fragment the reassembled message according to the initial length of each initial fragment message contained in the reassembled message, so as to obtain each target fragment message.

[0029] The sending module is used to send each target fragment message to the target receiver corresponding to the target receiver identifier.

[0030] Thirdly, this application also provides a computer device, the computer device including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:

[0031] Obtain each initial fragment packet and its packet information; wherein, the packet information includes the initial length, packet identifier, and initial receiver identifier of the initial fragment packet;

[0032] Based on the message identifier corresponding to each initial fragment message, the initial fragment messages are reassembled to obtain a reassembled message; wherein, the reassembled message includes the target receiver identifier;

[0033] Based on the initial length of each initial fragment packet contained in the reassembled packet, the reassembled packet is fragmented to obtain each target fragment packet;

[0034] Each target fragment message is sent to the target receiver corresponding to the target receiver identifier.

[0035] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0036] Obtain each initial fragment packet and its packet information; wherein, the packet information includes the initial length, packet identifier, and initial receiver identifier of the initial fragment packet;

[0037] Based on the message identifier corresponding to each initial fragment message, the initial fragment messages are reassembled to obtain a reassembled message; wherein, the reassembled message includes the target receiver identifier;

[0038] Based on the initial length of each initial fragment packet contained in the reassembled packet, the reassembled packet is fragmented to obtain each target fragment packet;

[0039] Each target fragment message is sent to the target receiver corresponding to the target receiver identifier.

[0040] Fifthly, this application also provides a computer program product, which includes a computer program that, when executed by a processor, performs the following steps:

[0041] Obtain each initial fragment packet and its packet information; wherein, the packet information includes the initial length, packet identifier, and initial receiver identifier of the initial fragment packet;

[0042] Based on the message identifier corresponding to each initial fragment message, the initial fragment messages are reassembled to obtain a reassembled message; wherein, the reassembled message includes the target receiver identifier;

[0043] Based on the initial length of each initial fragment packet contained in the reassembled packet, the reassembled packet is fragmented to obtain each target fragment packet;

[0044] Each target fragment message is sent to the target receiver corresponding to the target receiver identifier.

[0045] The aforementioned data forwarding method, apparatus, computer equipment, storage medium, and program product acquire initial fragmented packets and packet information of each initial fragmented packet; wherein, the packet information includes the initial length, packet identifier, and initial receiver identifier of each initial fragmented packet; and reassembles each initial fragmented packet according to the packet identifier corresponding to each initial fragmented packet to obtain a reassembled packet; wherein, the reassembled packet includes a target receiver identifier; furthermore, according to the initial length of each initial fragmented packet contained in the reassembled packet, the reassembled packet is fragmented to obtain each target fragmented packet; and each target fragmented packet is sent to the target receiver corresponding to the target receiver identifier. The above scheme fragments the reassembled message according to the initial length of each initial fragment contained in the reassembled message, so that the length of the fragmented message is the same as the length of the initial fragmented message. Compared with using a fixed fragment length to reassemble the reassembled message, this avoids the problem of the fragmented message length being incompatible with the transmission link, and thus avoids the problem of fragmented message transmission failure. Attached Figure Description

[0046] Figure 1 This is a flowchart illustrating a data forwarding method in one embodiment;

[0047] Figure 2 This is a schematic diagram of the process of fragmenting a reassembled message in one embodiment;

[0048] Figure 3 This is a schematic diagram of message reassembly in one embodiment;

[0049] Figure 4 This is a schematic diagram of another process for fragmenting reassembled packets in one embodiment;

[0050] Figure 5 This is a schematic diagram illustrating the process of reassembling initial fragmented packets in one embodiment;

[0051] Figure 6 This is a schematic diagram of another process for fragmenting reassembled packets in one embodiment;

[0052] Figure 7 This is a schematic diagram illustrating the process of obtaining initial fragmented packets and packet information in one embodiment;

[0053] Figure 8 This is a schematic diagram illustrating the decapsulation of a VXLAN-encapsulated raw fragmented packet in one embodiment;

[0054] Figure 9 This is a schematic diagram of another data forwarding process in one embodiment;

[0055] Figure 10 This is a structural block diagram of a data forwarding device in one embodiment;

[0056] Figure 11 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0057] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0058] The data forwarding method provided in this application embodiment can be applied to application scenarios where a load balancer receives fragmented packets sent by a client and sends the fragmented packets to a server. The method in this application embodiment can be executed by a load balancer, which can be a proxy server.

[0059] Load balancing can be achieved using a standalone server or a server cluster consisting of multiple servers.

[0060] In one embodiment, such as Figure 1 As shown, a data forwarding method is provided. Taking the application of this method to load balancing as an example, the method includes the following steps:

[0061] S101, obtain each initial fragment message and the message information of each initial fragment message.

[0062] For example, the initial fragmented message can be sent by the client. The load balancer receives the initial fragmented message sent by the client and obtains the message information of each initial fragmented message from the message header information of the initial fragmented message. The message information includes the initial length of the initial fragmented message, the message identifier, and the initial receiver identifier; the message identifier can be used to identify the original data message to which the initial fragmented message belongs.

[0063] S102, based on the message identifier corresponding to each initial fragment message, reassemble each initial fragment message to obtain a reassembled message.

[0064] For example, one can first determine whether the initial fragmented packet is a fragment. For instance, the "DF" (Don't Fragment) and "MF" (More Fragments) bits in the "Flags" field of the IP header in the initial fragmented packet are used to identify whether it is a fragmented packet. If the "DF" bit is 0 and the "MF" bit is 1, it indicates that the packet is a fragmented packet.

[0065] Furthermore, the IP fragmentation and reassembly library of the Data Plane Development Kit (DPDK) can be used to reassemble packets. For example, the initial fragments belonging to the same original data packet can be identified based on the packet identifier corresponding to each initial fragment, and the reassembly order of each initial fragment can be determined based on the "fragment offset" field in the packet header of each initial fragment. Then, the initial fragments can be reassembled to obtain the reassembled packet.

[0066] Furthermore, the length of each initial fragment can be stored. For example, the field MBUF_FIELD_FRAG can be registered in advance in the dynamic field reserved in the memory buffer (mbuf) to store the initial length of each initial fragment.

[0067] The IP header data of the reassembled packet adopts the IP header data of the first initial fragment packet, which includes the IP identifier of the load balancer. Then, the IP header data of the reassembled packet is replaced with the target receiver identifier, which can be the IP identifier of the server.

[0068] Optionally, a scheduling algorithm can be used to select an available backend server as the target receiver. The scheduling algorithm can be set according to actual needs. For example, it can be set to a round-robin scheduling algorithm. No specific scheduling algorithm is limited here.

[0069] Once the target receiver is identified, the full NAT mode can be used to convert the source IP and source port in the Layer 3 and Layer 4 header data of the reassembled message into the local IP and local port, respectively, and convert the destination IP and destination port into the target receiver IP and target receiver port.

[0070] S103, according to the initial length of each initial fragment of the reassembled message, the reassembled message is fragmented to obtain each target fragment of the message.

[0071] For example, you can first determine whether it is a reassembled packet. For instance, you can check whether the MBUF_FIELD_FRAG in the mbuf header has a value. If it does, it is a reassembled packet and needs to be fragmented before being sent.

[0072] The initial length of each initial fragment in the reassembled packet can then be obtained from the MBUF_FIELD_FRAG field. Based on the initial lengths of these initial fragments, the reassembled packet is fragmented to obtain target fragments. All three layers of data in each target fragment have been transformed, and the first target fragment contains transformed four layers of data. The length of each target fragment is consistent with the length received when the fragment was first acquired.

[0073] S104, send each target fragment message to the target receiver corresponding to the target receiver identifier.

[0074] Then, each target fragment can be sent to the target receiver identified by the target receiver identifier. The target receiver can be a server. This achieves load balancing forwarding of the initial fragment without the client and server being aware of it, avoiding inconsistencies between the length of the forwarded target fragment and the length of the initial fragment.

[0075] The aforementioned data forwarding method obtains initial fragmented packets and their message information. The message information includes the initial length, message identifier, and initial receiver identifier of each initial fragmented packet. Based on the message identifier corresponding to each initial fragmented packet, the initial fragmented packets are reassembled to obtain a reassembled packet. The reassembled packet includes a target receiver identifier. Then, based on the initial length of each initial fragmented packet contained in the reassembled packet, the reassembled packet is fragmented to obtain target fragmented packets. Finally, each target fragmented packet is sent to the target receiver corresponding to its target receiver identifier. In this scheme, when fragmenting the reassembled packet, the initial length of each initial fragmented packet contained in the reassembled packet is used to fragment the reassembled packet, ensuring that the length of the fragmented packet is the same as the length of the initial fragmented packet. Compared to using a fixed fragment length for reassembling the reassembled packet, this avoids the problem of the fragmented packet length being incompatible with the transmission link, thereby preventing fragmented packet transmission failure.

[0076] In some of these embodiments, see Figure 2 , Figure 2 A flowchart illustrating the process of fragmenting reassembled packets is provided, which includes the following steps:

[0077] S201, determine the maximum length among the initial lengths of the initial fragments contained in the reassembled message.

[0078] See Figure 3 , Figure 3 A schematic diagram of packet reassembly is provided. Before fragmented packet reassembly, each fragment exists in a separate mbuf (possibly a chain of mbufs), and the initial length of the current fragment is stored in the MBUF_FIELD_FRAG of the mbuf header. After reassembly, the reassembled packet is a chain of mbufs, and the initial length of the first fragment is stored in the MBUF_FIELD_FRAG of the mbuf header of the reassembled packet.

[0079] For example, to ensure the correctness and efficiency of data transmission over the network, the IP protocol stipulates that the fragment offset field in IP datagrams must be in units of 8 bytes. That is, the length of each fragment (except the last fragment) must be a multiple of 8. For instance, when the MTU is 1700 (not a multiple of 8), the length of the first fragment is 1696 (less than the MTU), and the length of the last fragment may be less than 1696, or it may be 1697-1700. If the length of the first fragment, i.e., 1696, is saved, in subsequent fragmentation, the last fragment (1697-1700) will be divided into two fragments of length 1696 and 1-4 and sent out.

[0080] Therefore, we can compare the MBUF_FIELD_FRAG field in the mbuf chain, which is the initial length of each fragment, and select the largest initial length to store in the MBUF_FIELD_FRAG of the mbuf header of the reassembled message. The largest initial length is regarded as the MTU of the subsequent fragments.

[0081] S202, the reassembled message is fragmented according to the maximum length to obtain each target fragment message.

[0082] Furthermore, the reassembled packet can be fragmented according to the maximum length to obtain individual target fragment packets. The length of each target fragment packet (excluding the last one) is equal to the maximum length, while the length of the last target fragment packet is less than or equal to the maximum length. This ensures that the length of each target fragment packet after fragmentation is the same as that of each initial fragment packet. Moreover, each target fragment packet contains the Layer 3 header information of the reassembled packet, such as the server's IP address.

[0083] In this embodiment, the reassembled packet is fragmented according to the maximum length among the initial fragments contained in the reassembled packet, so that the length of each target fragment is the same as that of each initial fragment. This achieves load balancing forwarding of the initial fragments without the client and server being aware of it, and avoids the problem of inconsistency between the length of the forwarded target fragment and the length of the initial fragment.

[0084] In some alternative implementations, see [link to relevant documentation]. Figure 4 , Figure 4 Another flowchart for fragmenting reassembled packets is provided, which includes the following steps:

[0085] S401, the message length of each initial fragment message contained in the reassembled message is taken as the message length of each target fragment message.

[0086] For example, the message length of each initial fragment message included in the reassembled message can be pre-stored in the MBUF_FIELD_FRAG field of each mbuf header. The message length of each initial fragment message can be obtained from the MBUF_FIELD_FRAG field of the mbuf header of each initial fragment message, and the message length of each initial fragment message included in the reassembled message can be used as the message length of each target fragment message.

[0087] S402, according to the message length of each target fragment message, the reassembled message is fragmented to obtain each target fragment message.

[0088] Furthermore, the reassembled packet can be fragmented according to the length of each target fragment packet to obtain individual target fragment packets. This ensures that the length of each target fragment packet is the same as that of each initial fragment packet. Additionally, each target fragment packet contains the Layer 3 header information of the reassembled packet, such as the server's IP address.

[0089] In this embodiment, the reassembled packet is fragmented according to the initial length of each initial fragment packet contained in the reassembled packet, so that the length of each target fragment packet after fragmentation is the same as that of each initial fragment packet. This achieves load balancing forwarding of the initial fragment packets without the client and server being aware of it, and avoids the problem of inconsistency between the packet length of the forwarded target fragment packets and the packet length of the initial fragment packets.

[0090] In some alternative implementations, see [link to relevant documentation]. Figure 5 , Figure 5 A schematic diagram of the process for reassembling initial fragmented packets is provided, which specifically includes the following steps:

[0091] S501: Based on the message identifier corresponding to each initial fragment message, reassemble each initial fragment message to obtain an intermediate message.

[0092] For example, the original data packet to which each initial fragment belongs can first be determined based on the packet identifier corresponding to each initial fragment packet. Then, the initial fragment packets can be reassembled to obtain intermediate packets. The Layer 3 header information of the intermediate packets is the Layer 3 header information of the first initial fragment packet in the intermediate packets. For example, the Layer 3 header information of the first initial fragment packet is the IP identifier of the load balancer.

[0093] S502, replace the initial receiver identifier corresponding to the intermediate message with the target receiver identifier to obtain the reassembled message.

[0094] Furthermore, the initial receiver identifier for each intermediate message is the Layer 3 header information of the first initial fragment in each intermediate message; the target receiver identifier is the server's IP address. Therefore, the initial receiver identifier for each intermediate message can be replaced with the target receiver identifier, that is, the Layer 3 header information of the initial fragment in each intermediate message can be replaced with the server's IP address, resulting in the reassembled message.

[0095] In this embodiment of the application, by reassembling each initial fragmented message and replacing the three-layer header information of the intermediate message with the identifier of the target receiver, the receiver of the reassembled message can be clearly identified, which facilitates the forwarding of the reassembled message to the target.

[0096] In some alternative implementations, the integrity of the data packets can be verified to avoid forwarding incomplete data packets to the target end.

[0097] Based on this, see Figure 6 , Figure 6 Another flowchart for fragmenting reassembled packets is provided, which includes the following steps:

[0098] S601, verify whether the reassembled message is complete.

[0099] For example, it can be determined whether there are any unreceived initial fragmented packets. If no initial fragmented packets are received within a preset time period, the received initial fragmented packets are reassembled to obtain a reassembled packet. The completeness of the reassembled packet can then be verified. For instance, the length of the original data packet is compared with the length of the reassembled packet to determine its completeness. If the reassembled packet is complete, the length of the original data packet is equal to the length of the reassembled packet; otherwise, the reassembled packet is considered incomplete.

[0100] S602, if the reassembled message is complete, the reassembled message is fragmented according to the initial length of each initial fragment message contained in the reassembled message.

[0101] Furthermore, after confirming the integrity of the reassembled message, the process of fragmenting the reassembled message according to the initial length of each initial fragment contained within it is then performed. This avoids sending incomplete data packets to the target end, thus preventing the waste of unnecessary transmission and data processing resources.

[0102] In this embodiment, by determining whether the reassembled message is complete, and discarding the reassembled message if it is incomplete, incomplete data messages are avoided from being sent to the target end, thus avoiding the waste of unnecessary transmission and data processing resources.

[0103] In some optional implementations, when the original fragmented packets sent by the sender to the load balancer are packets encapsulated in Virtual eXtensible Local Area Network (VXLAN), embodiments of this application provide a method for obtaining the initial fragmented packets and the packet information of each initial fragmented packet.

[0104] For example, see Figure 7 , Figure 7 A flowchart illustrating the process of obtaining the initial fragment and the message information of each initial fragment is provided, specifically including the following steps:

[0105] S701, retrieve the original fragmented messages sent by the sender.

[0106] For example, the sender can be a client, obtaining the original fragmented packet sent by the sender. This original fragmented packet is a packet encapsulated with VXLAN. The VXLAN-encapsulated packet has a VXLAN header, an external IP header, and a User Datagram Protocol (UDP) header added. For instance, the VXLAN-encapsulated packet can have a VXLAN header added before the original IP packet, containing information such as the VXLAN Network Identifier (VNI), source MAC address, and destination MAC address. Then, an external IP header and a UDP header are added before the VXLAN header for transmission over the physical network. The external IP header contains the source IP address and destination IP address, while the UDP header contains the source port number and destination port number (typically the standard VXLAN port 4789).

[0107] The sending end then sends each original fragment to the load balancer based on the external IP header and external UDP header, and the load balancer decapsulates the original fragmented packets. In this way, fragmented packet reassembly using the DPDK IP fragmentation and reassembly library can be performed on the same load balancer.

[0108] S702 removes the Internet Protocol header, User Datagram Protocol header, and Virtual Extended LAN header from each original fragmented message to obtain each initial fragmented message and its message information.

[0109] For example, participate Figure 8 , Figure 8A schematic diagram is provided for decapsulating raw fragmented packets encapsulated with VXLAN. The raw fragmented packets can be decapsulated; for example, the Internet Protocol header (external IP header), User Datagram Protocol header (external UDP header), and Virtual Extended LAN header (VXLAN header) can be removed from the raw fragmented packets to obtain the initial fragmented packets and their individual packet information.

[0110] For example, the original fragmented packet includes an outer IP header and an outer UDP header, i.e., an outer IP port, as well as a VXLAN header; after removing the outer IP header, outer UDP header, and VXLAN header, the data portion and inner IP are obtained, i.e., the initial fragmented packet and the packet information of each initial fragmented packet.

[0111] The fragmented data can then be reassembled to obtain an intermediate message. The header of the intermediate message contains the inner IP address of the first initial fragmented message. The header of the intermediate message can then be replaced with the target receiver identifier, which is... Figure 7 The inner IP after conversion is then used to obtain the reassembled message.

[0112] When fragmenting the reassembled message, the header information of each fragment includes the target receiver identifier, i.e., the converted inner IP.

[0113] In this embodiment of the application, by encapsulating the original fragmented packets with VXLAN, the original fragmented packets belonging to the same original data packet can be sent to the same load balancer, thereby facilitating the reassembly of fragments using the DPDK IP fragmentation reassembly library in the same load balancer.

[0114] In some alternative implementations, see [link to relevant documentation]. Figure 9 , Figure 9 Another data forwarding flowchart is provided, using the example of the original fragmented message sent by the sender being a VXLAN encapsulated message.

[0115] Step 1: Receive each original fragmented message and decapsulate each original fragmented message to obtain each initial fragmented message and its message information.

[0116] Step 2: Determine whether each initial fragmented packet is a fragmented packet; if yes, proceed to Step 3; otherwise, proceed to Step 5.

[0117] Step 3: Save the initial length of each initial fragment packet, and reassemble each initial fragment packet to obtain a reassembled packet.

[0118] Step 4: Determine if the reassembled message is complete. If yes, proceed to Step 5; otherwise, proceed to Step 1.

[0119] Step 5: Select the target receiver and modify the IP header information of the reassembled message to the IP identifier of the target receiver.

[0120] Step 6: Determine if it is a reassembled message. If yes, proceed to Step 7; otherwise, proceed to Step 8.

[0121] Step 7: Fragment the reassembled message according to the maximum initial length to obtain each target fragment message.

[0122] Step 8: Send each target fragment message to the target receiver.

[0123] In this embodiment, the IP fragmentation and reassembly library of DPDK is used to reassemble fragmented packets. Fragmented packets can be processed on the same load balancer. Incomplete reassembled packets will be discarded after expiration, ensuring the correctness of forwarding fragmented packets.

[0124] Furthermore, the length information of the fragmented packets is stored before reassembling the packets to prevent the fragment length information from being lost after reassembly. The reassembled packets can be fragmented into initial lengths, enabling load balancing forwarding of fragmented packets without the client and server being aware of it, thus avoiding inconsistencies in the length of fragmented packets after forwarding.

[0125] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0126] Based on the same inventive concept, this application also provides a data forwarding apparatus for implementing the data forwarding method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more data forwarding apparatus embodiments provided below can be found in the limitations of the data forwarding method described above, and will not be repeated here.

[0127] In one embodiment, such as Figure 10As shown, a data forwarding device is provided, comprising:

[0128] The acquisition module 10 is used to acquire each initial fragment packet and the packet information of each initial fragment packet; wherein, the packet information includes the initial length of the initial fragment packet, the packet identifier, and the initial receiver identifier;

[0129] The reassembly module 20 is used to reassemble each initial fragment message according to the message identifier corresponding to each initial fragment message to obtain a reassembled message; wherein, the reassembled message includes the target receiver identifier;

[0130] Fragmentation module 30 is used to fragment the reassembled message according to the initial length of each initial fragment message contained in the reassembled message, so as to obtain each target fragment message;

[0131] The sending module 40 is used to send each target fragment message to the target receiver corresponding to the target receiver identifier.

[0132] The aforementioned data forwarding device acquires initial fragmented packets and packet information for each initial fragmented packet. The packet information includes the initial length, packet identifier, and initial receiver identifier for each initial fragmented packet. Based on the packet identifier corresponding to each initial fragmented packet, the device reassembles the initial fragmented packets to obtain reassembled packets. The reassembled packets include a target receiver identifier. Then, based on the initial length of each initial fragmented packet contained in the reassembled packets, the device fragments the reassembled packets to obtain target fragmented packets. Finally, the device sends each target fragmented packet to the target receiver corresponding to the target receiver identifier. In this scheme, when fragmenting the reassembled packets, the device fragments the packets based on the initial length of each initial fragmented packet contained in the reassembled packets, ensuring that the length of the fragmented packets is the same as the length of the initial fragmented packets. Compared to using a fixed fragment length for reassembling the reassembled packets, this avoids the problem of the fragmented packet length being incompatible with the transmission link, thereby preventing fragmented packet transmission failures.

[0133] In one embodiment, the slicing module 30 is specifically used for:

[0134] Determine the maximum length among the initial lengths of the initial fragments contained in the reassembled message; fragment the reassembled message according to the maximum length to obtain each target fragment message; wherein the message length of the last target fragment message is less than or equal to the maximum length.

[0135] In one embodiment, the slicing module 30 is specifically used for:

[0136] The length of each initial fragment contained in the reassembled message is used as the length of each target fragment; the reassembled message is fragmented according to the length of each target fragment to obtain each target fragment message.

[0137] In one embodiment, the recombination module 20 is specifically used for:

[0138] Based on the message identifier corresponding to each initial fragment message, the initial fragment messages are reassembled to obtain intermediate messages; the initial receiver identifier corresponding to the intermediate messages is replaced with the target receiver identifier to obtain reassembled messages.

[0139] In one embodiment, the slicing module 30 is specifically used for:

[0140] Verify whether the reassembled message is complete; if the reassembled message is complete, fragment the reassembled message according to the initial length of each initial fragment message contained in the reassembled message.

[0141] In one embodiment, the acquisition module 10 is specifically used for:

[0142] Obtain each original fragmented message sent by the sender; remove the Internet Protocol header information, User Datagram Protocol header information, and Virtual Extended LAN header information from each original fragmented message to obtain each initial fragmented message and its message information.

[0143] Each module in the aforementioned data forwarding device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0144] In one embodiment, a computer device is provided, which may be a proxy server, i.e., a load balancer; its internal structure diagram may be as follows: Figure 11 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores message data. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a data forwarding method.

[0145] Those skilled in the art will understand that Figure 11The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0146] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0147] Obtain each initial fragment message and its message information; the message information includes the initial length of the initial fragment message, the message identifier, and the initial receiver identifier.

[0148] Based on the message identifier corresponding to each initial fragment message, the initial fragment messages are reassembled to obtain a reassembled message; wherein, the reassembled message includes the target receiver identifier;

[0149] Based on the initial length of each initial fragment contained in the reassembled message, the reassembled message is fragmented to obtain each target fragment message;

[0150] Each target fragment message is sent to the target receiver identified by the target receiver.

[0151] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0152] Determine the maximum length among the initial lengths of the initial fragments contained in the reassembled message; fragment the reassembled message according to the maximum length to obtain each target fragment message; wherein the message length of the last target fragment message is less than or equal to the maximum length.

[0153] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0154] The length of each initial fragment contained in the reassembled message is used as the length of each target fragment; the reassembled message is fragmented according to the length of each target fragment to obtain each target fragment message.

[0155] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0156] Based on the message identifier corresponding to each initial fragment message, the initial fragment messages are reassembled to obtain intermediate messages; the initial receiver identifier corresponding to the intermediate messages is replaced with the target receiver identifier to obtain reassembled messages.

[0157] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0158] Verify whether the reassembled message is complete; if the reassembled message is complete, fragment the reassembled message according to the initial length of each initial fragment message contained in the reassembled message.

[0159] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0160] Obtain the original fragmented packets sent by the sender; remove the Internet Protocol header, User Datagram Protocol header, and Virtual Extended LAN header from the original fragmented packets to obtain the initial fragmented packets and the packet information of each initial fragmented packet.

[0161] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0162] Obtain each initial fragment message and its message information; the message information includes the initial length of the initial fragment message, the message identifier, and the initial receiver identifier.

[0163] Based on the message identifier corresponding to each initial fragment message, the initial fragment messages are reassembled to obtain a reassembled message; wherein, the reassembled message includes the target receiver identifier;

[0164] Based on the initial length of each initial fragment contained in the reassembled message, the reassembled message is fragmented to obtain each target fragment message;

[0165] Each target fragment message is sent to the target receiver identified by the target receiver.

[0166] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0167] Determine the maximum length among the initial lengths of the initial fragments contained in the reassembled message; fragment the reassembled message according to the maximum length to obtain each target fragment message; wherein the message length of the last target fragment message is less than or equal to the maximum length.

[0168] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0169] The length of each initial fragment contained in the reassembled message is used as the length of each target fragment; the reassembled message is fragmented according to the length of each target fragment to obtain each target fragment message.

[0170] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0171] Based on the message identifier corresponding to each initial fragment message, the initial fragment messages are reassembled to obtain intermediate messages; the initial receiver identifier corresponding to the intermediate messages is replaced with the target receiver identifier to obtain reassembled messages.

[0172] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0173] Verify whether the reassembled message is complete; if the reassembled message is complete, fragment the reassembled message according to the initial length of each initial fragment message contained in the reassembled message.

[0174] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0175] Obtain the original fragmented packets sent by the sender; remove the Internet Protocol header, User Datagram Protocol header, and Virtual Extended LAN header from the original fragmented packets to obtain the initial fragmented packets and the packet information of each initial fragmented packet.

[0176] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:

[0177] Obtain each initial fragment message and its message information; the message information includes the initial length of the initial fragment message, the message identifier, and the initial receiver identifier.

[0178] Based on the message identifier corresponding to each initial fragment message, the initial fragment messages are reassembled to obtain a reassembled message; wherein, the reassembled message includes the target receiver identifier;

[0179] Based on the initial length of each initial fragment contained in the reassembled message, the reassembled message is fragmented to obtain each target fragment message;

[0180] Each target fragment message is sent to the target receiver identified by the target receiver.

[0181] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0182] Determine the maximum length among the initial lengths of the initial fragments contained in the reassembled message; fragment the reassembled message according to the maximum length to obtain each target fragment message; wherein the message length of the last target fragment message is less than or equal to the maximum length.

[0183] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0184] The length of each initial fragment contained in the reassembled message is used as the length of each target fragment; the reassembled message is fragmented according to the length of each target fragment to obtain each target fragment message.

[0185] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0186] Based on the message identifier corresponding to each initial fragment message, the initial fragment messages are reassembled to obtain intermediate messages; the initial receiver identifier corresponding to the intermediate messages is replaced with the target receiver identifier to obtain reassembled messages.

[0187] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0188] Verify whether the reassembled message is complete; if the reassembled message is complete, fragment the reassembled message according to the initial length of each initial fragment message contained in the reassembled message.

[0189] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0190] Obtain the original fragmented packets sent by the sender; remove the Internet Protocol header, User Datagram Protocol header, and Virtual Extended LAN header from the original fragmented packets to obtain the initial fragmented packets and the packet information of each initial fragmented packet.

[0191] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0192] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0193] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0194] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A data forwarding method, characterized in that, The method includes: Obtain each initial fragment packet and its packet information; wherein, the packet information includes the initial length, packet identifier, and initial receiver identifier of the initial fragment packet; the packet identifier is used to identify the original data packet to which the initial fragment packet belongs; Based on the message identifier corresponding to each initial fragment message, the initial fragment messages are reassembled to obtain a reassembled message; wherein, the reassembled message includes the target receiver identifier; Based on the initial length of each initial fragment packet contained in the reassembled packet, the reassembled packet is fragmented to obtain each target fragment packet; Each target fragment message is sent to the target receiver corresponding to the target receiver identifier.

2. The method according to claim 1, characterized in that, The step of fragmenting the reassembled message according to the initial length of each initial fragment message contained in the reassembled message to obtain each target fragment message includes: Determine the maximum length among the initial lengths of the initial fragments contained in the reassembled message; The reassembled message is fragmented according to the maximum length to obtain target fragment messages; wherein the message length of the last target fragment message is less than or equal to the maximum length.

3. The method according to claim 1, characterized in that, The step of fragmenting the reassembled message according to the initial length of each initial fragment message contained in the reassembled message to obtain each target fragment message includes: The message length of each initial fragment message contained in the reconstructed message is taken as the message length of each target fragment message; The reassembled message is fragmented according to the message length of each target fragment message to obtain each target fragment message.

4. The method according to claim 1, characterized in that, The step of reassembling each initial fragment packet according to the packet identifier corresponding to each initial fragment packet to obtain a reassembled packet includes: Based on the message identifier corresponding to each initial fragment message, the initial fragment messages are reassembled to obtain intermediate messages; Replace the initial receiver identifier corresponding to the intermediate message with the target receiver identifier to obtain the reassembled message.

5. The method according to claim 1, characterized in that, The step of fragmenting the reassembled message according to the initial length of each initial fragment message contained in the reassembled message to obtain each target fragment message includes: Verify that the reassembled message is complete; If the reassembled message is complete, the reassembled message is fragmented according to the initial length of each initial fragment message contained in the reassembled message.

6. The method according to claim 1, characterized in that, The acquisition of each initial fragment packet and the packet information of each initial fragment packet include: Obtain each original fragment of the packet sent by the sender; The Internet Protocol header, User Datagram Protocol header, and Virtual Extended LAN header are removed from each original fragmented message to obtain each initial fragmented message and its message information.

7. A data forwarding device, characterized in that, The device includes: The acquisition module is used to acquire each initial fragment packet and the packet information of each initial fragment packet; wherein, the packet information includes the initial length, packet identifier, and initial receiver identifier of the initial fragment packet; the packet identifier is used to identify the original data packet to which the initial fragment packet belongs; The reassembly module is used to reassemble each initial fragment packet according to the packet identifier corresponding to each initial fragment packet to obtain a reassembled packet; wherein, the reassembled packet includes a target receiver identifier; The fragmentation module is used to fragment the reassembled message according to the initial length of each initial fragment message contained in the reassembled message, so as to obtain each target fragment message. The sending module is used to send each target fragment message to the target receiver corresponding to the target receiver identifier.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Data message processing method and device

    CN110581812A

  • Message processing method and device, equipment, storage medium and vehicle

    CN118945161A