A multipath TCP gateway and data forwarding method
By implementing the multipath TCP protocol in the user state of the gateway operating system and utilizing raw sockets and tunnel application modules without modifying the kernel state, the problem of kernel upgrade for embedded devices is solved, low-cost data forwarding of the multipath TCP protocol is achieved, and network bandwidth and stability are improved.
Patent Information
- Application Number
- CN202211579776.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-06
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2042-12-06
AI Technical Summary
Existing multi-NIC aggregation technology requires kernel upgrades to support the multipath TCP protocol, which makes it difficult for embedded devices, especially devices with older kernel versions that cannot be directly upgraded.
By implementing the multipath TCP protocol in the user state of the gateway operating system, data forwarding is achieved by using the original socket and tunnel application modules without modifying the kernel state, including a virtual network card and a multipath TCP protocol stack. It is suitable for data forwarding between networks that do not support the multipath TCP protocol and networks that support the multipath TCP protocol.
Without changing the core state, the multipath TCP protocol is implemented, which reduces costs and improves network bandwidth and stability, and is suitable for embedded systems.
Smart Images

Figure CN115866097B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network communication technology, and in particular to a multipath TCP gateway and a data forwarding method. Background Art
[0002] With the increase in in-vehicle mobility, some scenarios require higher uplink bandwidth and support high-definition video transmission, while also placing high demands on wireless network stability. However, both single-carrier 4G networks and the newly launched 5G networks struggle to ensure stable and disconnected networks. This is why multi-NIC aggregation technology has emerged. This technology intelligently aggregates multiple 4G or 5G network cards to combine network bandwidth and switch to another card when the signal on one card is weak.
[0003] Multi-NIC aggregation combines multiple small-capacity network channels to form a large-capacity channel. Data is first unpacked and then repacked, and the intermediate transmission is achieved through multiple different links. Large data is transmitted to the cloud at high speed, stably, and securely (soft deployment), which can achieve high security, large bandwidth, and uninterrupted business.
[0004] The Multipath TCP protocol (MPTCP) was developed by the Internet Engineering Task Force (IETF) MultiPath TCP Working Group. Its purpose is to allow Transmission Control Protocol (TCP) connections to use multiple paths to maximize channel resource utilization. Existing implementations of multi-NIC aggregation are mostly based on software-based Multipath TCP.
[0005] The existing virtual tunnel method of mptcp is a multipath tunnel gateway based on the combination of the kernel's multipath TCP function and tunnel application. The multipath TCP protocol is implemented in the kernel.
[0006] Because existing solutions rely on kernel support for the latest Multipath TCP protocol, if an embedded device uses an older kernel version, a kernel upgrade is required to support the Multipath Tunnel Gateway. This can be very difficult for some custom-built kernels. Summary of the Invention
[0007] In light of this, embodiments of the present invention provide a multipath TCP gateway and data forwarding method. The technical solution includes: receiving IP packets from networks on both sides of the gateway via raw sockets in the gateway operating system's kernel state; and generating or parsing multipath TCP based on the IP packets via a tunnel application module in the gateway operating system's user state, thereby enabling data forwarding between networks that do not support the multipath TCP protocol and networks that do. The technical solution of embodiments of the present invention implements the multipath TCP protocol in the gateway operating system's user state, eliminating the need for kernel state modifications on gateways that do not support the protocol, enabling low-cost multipath TCP implementation.
[0008] In the first aspect, an embodiment of the present invention provides a multipath TCP gateway to realize data forwarding between a first network and a second network, wherein the first network does not support the multipath TCP protocol, and the second network supports the multipath TCP protocol, including: a raw socket and a tunnel application module, wherein the raw socket is in the kernel state of the gateway operating system, and the tunnel application module is in the user state of the gateway operating system; the raw socket is used to exchange IP packets with the first network or the second network; the tunnel application module is used to generate a plurality of first multipath TCP packets based on at least one first IP packet, and to generate a corresponding plurality of second IP packets accordingly, so as to be sent by the raw socket through multiple paths of the second network, wherein the first IP packet is an IP packet received from the first network; the tunnel application module is also used to generate a plurality of fourth IP packets based on at least one second multipath TCP packet, so as to be sent by the raw socket to the first network, wherein the second multipath TCP packet is obtained based on the third IP packet, and the third IP packet is an IP packet received from the multiple paths.
[0009] As described above, the technical solution of the embodiment of the present invention implements the multipath TCP protocol in the user state of the gateway operating system, thereby implementing multipath TCP at a low cost without modifying the kernel state of a gateway that does not support the multipath TCP protocol.
[0010] In a possible implementation of the first aspect, a virtual network card is further included, which is used in user state to receive a first IP packet from the original socket and forward it to the tunnel application module, and is also used to receive a fourth IP packet from the tunnel application module and forward it to the original socket.
[0011] As described above, multiple users in the first network interact with the second network through the virtual network card agent.
[0012] In a possible implementation of the first aspect, the tunnel application module includes a multipath TCP protocol stack; when the tunnel application module generates several first multipath TCP packets based on at least one first IP packet, the module is specifically used to convert the source IP address in the first IP packet into the IP address of the virtual network card, generate a fifth IP packet, and use the fifth IP packet as the first application data to generate the first multipath TCP packet through the multipath TCP protocol stack; when the tunnel application module generates several fourth IP packets based on at least one second multipath TCP packet, the module is specifically used to obtain second application data based on the bearer data of the second multipath TCP packet through the multipath TCP protocol stack, and convert the target IP address in the second application data into the corresponding destination IP address in the first network.
[0013] As described above, the generation and parsing of multipath TCP packets are realized by the multipath TCP protocol stack in user mode, thereby realizing the multipath TCP protocol.
[0014] In a possible implementation of the first aspect, a virtual console is further included, which is used in kernel state for IP packet forwarding between the virtual network card and the original socket. In some embodiments, the virtual console is implemented by a TTY of a Linux system.
[0015] From the above, data exchange between user state and kernel state is achieved through the virtual console.
[0016] In a possible implementation manner of the first aspect, the tunnel application module is further configured to establish a multipath TCP connection with a multipath TCP gateway at the second network peer.
[0017] From the above, the transmission of multipath TCP packets is achieved by establishing multipath TCP connections.
[0018] In a possible implementation manner of the first aspect, the multipath TCP protocol stack is implemented by modifying the LwIP TCP protocol into a multipath TCP protocol.
[0019] From the above, the multipath TCP protocol is implemented through the transformation of LwIP, which occupies less computing resources and is suitable for embedded systems.
[0020] In the second aspect, an embodiment of the present invention provides a data forwarding method, which, when implementing data forwarding from a first network to a second network on the gateway described in any implementation mode of the first aspect, includes: the original socket receives a first IP packet from the first network; the tunnel application module generates several first multipath TCP packets based on at least one first IP packet, and generates several corresponding second IP packets accordingly; the original socket sends the second IP packet to the second network through multiple paths.
[0021] From the above, the technical solution of the embodiment of the present invention implements the multipath TCP protocol in the user state of the gateway operating system, and forwards data from the non-multipath TCP network to the multipath TCP network, thereby realizing multipath TCP at a low cost without modifying the kernel state on the gateway that does not support the multipath TCP protocol in the kernel state.
[0022] In a possible implementation of the second aspect, when data forwarding from the second network to the first network is implemented on the gateway described in any implementation of the first aspect, it also includes: the original socket receives a third IP packet from the second network; the tunnel application module obtains a second multipath TCP packet based on the third IP packet, and generates several fourth IP packets based on at least one second multipath TCP packet; the original socket sends the fourth IP packet to the first network.
[0023] From the above, the technical solution of the embodiment of the present invention implements the multipath TCP protocol in the user state of the gateway operating system, and the multipath TCP network forwards data to the non-multipath TCP network, so that the multipath TCP can be implemented at a low cost without modifying the kernel state on the gateway that does not support the multipath TCP protocol in the kernel state.
[0024] In a possible implementation of the second aspect, when the gateway includes a virtual gateway, implementing data forwarding from the first network to the second network also includes: the virtual gateway receives a first IP packet from the original socket and forwards it to the tunnel application module; implementing data forwarding from the second network to the first network also includes: the virtual gateway receives a fourth IP packet and forwards it to the original socket.
[0025] As described above, multiple users in the first network interact with the second network through the virtual network card agent.
[0026] In a possible implementation of the second aspect, the generating of several first multipath TCP packets based on at least one first IP packet specifically includes: the tunnel application module converting the source user IP address in the first IP packet into the IP address of the virtual network card to generate a fifth IP packet, and using the fifth IP packet as the first application data through the multipath TCP protocol stack to generate the first multipath TCP packet; the generating of several fourth IP packets based on at least one second multipath TCP packet specifically includes: the tunnel application module obtaining a second application data packet based on the bearer data of the second multipath TCP packet, and converting the target IP address in the second application data into the corresponding destination IP address in the first network.
[0027] As described above, the generation and parsing of multipath TCP packets are realized by the multipath TCP protocol stack in user mode, thereby realizing the multipath TCP protocol.
[0028] In a possible implementation of the second aspect, the method further includes: forwarding IP packets between the virtual network card and the original socket via a virtual console. In some embodiments, the virtual console is implemented via a TTY in a Linux system.
[0029] From the above, data exchange between user state and kernel state is achieved through the virtual console.
[0030] In a possible implementation of the second aspect, the further step includes: the tunnel application module establishing a multipath TCP connection with the multipath TCP gateway of the second network peer.
[0031] From the above, the transmission of multipath TCP packets is achieved by establishing multipath TCP connections.
[0032] In a possible implementation of the second aspect, the multipath TCP protocol stack is implemented by modifying the LwIP TCP protocol into a multipath TCP protocol.
[0033] From the above, the multipath TCP protocol is implemented through the transformation of LwIP, which occupies less computing resources and is suitable for embedded systems.
[0034] In a third aspect, an embodiment of the present invention provides a computing device, comprising: a bus; a communication interface connected to the bus; at least one processor connected to the bus; and at least one memory connected to the bus and storing program instructions, wherein when the program instructions are executed by the at least one processor, the at least one processor executes any implementation described in the first aspect of the present invention.
[0035] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having program instructions stored thereon, wherein the program instructions, when executed by a computer, enable the computer to execute any of the implementations described in the first aspect of the application. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 It is a structural diagram of the application scenarios of various embodiments of the present invention;
[0037] Figure 2 This is a schematic structural diagram of a multipath TCP gateway embodiment 1 of the present invention;
[0038] Figure 3 This is a schematic diagram of the structure of a second embodiment of a multipath TCP gateway of the present invention;
[0039] Figure 4A A schematic diagram of a process of forwarding and converting data packets in forwarding data from a first network to a second network in a second embodiment of a multipath TCP gateway of the present invention;
[0040] Figure 4B A schematic diagram of a process of forwarding and converting data packets in forwarding data from a second network to a first network in a second embodiment of a multipath TCP gateway of the present invention;
[0041] Figure 5A This is a schematic diagram of a process for forwarding data from a first network to a second network in a first embodiment of a data forwarding method of the present invention;
[0042] Figure 5B This is a schematic diagram of a process for forwarding data from a second network to a first network in a first embodiment of a data forwarding method of the present invention;
[0043] Figure 6A This is a schematic diagram of a process for forwarding data from a first network to a second network in a second embodiment of a data forwarding method of the present invention;
[0044] Figure 6B This is a schematic diagram of a process for forwarding data from a second network to a first network in a second embodiment of a data forwarding method of the present invention;
[0045] Figure 6CA schematic diagram of a process for establishing a multipath TCP connection in a second embodiment of a data forwarding method of the present invention;
[0046] Figure 7 Schematic diagram of the structure of the computing device according to various embodiments of the present invention. DETAILED DESCRIPTION
[0047] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0048] In the following description, the terms "first\second\third, etc." or module A, module B, module C, etc. are only used to distinguish similar objects, or to distinguish different embodiments, and do not represent a specific ordering of the objects. It can be understood that the specific order or sequence can be interchanged where permitted, so that the embodiments of the present invention described herein can be implemented in an order other than that illustrated or described herein.
[0049] In the following description, the numbers representing the steps, such as S110, S120, etc., do not necessarily mean that the steps must be executed in this manner. If permitted, the order of the steps can be interchanged or they can be executed simultaneously.
[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present invention pertains. The terms used herein are for the purpose of describing embodiments of the present invention only and are not intended to limit the present invention.
[0051] Embodiments of the present invention provide a multipath TCP gateway and data forwarding method. The technical solution includes: receiving IP packets from networks on both sides of the gateway via raw sockets in the gateway operating system's kernel state; and generating or parsing multipath TCP based on the IP packets via a tunnel application module in the gateway operating system's user state, thereby enabling data forwarding between networks that do not support the multipath TCP protocol and networks that do. The technical solution of the embodiments of the present invention implements the multipath TCP protocol in the gateway operating system's user state, eliminating the need for kernel state modifications on gateways that do not support the protocol, enabling low-cost multipath TCP implementation.
[0052] The following describes various embodiments of the present invention in conjunction with the accompanying drawings. First, the application scenarios of various embodiments of the present invention are described.
[0053] Figure 1The structure of the application scenario of each embodiment of the present invention is shown, including a user 10, a network 20, a gateway 30, a network 40, a gateway 50, a network 60 and a server 70. The user 10 accesses the server 70 through the network.
[0054] Network 20 and network 60 are wired networks, support the TCP protocol, do not support the multipath TCP protocol, and have higher network capacity and quality.
[0055] Network 40 consists of multiple wireless networks, each with limited capacity and / or quality. To improve access capacity and quality, multipath TCP transmission is implemented on network 40 via gateways 30 and 50. Gateways 30 and 50 are multipath TCP gateways, enabling data forwarding between TCP and multipath TCP protocols.
[0056] The following combination Figure 2 A multipath TCP gateway embodiment 1 of the present invention is introduced.
[0057] A multipath TCP gateway embodiment 1 is used for data forwarding between a first network that does not support the multipath TCP protocol and a second network that does. A raw socket in the kernel state of the gateway operating system receives IP packets from the first network or the second network. A tunnel application module in the user state of the gateway operating system generates a plurality of first multipath TCP packets based on at least one first IP packet, and accordingly generates a plurality of corresponding second IP packets, which are sent by the raw socket to the second network via multiple paths. The first IP packets are IP packets received from the first network. The tunnel application module also generates a plurality of fourth IP packets based on at least one second multipath TCP packet, which are sent by the raw socket to the first network. The second multipath TCP packets are obtained based on third IP packets received from the second network via the multiple paths. The technical solution of this embodiment implements the multipath TCP protocol in the user state of the gateway operating system, thereby eliminating the need to modify the kernel state on gateways that do not support the multipath TCP protocol in the kernel state and enabling low-cost multipath TCP implementation in the user state.
[0058] Figure 2 The structure of a first embodiment of a multipath TCP gateway is shown. The gateway 100 includes a raw socket 110 and a tunnel application module 120. Raw socket 110 is located in the kernel state of the gateway 100 operating system, while tunnel application module 120 is located in the user state of the gateway 100 operating system. By way of example, the gateway operating system is a Linux distribution.
[0059] The original socket 110 is used to receive all IP packets sent to this gateway, including IP headers and TCP / UDP / ICMP headers.
[0060] Among them, the IP packet received by the original socket 110 from the first network is the first IP packet, the IP packet sent to the second network is the second IP packet, the IP packet received from the second network is the third IP packet, and the IP packet sent to the first network is the fourth IP packet.
[0061] In contrast, application-layer sockets send and receive data at the application layer. Each program can only receive data sent to it, meaning it can only receive data from the port to which it is bound. The received data often only includes application-layer data, which is a portion of an IP packet, and cannot include all data sent or received by the local machine. Raw sockets 110, on the other hand, can receive all IP packets sent to gateway 100, allowing tunnel application module 120 to modify the IP header and add a multipath TCP header to the complete IP packet.
[0062] When forwarding data from the first network to the second network, the tunnel application module 120 generates a plurality of first multipath TCP packets based on at least one first IP packet, and generates a plurality of corresponding second IP packets accordingly, which are then sent by the raw socket 110 to the second network via multiple paths. The multiple paths include at least one network from multiple wireless networks such as various 4G / various 5G / various WIFI networks.
[0063] In some embodiments, tunnel application module 120 treats the first IP packet as gateway application layer data and, based on the multipath TCP protocol, sub-packets the application layer data into multiple first multipath TCP packets. Each first multipath TCP packet corresponds to a path in the second network. Each first multipath TCP packet is appended with the IP packet header for the corresponding path and then sent along the corresponding path, thereby enabling transmission across multiple paths and improving communication capacity and quality.
[0064] In other embodiments, the tunnel application module 120 also replaces the source IP address in the first IP packet with an IP address related to the gateway 100, and then uses it as the application layer data of the gateway to perform multipath TCP protocol related processing, so that the gateway 100 can access multiple users.
[0065] When forwarding data from the second network to the first network, the tunnel application module 120 obtains at least one second multipath TCP packet based on the multiple third IP packets, and generates several fourth IP packets based on the bearer data of the at least one second multipath TCP packet, so as to be sent to the first network by the original socket 110.
[0066] The second multipath TCP packet is generated by the gateway 100 in the multipath TCP gateway at the second network peer end, and its carrying data is the IP packet data of the TCP packet of the first network received by the gateway 100 through the original socket of the multipath TCP gateway at the second network peer end.
[0067] For example, if the gateway 100 is Figure 1 In gateway 30, the multipath TCP packet is Figure 1 If the gateway 100 is Figure 1 In gateway 50, the multipath TCP packet is in Figure 1 Generated in the gateway 30.
[0068] In some embodiments, the raw socket 100 is sent to the first network according to the destination IP address in the application layer data of the gateway 100 obtained from the payload data of the second multipath TCP packet.
[0069] In other embodiments, the destination IP address in the application layer data of the gateway 100 obtained from the bearer data of the second multipath TCP packet is the relevant address of the gateway 100, which is converted into the IP address of the user or server according to the NAT protocol and then sent through the first network.
[0070] In summary, IP packets are received from networks on both sides of the gateway via raw sockets in the gateway operating system's kernel state. A tunnel application module in the gateway operating system's user state generates or parses Multipath TCP based on these IP packets, thereby enabling data forwarding between networks that do not support Multipath TCP and those that do. The technical solution of this embodiment of the present invention implements Multipath TCP in the user state of the gateway operating system, eliminating the need to modify the kernel state on gateways that don't support Multipath TCP, allowing for low-cost Multipath TCP implementation.
[0071] The following combination Figures 3 to 4B A second embodiment of a multipath TCP gateway according to the present invention is introduced.
[0072] A second embodiment of a multipath TCP gateway inherits the structure of the first embodiment of a multipath TCP gateway and has all the advantages of the first embodiment of a multipath TCP gateway. At the same time, a multipath TCP protocol stack is implemented through LwIP in the tunnel application module, which is easy to implement, occupies few resources, and is suitable for use in embedded systems. A virtual network card is added and a NAT protocol stack is set in the tunnel application module. Communication with a second network is carried out according to the virtual IP address of the virtual network card, so that one gateway supports multipath TCP forwarding for multiple users.
[0073] Figure 3 The structure of a second embodiment of a multipath TCP gateway is shown. The gateway 200 includes: a raw socket 210, a virtual console 220, a tunnel application module 230 and a virtual network card 240. The tunnel application module 230 is provided with a NAT protocol stack 232, a multipath TCP protocol stack 234 and a multipath address module 236. The multipath TCP protocol stack 234 is implemented by replacing the multipath TCP protocol with the TCP protocol in the LwIP protocol stack.
[0074] The original socket 210 and the virtual console 220 are in the kernel state of the operating system of the gateway 200 , and the tunnel application module 230 and the virtual network card 240 are in the user state of the operating system of the gateway 200 .
[0075] For example, the operating system of the gateway 200 is a Linux system, the raw socket and the virtual console are also referred to as RawSocket and TTY, and the virtual network card is also referred to as Tap0.
[0076] The functions of each module of the gateway 200 are described in detail below. For the sake of convenience, the gateway 200 is used to implement data forwarding between the first network and the second network as an example. The first network is a normal TCP network that does not support multipath TCP, and the second network is a multipath TCP network.
[0077] Figure 4A The process of forwarding and converting data packets in forwarding data from the first network to the second network is shown below. Figure 4A The functions of various modules of the gateway 200 in forwarding data from the first network to the second network are described.
[0078] 1) The raw socket 210 is used to receive a first IP packet from a first network.
[0079] The original socket 210 receives a complete IP packet, wherein the first IP packet includes a user IP packet header, a user TCP packet header, a payload, and user data.
[0080] The structure of the first IP is as follows. The IP addresses in the user IP header are the IP addresses of the user and the server. This can be the IP header for sending data from the user to the server, or the IP header for sending data from the server to the user. The user TCP header is also the end-to-end TCP header between the user and the server, and the payload is the transmitted data.
[0081]
[0082] 2) The virtual console 220 is used to forward the first IP packet from the original socket 210 to the virtual network card 240 .
[0083] The virtual console 220 enables the virtual network card 240 to initiate data transmission to the original socket 210 and associates the original socket 210 with the virtual network card 240 .
[0084] 3) The virtual network card 240 is configured to receive the first IP packet from the original socket 210 through the virtual console 220 and forward the first IP packet to the tunnel application module 230 .
[0085] The flow of the first IP packet between the original socket 210 and the tunnel application module 230 is achieved through the virtual console 220 and the virtual network card 240 .
[0086] 4) The NAT protocol stack 232 is used to convert the source user IP address in the first IP packet into the IP address of the virtual network card 240 to generate a fifth IP packet.
[0087] The gateway 200 supports multiple user accesses through the NAT protocol stack.
[0088] Among them, the structure of the fifth IP packet is as follows: the source IP address in the virtual network card IP packet header is the virtual network card IP, and the other contents are obtained by NAT protocol conversion.
[0089]
[0090] 5) Multipath TCP protocol stack 234 is configured to treat the fifth IP packet as first application data and generate first multipath TCP packets accordingly. Each first multipath TCP packet corresponds to a path in the second network, and each first multipath TCP packet is sent over multiple paths, thereby improving the transmission capacity and quality of each user data in the second network.
[0091] Among them, the first multipath TCP packet structure is as follows.
[0092]
[0093] 6) The multipath address module 236 is used to add an IP header of the corresponding path to each first multipath TCP packet, generate a second IP packet, and forward it to the original socket 210.
[0094] At this point, the structure of the second IP is as follows: The source address and destination address of the IP packet header are the IP addresses at both ends of the corresponding path in the second network.
[0095]
[0096] 7) The original socket 210 is further used to send the corresponding second IP packet to the corresponding path of the second network through multiple paths.
[0097] Each second IP packet is sent through multiple paths, thereby improving the transmission capacity and quality of each user data in the second network.
[0098] The tunnel application module is further configured to establish a multipath TCP connection with a multipath TCP gateway at the second network peer.
[0099] Figure 4B The process of forwarding and converting data packets in forwarding data from the second network to the first network is shown below. Figure 4BThe functions of various modules of the gateway 200 in forwarding data from the second network to the first network are described.
[0100] 1) The original socket 210 is used to receive each third IP packet from multiple paths of the second network and forward it to the tunnel application module 230.
[0101] The third IP packet is an IP packet generated by the gateway 200 at the other end of the second network, which is equivalent to the second IP packet generated by the gateway 200.
[0102] 2) The multipath address module 236 is used to remove the IP header of the corresponding path from each third multipath IP packet to obtain the second multipath TCP packet of each path.
[0103] The second multipath TCP packet is a multipath TCP packet generated by the gateway 200 at the opposite end of the second network, which is equivalent to the first multipath TCP packet generated by the gateway 200.
[0104] 3) The multipath TCP protocol stack 234 is used to deduplicate and combine the second multipath TCP packets to obtain the second application data of the gateway 200.
[0105] Among them, the second multipath TCP packet is generated by gateway 200 in the multipath TCP gateway at the second network end. The data it carries is the second application data of gateway 200, which is also an IP packet, called the sixth IP packet. The sixth IP packet is the IP packet whose IP header is transformed by the NAT protocol station of the multipath TCP gateway of gateway 200 at the second network end. It is equivalent to the fifth IP packet generated by gateway 200. The destination address of its IP header is the IP address of the virtual network card 240 of this gateway 200, which is obtained through the multipath TCP connection handshake protocol.
[0106] For example, if the gateway 200 is Figure 1 In the gateway 30, the second multipath TCP packet is Figure 1 The gateway 50 is generated and the gateway 30 is parsed; if the gateway 200 is Figure 1 In gateway 50, the second multipath TCP packet is Figure 1 is generated in gateway 30 and parsed in gateway 50.
[0107] 4) The NAT protocol stack 232 is used to convert the target IP address of the sixth IP packet into a corresponding destination IP address in the first network to obtain a fourth IP packet.
[0108] If the gateway 200 is Figure 1 If the gateway 30 is Figure 1 In the gateway 50 , the corresponding destination IP address in the first network is the IP address of the server 70 .
[0109] 5) The virtual network card 240 is used to receive the fourth IP packet from the tunnel application module 230.
[0110] 6) The virtual console 220 is used to forward the fourth IP packet from the virtual network card 240 to the original socket 210 .
[0111] 7) The original socket 210 is further used to send a fourth IP packet to the first network.
[0112] It is important to emphasize that, whether forwarding data from the first network to the second network or from the second network to the first network, gateway 200 must establish a multipath TCP connection with its peer on the second network. This connection establishment request can be initiated by either end. The initiating end is the multipath TCP client, not the actual user terminal receiving the service. The responding end is the multipath TCP server, also not the actual server providing the service.
[0113] In summary, a second embodiment of a multipath TCP gateway inherits the structure of a first embodiment of a multipath TCP gateway and has all the advantages of the first embodiment of a multipath TCP gateway. At the same time, a multipath TCP protocol stack is implemented through LwIP in the tunnel application module, which is easy to implement, occupies few resources, and is suitable for use in embedded systems. A virtual network card is added and a NAT protocol stack is set in the tunnel application module, and communication with the second network is carried out according to the virtual IP address of the virtual network card, so that one gateway supports multipath TCP forwarding for multiple users.
[0114] The following combination Figures 5A to 6C An embodiment of a data forwarding method of the present invention is introduced.
[0115] A data forwarding method embodiment 1 is run in a multipath TCP gateway embodiment 1 to implement data forwarding between a first network that does not support the multipath TCP protocol and a second network that supports the multipath TCP protocol. It has all the advantages of a multipath TCP gateway embodiment 1.
[0116] A data forwarding method embodiment 1 includes two processes: a process of forwarding data from a first network to a second network and a process of forwarding data from the second network to the first network.
[0117] Figure 5A The process of forwarding data from the first network to the second network is shown, which includes steps S5110 to S5130.
[0118] S5110: The raw socket 110 receives a first IP packet from the first network.
[0119] S5120: The tunnel application module 120 generates a plurality of first multipath TCP packets according to the at least one first IP packet, and generates a corresponding plurality of second IP packets according to the plurality of first multipath TCP packets.
[0120] S5130: The raw socket 110 sends the second IP packets to the second network through a plurality of paths.
[0121] Figure 5B A flow of forwarding data from the second network to the first network is shown, which includes steps S5210 to S5230
[0122] S5210: The raw socket 110 receives third IP packets from the second network.
[0123] S5220: The tunnel application module 120 obtains second multipath TCP packets according to the third IP packets, and generates a plurality of fourth IP packets according to the at least one second multipath TCP packet.
[0124] S5230: The raw socket 110 sends the fourth IP packets to the first network.
[0125] The second embodiment of the data forwarding method is operated in the second embodiment of the multipath TCP gateway, and realizes the data forwarding between the first network which does not support the multipath TCP protocol and the second network which supports the multipath TCP protocol, and has all the advantages of the second embodiment of the multipath TCP gateway.
[0126] The second embodiment of the data forwarding method includes three flows: a flow of forwarding data from the first network to the second network, a flow of forwarding data from the second network to the first network, and a flow of establishing a multipath TCP connection.
[0127] Figure 6A A flow of forwarding data from the first network to the second network is shown, which includes steps S6110 to S6170. Among them,
[0128] S6110: The raw socket 210 receives first IP packets from the first network.
[0129] S6120: The virtual console 220 forwards the first IP packets from the raw socket 210 to the virtual network card 240.
[0130] S6130: The virtual network card 240 receives the first IP packets from the raw socket 210 through the virtual console 220, and forwards them to the tunnel application module 230.
[0131] S6140: The NAT protocol stack 232 converts the source user IP address in the first IP packets into the IP address of the virtual network card 240 to generate fifth IP packets.
[0132] S6150: Multipath TCP protocol stack 234 uses the fifth IP packet as the first application data and generates a first multipath TCP packet accordingly. Each first multipath TCP packet corresponds to a path in the second network. Each first multipath TCP packet is sent via multiple paths, thereby improving the transmission capacity and quality of each user data in the second network.
[0133] S6160 : The multipath address module 236 adds an IP header of the corresponding path to each first multipath TCP packet, generates a second IP packet, and forwards it to the original socket 210 .
[0134] S6170: The raw socket 210 sends the corresponding second IP packet to the corresponding path of the second network through multiple paths.
[0135] Figure 6B The process of forwarding data from the second network to the first network is shown, including steps S6210 to S6270.
[0136] S6210 : The raw socket 210 receives each third IP packet from multiple paths of the second network and forwards it to the tunnel application module 230 .
[0137] The third IP packet is an IP packet generated by the gateway 200 at the other end of the second network, which is equivalent to the second IP packet generated by the gateway 200.
[0138] S6220: The multipath address module 236 removes the IP header of the corresponding path from each third multipath IP packet to obtain the second multipath TCP packet of each path.
[0139] The second multipath TCP packet is a multipath TCP packet generated by the gateway 200 at the opposite end of the second network, which is equivalent to the first multipath TCP packet generated by the gateway 200.
[0140] S6230: The multipath TCP protocol stack 234 deduplicates and combines the second multipath TCP packets to obtain the second application data of the gateway 200.
[0141] Among them, the second multipath TCP packet is generated by gateway 200 in the multipath TCP gateway at the second network end, and its carrying data is the TCP packet received by the original socket of the multipath TCP gateway of gateway 200 at the second network end plus the gateway IP header added by the NAT protocol of the other end. The destination address of the IP header is the IP address of the virtual network card 240 of gateway 200.
[0142] For example, if the gateway 100 is Figure 1 In gateway 30, the multipath TCP packet is Figure 1 If the gateway 100 is Figure 1 In gateway 50, the multipath TCP packet is in Figure 1 Generated in the gateway 30.
[0143] S6240: The NAT protocol stack 232 converts the target IP address in the second application data into a corresponding destination IP address in the first network to obtain a fourth IP packet.
[0144] S6250: The virtual network card 240 receives the fourth IP packet from the tunnel application module 230.
[0145] S6260 : The virtual console 220 forwards the fourth IP packet from the virtual network card 240 to the raw socket 210 .
[0146] S6270: The raw socket 210 sends a fourth IP packet to the first network.
[0147] Figure 6C The multipath TCP connection establishment process is shown, including steps S6310 to S6350.
[0148] A multipath TCP connection is established on a gateway described in a second embodiment of a multipath TCP gateway. Each gateway can be configured as a multipath TCP client or server. The gateway initiating the connection is a multipath TCP client. For ease of description, the first gateway is configured as a multipath TCP and the second gateway is configured as a multipath TCP server.
[0149] S6310: Configure the virtual IP address of the virtual network card TAP in the first gateway.
[0150] For the convenience of description, the address is 10.0.1.2 as an example.
[0151] S6320: Start the tunnel application module, raw socket, and virtual console in the first gateway, configure the gateway as a multipath TCP client mptcp-client, and set its corresponding multipath TCP server name to mptcp-server.
[0152] S6330: Configure the virtual IP address of the virtual network card TAP in the second gateway.
[0153] For the convenience of description, the address is 10.0.1.3 as an example.
[0154] S6340: Start the tunnel application module, raw socket, and virtual console in the second gateway, and configure this gateway as a multipath TCP server mptcp-server, waiting for the connection of the multipath TCP client mptcp-client.
[0155] S6350: The multipath TCP client mptcp-client applies to establish a connection with the multipath TCP server mptcp-server. A handshake process is performed between the two parties to establish a multipath TCP connection.
[0156] Among them, after all multipath TCP connections are established, the data sent from the first gateway to 10.0.1.3 through 10.0.1.2 will be encapsulated as a multipath TCP packet in the tunnel application module of the first gateway and sent to the second gateway through multiple paths.
[0157] The embodiment of the present invention further provides a computing device, Figure 7 Detailed introduction.
[0158] The computing device 700 includes a processor 710 , a memory 720 , a communication interface 730 , and a bus 740 .
[0159] It should be understood that the communication interface 730 in the computing device 700 shown in this figure can be used to communicate with other devices.
[0160] The processor 710 may be connected to a memory 720. The memory 720 may be used to store the program code and data. Therefore, the memory 720 may be a storage unit within the processor 710, an external storage unit independent of the processor 710, or a component including both a storage unit within the processor 710 and an external storage unit independent of the processor 710.
[0161] Optionally, computing device 700 may further include a bus 740. Memory 720 and communication interface 730 may be connected to processor 710 via bus 740. Bus 740 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. Bus 740 may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figure shows only one line, but this does not imply that there is only one bus or only one type of bus.
[0162] It should be understood that in the embodiment of the present invention, the processor 710 may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor. Alternatively, the processor 710 may be one or more integrated circuits for executing relevant programs to implement the technical solutions provided in the embodiment of the present invention.
[0163] The memory 720 may include a read-only memory and a random access memory, and provides instructions and data to the processor 710. A portion of the processor 710 may also include a non-volatile random access memory. For example, the processor 710 may also store information about the device type.
[0164] When the computing device 700 is running, the processor 710 executes the computer-executable instructions in the memory 720 to perform the operating steps of each method embodiment.
[0165] It should be understood that the computing device 700 according to an embodiment of the present invention can correspond to the corresponding subjects in the methods according to various embodiments of the present invention, and the above-mentioned and other operations and / or functions of each module in the computing device 700 are respectively for implementing the corresponding processes of each method in the embodiment of the present method. For the sake of brevity, they will not be repeated here.
[0166] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0167] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0168] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0169] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present method.
[0170] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0171] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the decoding method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0172] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which is used to execute the operating steps of each method embodiment when the program is executed by a processor.
[0173] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include, an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0174] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0175] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0176] Computer program code for performing the operations of the present invention may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0177] Note that the above are only preferred embodiments of the present invention and the technical principles employed. Those skilled in the art will appreciate that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments and may include many other equivalent embodiments without departing from the scope of protection of the present invention.
Claims
1. A multipath TCP gateway, characterized in that: Implement data forwarding between a first network and a second network, where the first network does not support the multipath TCP protocol, but the second network supports the multipath TCP protocol, including: a raw socket, a tunnel application module, and a virtual network card, wherein the raw socket is in the kernel state of the gateway operating system, the virtual network card and the tunnel application module are in the user state of the gateway operating system, and the tunnel application module includes a multipath TCP protocol stack; The raw socket is used to exchange IP packets with the first network or the second network; The virtual network card is used to receive the first IP packet from the original socket and forward it to the tunnel application module, and is also used to receive the fourth IP packet from the tunnel application module and forward it to the original socket; The tunnel application module is configured to generate a plurality of first multipath TCP packets based on at least one first IP packet, and to generate a plurality of corresponding second IP packets accordingly, to be sent by the original socket through multiple paths of the second network, wherein the first IP packets are IP packets received from the first network; The tunnel application module is further configured to generate a plurality of fourth IP packets based on at least one second multipath TCP packet, to be sent by the raw socket to the first network, the second multipath TCP packet being obtained based on the third IP packet, the third IP packet being an IP packet received from the plurality of paths; When the tunnel application module generates the plurality of first multipath TCP packets based on at least one first IP packet, the module is specifically configured to convert the source IP address in the first IP packet into the IP address of the virtual network card to generate a fifth IP packet, and use the fifth IP packet as the first application data to generate the first multipath TCP packet through the multipath TCP protocol stack; Among them, when the tunnel application module generates several fourth IP packets based on at least one second multipath TCP packet, it is specifically used to obtain second application data based on the bearer data of the second multipath TCP packet through the multipath TCP protocol stack, and convert the target IP address in the second application data into the corresponding destination IP address in the first network.
2. The gateway according to claim 1, characterized in that It also includes a virtual console, which is in kernel state and is used for IP packet forwarding between virtual network cards and raw sockets.
3. The gateway according to claim 1, characterized in that: The tunnel application module is further configured to establish a multipath TCP connection with a multipath TCP gateway at the second network peer.
4. The gateway according to claim 1, characterized in that The multipath TCP protocol stack is implemented by modifying the LwIP TCP protocol into a multipath TCP protocol.
5. A data forwarding method, characterized in that: When implementing data forwarding from a first network to a second network on the gateway according to any one of claims 1 to 4, the method includes: The raw socket receives a first IP packet from a first network; The tunnel application module generates a plurality of first multipath TCP packets according to at least one first IP packet, and generates a plurality of corresponding second IP packets accordingly; The raw socket sends the second IP packet to the second network through the plurality of paths.
6. The method according to claim 5, characterized in that When data forwarding from the second network to the first network is implemented on the gateway according to any one of claims 1 to 4, the method further comprises: The raw socket receives a third IP packet from the second network; The tunnel application module obtains a second multipath TCP packet according to the third IP packet, and generates a plurality of fourth IP packets according to at least one second multipath TCP packet; The raw socket sends a fourth IP packet to the first network.
7. The method according to claim 6, characterized in that When the gateway includes a virtual gateway, implementing data forwarding between the first network and the second network further includes: the virtual gateway receiving the first IP packet from the original socket and forwarding it to the tunnel application module; Implementing data forwarding from the second network to the first network also includes: the virtual gateway receives the fourth IP packet and forwards it to the original socket.
8. The method according to claim 7, characterized in that: Generating a plurality of first multipath TCP packets according to at least one first IP packet specifically includes: The tunnel application module converts the source user IP address in the first IP packet into the IP address of the virtual network card to generate a fifth IP packet, and uses the fifth IP packet as the first application data through the multipath TCP protocol stack to generate the first multipath TCP packet; Generating a plurality of fourth IP packets according to at least one second multipath TCP packet specifically includes: The tunnel application module obtains the second application data according to the bearer data of the second multipath TCP packet, and converts the target IP address in the second application data into a corresponding destination IP address in the first network.
Citation Information
Patent Citations
System And Method For Virtual Multipath Data Transport
US20180041421A1
Network device and terminal for multi-path communication, operation method thereof, and program implementing operation method
WO2015199340A1