Data Processing Method and Apparatus, Device, and Medium Based on Multiple Wide Area Network Ports
By determining whether the LAN port is bound to the WAN port in the gateway device and dynamically determining the new default WAN port, the problem of data mixed in data forwarding in multi-WAN environment is solved, and business stability and reliability are improved.
Patent Information
- Application Number
- CN202510407690.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2045-04-02
AI Technical Summary
When existing gateway devices forward data in multi-WAN environments, the LAN side devices can only forward data through the default WAN, resulting in data confusion of different services, affecting service stability and reliability.
After receiving the pending data packets on the target LAN port, determine whether the port is bound to the WAN port, if not bound, forward through the default WAN port, if bound, forward through the bound WAN port, and dynamically determine the new default WAN port when the default WAN port is disconnected.
It effectively avoids the confusion of different business data, improves business stability, and improves the reliability of data forwarding by dynamically determining the new default WAN port.
Smart Images

Figure CN119906669B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of network communication technologies, and in particular, to a data processing method, apparatus, device, and medium based on multiple wide area network ports. Background Art
[0002] In recent years, with the popularization of computer network technologies, operators' support for multiple dual-stack services has been increasing, such as PPPoE dial-up Internet access, VR services (IPoE non-session services), IPTV services, etc. However, there are still the following problems in data forwarding of current gateway devices in a multi-WAN (wide area network) environment: LAN (local area network) side devices usually can only forward data through the default WAN, resulting in the mixing of data of different services, affecting service stability and making the reliability relatively low. Summary of the Invention
[0003] In view of this, the purpose of this application is to provide a data processing method, apparatus, device, and medium based on multiple wide area network ports to improve the relatively low reliability of data processing in the prior art.
[0004] To achieve the above purpose, this application adopts the following technical solutions:
[0005] A data processing method based on multiple wide area network ports includes:
[0006] After receiving a data packet to be processed sent by a target terminal device through a target local area network port, determining whether the target local area network port is bound to a wide area network port;
[0007] If the target local area network port is not bound to a wide area network port, forwarding the data packet to be processed through the default wide area network port among multiple wide area network ports;
[0008] If the target local area network port is bound to a wide area network port, forwarding the data packet to be processed through the wide area network port bound to the target local area network port among the multiple wide area network ports.
[0009] In a preferred selection of this application, in the above data processing method based on multiple wide area network ports, before the step of if the target local area network port is not bound to a wide area network port, forwarding the data packet to be processed through the default wide area network port among multiple wide area network ports, the data processing method based on multiple wide area network ports further includes:
[0010] Monitoring the status of the default wide area network port to obtain port status information, where the port status information is used to reflect that the default wide area network port is in a connected state or a disconnected state;
[0011] If the port status information reflects that the default wide area network port is in a disconnected state, then a new default wide area network port is determined from other wide area network ports included in the multiple wide area network ports other than the default wide area network port, so that the data packet to be processed can be forwarded through the new default wide area network port.
[0012] In a preferred option of the present application, in the above data processing method based on multiple wide area network ports, the step of, if the port status information reflects that the default wide area network port is in a disconnected state, then determining a new default wide area network port from other wide area network ports included in the multiple wide area network ports other than the default wide area network port, so that the data packet to be processed can be forwarded through the new default wide area network port, includes:
[0013] If the port status information reflects that the default wide area network port is in a disconnected state, then each wide area network port in a connected state is determined from other wide area network ports included in the multiple wide area network ports other than the default wide area network port, and a plurality of candidate wide area network ports are obtained;
[0014] Based on the service priority and protocol stack status of each candidate wide area network port, one candidate wide area network port is determined from the multiple candidate wide area network ports, and the candidate wide area network port is determined as the new default wide area network port, so that the data packet to be processed can be forwarded through the new default wide area network port.
[0015] In a preferred option of the present application, in the above data processing method based on multiple wide area network ports, the step of, based on the service priority and protocol stack status of each candidate wide area network port, determining one candidate wide area network port from the multiple candidate wide area network ports, and determining the candidate wide area network port as the new default wide area network port, so that the data packet to be processed can be forwarded through the new default wide area network port, includes:
[0016] Based on the service priority of each candidate wide area network port, the multiple candidate wide area network ports are traversed in sequence for the first time to form the candidate wide area network port currently being traversed. Among them, the traversal order is from the candidate wide area network port with a high service priority to the candidate wide area network port with a low service priority, and the service priority corresponding to the Ethernet dial-up Internet access service is higher than the service priority corresponding to the IP-based sessionless service, and the service priority corresponding to the IP-based sessionless service is higher than the service priority corresponding to other services. Other services at least include Internet protocol television services;
[0017] If the currently traversed candidate wide area network port belongs to a dual-stack service and at least one protocol stack is in an available state, then the currently traversed candidate wide area network port is determined as the new default wide area network port, so that the to-be-processed data packet can be forwarded through the new default wide area network port;
[0018] If the currently traversed candidate wide area network port belongs to a dual-stack service and each protocol stack is in an unavailable state, or the currently traversed candidate wide area network port does not belong to a dual-stack service, then traverse the next candidate wide area network port until a new default wide area network port is determined or the last candidate wide area network port is traversed.
[0019] In a preferred selection of the present application, in the above data processing method based on multiple wide area network ports, the step of determining a candidate wide area network port from the multiple candidate wide area network ports based on the service priority and protocol stack status of each candidate wide area network port, and determining the candidate wide area network port as the new default wide area network port, so that the to-be-processed data packet can be forwarded through the new default wide area network port, further includes:
[0020] If a new default wide area network port is not determined in the first traversal, then based on the service priority of each candidate wide area network port, the multiple candidate wide area network ports are sequentially traversed for the second time to form the currently traversed candidate wide area network port;
[0021] If the currently traversed candidate wide area network port belongs to an IPv6 single-stack service and the protocol stack is in an available state, then the currently traversed candidate wide area network port is determined as the new default wide area network port, so that the to-be-processed data packet can be forwarded through the new default wide area network port;
[0022] If the currently traversed candidate wide area network port belongs to an IPv6 single-stack service and the protocol stack is in an unavailable state, or does not belong to an IPv6 single-stack service, then traverse the next candidate wide area network port until a new default wide area network port is determined or the last candidate wide area network port is traversed;
[0023] If a new default wide area network port is not determined in the second traversal, then based on the service priority of each candidate wide area network port, the multiple candidate wide area network ports are sequentially traversed for the third time to form the currently traversed candidate wide area network port;
[0024] If the currently traversed candidate wide area network port belongs to an IPv4 single-stack service and the protocol stack is in an available state, then the currently traversed candidate wide area network port is determined as the new default wide area network port, so that the to-be-processed data packet can be forwarded through the new default wide area network port;
[0025] If the currently traversed candidate wide area network port belongs to the single-stack service of IPv4 and the protocol stack is in an unavailable state, then traverse the next candidate wide area network port until a new default wide area network port is determined or the last candidate wide area network port is traversed.
[0026] In a preferred selection of the present application, in the above data processing method based on multiple wide area network ports, the step of, if the target local area network port is bound to a wide area network port, forwarding the to-be-processed data packet through the wide area network port bound to the target local area network port among the multiple wide area network ports includes:
[0027] If the target local area network port is bound to a wide area network port, determine the wide area network port bound to the target local area network port from the multiple wide area network ports based on a pre-determined mapping relationship;
[0028] Forward the to-be-processed data packet through the wide area network port bound to the target local area network port.
[0029] In a preferred selection of the present application, in the above data processing method based on multiple wide area network ports, the step of, if the target local area network port is bound to a wide area network port, determining the wide area network port bound to the target local area network port from the multiple wide area network ports based on a pre-determined mapping relationship includes:
[0030] If the target local area network port is bound to a wide area network port, based on a pre-determined first mapping relationship, map according to the port number of the target local area network port to obtain a target value of a corresponding target data structure field, and, based on a pre-determined second mapping relationship, map according to the target value to obtain an identification value of the bound wide area network port, where the target data structure field is used to mark the to-be-processed data packet in the kernel, and for a downlink data packet from a wide area network port to a local area network port, the identification value corresponding to the wide area network port is mapped to the target data structure field according to the second mapping relationship to mark the downlink data packet;
[0031] Based on the identification value of the bound wide area network port, determine the port number of the bound wide area network port, and, based on the port number, determine the wide area network port bound to the target local area network port from the multiple wide area network ports.
[0032] The present application also provides a data processing device based on multiple wide area network ports, including:
[0033] A port binding situation determination module, configured to determine whether the target local area network port is bound to a wide area network port after receiving a to-be-processed data packet sent by a target terminal device through the target local area network port;
[0034] The first forwarding processing module is used to forward the to-be-processed data packet through the default wide area network port among multiple wide area network ports when the target local area network port is not bound to a wide area network port.
[0035] The second forwarding processing module is used to forward the to-be-processed data packet through the wide area network port bound to the target local area network port among the multiple wide area network ports when the target local area network port is bound to a wide area network port.
[0036] On this basis, the present application further provides a gateway device, including:
[0037] A memory for storing a computer program;
[0038] A processor connected to the memory, configured to execute the computer program stored in the memory to implement the above-mentioned data processing method based on multiple wide area network ports.
[0039] On this basis, the present application further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program runs, it executes each step of the above-mentioned data processing method based on multiple wide area network ports.
[0040] For the data processing method, apparatus, device and medium based on multiple wide area network ports provided by the present application, first, after receiving a to-be-processed data packet sent by a target terminal device through a target local area network port, it is determined whether the target local area network port is bound to a wide area network port; secondly, if the target local area network port is not bound to a wide area network port, the to-be-processed data packet is forwarded through the default wide area network port among multiple wide area network ports; then, if the target local area network port is bound to a wide area network port, the to-be-processed data packet is forwarded through the wide area network port bound to the target local area network port among the multiple wide area network ports. Based on the above, on the basis of the default wide area network port, since the to-be-processed data packet can also be forwarded through the wide area network port bound to the target local area network port, different data packets can be forwarded through different wide area network ports. In this way, the problem that data of different services are easily mixed together can be avoided to a certain extent, thereby ensuring service stability and further improving the relatively low reliability of data processing in the existing technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to make the above objects, features and advantages of the present application more obvious and understandable, the following specifically gives preferred embodiments and, in conjunction with the accompanying drawings, makes detailed descriptions as follows.
[0042] Figure 1 It is a structural block diagram of the gateway device provided by the embodiment of the present application.
[0043] Figure 2 This is a schematic flowchart of the data processing method based on multiple wide area network ports provided by an embodiment of the present application.
[0044] Figure 3 This is a block diagram of the data processing device based on multiple wide area network ports provided by an embodiment of the present application. Detailed implementation manners
[0045] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part rather than all of the embodiments of the present application. Components of the embodiments of the present application usually described and illustrated in the accompanying drawings here can be arranged and designed in various different configurations.
[0046] Therefore, the detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the claimed present application, but merely represents selected embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0047] As Figure 1 shown, an embodiment of the present application provides a gateway device. Among them, the gateway device may include a memory, a processor, and a data processing device based on multiple wide area network ports.
[0048] Specifically, the memory and the processor are directly or indirectly electrically connected to achieve data transmission or interaction. For example, the memory and the processor may be electrically connected through one or more communication buses or signal lines. The data processing device based on multiple wide area network ports includes at least one software function module stored in the memory in the form of software or firmware. The processor is configured to execute the executable computer program stored in the memory, such as the software function module and computer program included in the data processing device based on multiple wide area network ports, to implement the data processing method based on multiple wide area network ports provided by the embodiment of the present application.
[0049] Optionally, the memory may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), an Electric Erasable Programmable Read-Only Memory (EEPROM), etc.
[0050] Moreover, the processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), a System on Chip (SoC), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0051] It can be understood that Figure 1 The structure shown is only schematic, and the gateway device may also include more or fewer components than those shown Figure 1 in the figure, or have a different configuration from that shown Figure 1 in the figure. For example, it may also include a communication unit for information interaction with other devices.
[0052] In addition, the above gateway device may be a general gateway device or a government and enterprise gateway, and can be applied to scenarios such as pon or FTTR, etc., without specific limitations.
[0053] In combination with Figure 2 , the embodiment of the present application further provides a data processing method based on multiple wide area network ports applicable to the above gateway device. Among them, the method steps defined by the process related to the data processing method based on multiple wide area network ports can be implemented by the gateway device. The following will Figure 2 elaborate in detail on the specific process shown.
[0054] Step S110, after receiving a data packet to be processed sent by a target terminal device through a target local area network port, determine whether a wide area network port is bound to the target local area network port.
[0055] In an embodiment of the present application, after receiving a data packet to be processed sent by a target terminal device through a target local area network port, the gateway device may determine whether a wide area network port is bound to the target local area network port. Exemplarily, the data packet to be processed may refer to an upstream data packet.
[0056] Step S120, if no wide area network port is bound to the target local area network port, forward the data packet to be processed through the default wide area network port among multiple wide area network ports.
[0057] In an embodiment of the present application, if no wide area network port is bound to the target local area network port, the gateway device may forward the data packet to be processed through the default wide area network port among multiple wide area network ports.
[0058] Step S130, if a wide area network port is bound to the target local area network port, forward the data packet to be processed through the wide area network port bound to the target local area network port among the multiple wide area network ports.
[0059] In an embodiment of the present application, if a wide area network port is bound to the target local area network port, the gateway device may forward the data packet to be processed through the wide area network port bound to the target local area network port among the multiple wide area network ports. It should be noted that when binding, the binding can be performed according to different corresponding services, so that data of different services can be forwarded through different ports, avoiding data mixing together.
[0060] Based on the above content, on the basis of the default wide area network port, since the data packet to be processed can also be forwarded through the wide area network port bound to the target local area network port, different data packets can be forwarded through different wide area network ports. In this way, the problem that data of different services are likely to be mixed together can be avoided to a certain extent, thereby ensuring service stability and further improving the relatively low reliability of data processing in the existing technology.
[0061] Regarding step S120, it should be noted that in order to ensure reliable data forwarding processing of the data packet to be processed through the default wide area network port, before executing the above step S120, the data processing method based on multiple wide area network ports may further include step S101 and step S102, and the specific content of each step is as follows.
[0062] Step S101, monitor the status of the default wide area network port to obtain port status information.
[0063] In the embodiment of the present application, the status of the default wide area network port can be monitored to obtain port status information. Among them, the port status information is used to reflect that the default wide area network port is in a connected state (up) or a disconnected state (down). It can be understood that, in some embodiments, the status of all wide area network ports can also be monitored.
[0064] Step S102, if the port status information reflects that the default wide area network port is in a disconnected state, then determine a new default wide area network port from other wide area network ports other than the default wide area network port included in the multiple wide area network ports, so that the to-be-processed data packet can be forwarded through the new default wide area network port.
[0065] In the embodiment of the present application, after obtaining the corresponding port status information, if the port status information reflects that the default wide area network port is in a disconnected state, then determine a new default wide area network port from other wide area network ports other than the default wide area network port included in the multiple wide area network ports, so that the to-be-processed data packet can be forwarded through the new default wide area network port. It should be noted that the new default wide area network port needs to handle the connection state. In addition, if the port status information reflects that the default wide area network port is in a connected state, the current default wide area network port remains unchanged, and the above step S120 is executed.
[0066] It can be understood that in the above step S102, the specific method for determining the new default wide area network port is not limited and can be selected according to actual needs.
[0067] For example, in an alternative embodiment, any one of the wide area network ports in a connected state other than the default wide area network port included in the multiple wide area network ports can be selected as the new default wide area network port.
[0068] For another example, in another alternative embodiment, in order to ensure the reliability of the determined new default wide area network port, the above step S102 may further include the following step S102a and step S102b, and the specific content of each step is described as follows.
[0069] Step S102a, if the port status information reflects that the default wide area network port is in a disconnected state, then determine each wide area network port in a connected state from other wide area network ports other than the default wide area network port included in the multiple wide area network ports, and obtain a plurality of candidate wide area network ports.
[0070] In an embodiment of the present application, if the port status information reflects that the default WAN port is in a disconnected state, then, from the other WAN ports included in the multiple WAN ports except the default WAN port, determine each WAN port in a connected state to obtain multiple candidate WAN ports, that is, screen out each WAN port in a connected state as a candidate.
[0071] Step S102b: Based on the service priority and protocol stack status of each of the candidate WAN ports, determine one candidate WAN port from the multiple candidate WAN ports, and determine this candidate WAN port as the new default WAN port, so that the to-be-processed data packet can be forwarded through the new default WAN port.
[0072] In an embodiment of the present application, after screening out the candidate WAN ports, one candidate WAN port can be determined from the multiple candidate WAN ports based on the service priority and protocol stack status of each of the candidate WAN ports, and this candidate WAN port is determined as the new default WAN port, so that the to-be-processed data packet can be forwarded through the new default WAN port. In this way, it can be ensured that the service priority and protocol stack status of the screened new default WAN port can meet the application requirements, thereby improving its reliability.
[0073] It can be understood that in the above step S102b, in order to fully consider the influence of service priority and protocol stack status on the reliability of data forwarding, the above step S102b can further include the following steps b1, b2, and b3, and the specific content of each step is as follows.
[0074] Step b1: Based on the service priority of each of the candidate WAN ports, perform a first traversal on the multiple candidate WAN ports in sequence to form the candidate WAN port currently being traversed.
[0075] In an embodiment of the present application, a first traversal can be performed on the multiple candidate WAN ports in sequence based on the service priority of each of the candidate WAN ports to form the candidate WAN port currently being traversed. Among them, the traversal order is from the candidate WAN port with a high service priority to the candidate WAN port with a low service priority, and the service priority corresponding to the Ethernet dial-up Internet access service (PPPoE) is higher than the service priority corresponding to the IP-based sessionless service (VR), and the service priority corresponding to the IP-based sessionless service is higher than the service priority corresponding to other services, and other services at least include the Internet Protocol Television service (IPTV).
[0076] Step b2, if the currently traversed candidate WAN port belongs to a dual-stack service and at least one protocol stack is in an available state, then determine the currently traversed candidate WAN port as the new default WAN port, so that the to-be-processed data packet can be forwarded through the new default WAN port.
[0077] In the embodiment of the present application, if the currently traversed candidate WAN port belongs to a dual-stack service (i.e., IPv4 and IPv6), and at least one protocol stack is in an available state (i.e., at least one of IPv4 and IPv6 is available and in the up state), then determine the currently traversed candidate WAN port as the new default WAN port, so that the to-be-processed data packet can be forwarded through the new default WAN port. For example, if the first traversed candidate WAN port belongs to a dual-stack service and at least one protocol stack is in an available state, then use the first traversed candidate WAN port as the new default WAN port.
[0078] Step b3, if the currently traversed candidate WAN port belongs to a dual-stack service and each protocol stack is in an unavailable state, or the currently traversed candidate WAN port does not belong to a dual-stack service, then traverse the next candidate WAN port until a new default WAN port is determined or the last candidate WAN port is traversed.
[0079] In the embodiment of the present application, if the currently traversed candidate WAN port belongs to a dual-stack service and each protocol stack is in an unavailable state, or the currently traversed candidate WAN port does not belong to a dual-stack service, then traverse the next candidate WAN port until a new default WAN port is determined or the last candidate WAN port is traversed. For example, if the first traversed candidate WAN port does not belong to a dual-stack service or none of the protocol stacks are in an available state, and the second traversed candidate WAN port belongs to a dual-stack service and at least one protocol stack is in an available state, then use the second traversed candidate WAN port as the new default WAN port.
[0080] It can be understood that, in order to most likely determine a reliable new default WAN port, after the above step b3, the above step S102b may further include the following steps b4, b5, b6, b7, b8, and b9, and the specific content of each step is as follows.
[0081] Step b4, if a new default WAN port is not determined in the first traversal, then based on the service priority of each of the candidate WAN ports, perform a second traversal on the multiple candidate WAN ports in sequence to form the currently traversed candidate WAN port.
[0082] In an embodiment of the present application, if a new default wide area network port is not determined in the first traversal (that is, each candidate wide area network port does not meet the condition of "belonging to a dual-stack service and at least one protocol stack being in an available state"), then based on the service priorities of each of the candidate wide area network ports, a second traversal is sequentially performed on the multiple candidate wide area network ports to form the candidate wide area network port currently being traversed, where the traversal order is from the candidate wide area network port with a high service priority to the candidate wide area network port with a low service priority, that is, the same as the order of the first traversal.
[0083] Step b5, if the candidate wide area network port currently being traversed belongs to an IPv6 single-stack service and the protocol stack is in an available state, then determine the candidate wide area network port currently being traversed as the new default wide area network port, so that the to-be-processed data packet can be forwarded through the new default wide area network port.
[0084] In an embodiment of the present application, if the candidate wide area network port currently being traversed belongs to an IPv6 single-stack service and the protocol stack is in an available state, then determine the candidate wide area network port currently being traversed as the new default wide area network port, so that the to-be-processed data packet can be forwarded through the new default wide area network port. Exemplarily, if the first candidate wide area network port traversed belongs to an IPv6 single-stack service and the protocol stack is in an available state, then determine the first candidate wide area network port traversed as the new default wide area network port, that is, for a single-stack service, an available IPv6 is preferentially selected.
[0085] Step b6, if the candidate wide area network port currently being traversed belongs to an IPv6 single-stack service and the protocol stack is in an unavailable state, or does not belong to an IPv6 single-stack service, then traverse the next candidate wide area network port until a new default wide area network port is determined or the last candidate wide area network port is traversed.
[0086] In an embodiment of the present application, if the candidate wide area network port currently being traversed belongs to an IPv6 single-stack service and the protocol stack is in an unavailable state, or does not belong to an IPv6 single-stack service, then traverse the next candidate wide area network port until a new default wide area network port is determined or the last candidate wide area network port is traversed. Exemplarily, if the first candidate wide area network port traversed belongs to an IPv6 single-stack service and the protocol stack is in an unavailable state, or does not belong to an IPv6 single-stack service, then when the second candidate wide area network port traversed belongs to an IPv6 single-stack service and the protocol stack is in an available state, determine the second candidate wide area network port traversed as the new default wide area network port, and so on, until a new default wide area network port is determined or the last candidate wide area network port is traversed.
[0087] Step b7, if no new default WAN port is determined in the second traversal, then based on the service priority of each of the candidate WAN ports, the multiple candidate WAN ports are traversed in sequence for the third time to form the currently traversed candidate WAN port.
[0088] In the embodiment of the present application, if no new default WAN port is determined in the second traversal (that is, each of the backend WAN ports satisfies the condition of "belonging to an IPv6 single-stack service and the protocol stack being in an available state"), then based on the service priority of each of the candidate WAN ports, the multiple candidate WAN ports are traversed in sequence for the third time to form the currently traversed candidate WAN port, where the traversal order is from the candidate WAN port with a high service priority to the candidate WAN port with a low service priority, which is the same as the order of the first traversal and the second traversal.
[0089] Step b8, if the currently traversed candidate WAN port belongs to an IPv4 single-stack service and the protocol stack is in an available state, then the currently traversed candidate WAN port is determined as the new default WAN port, so that the to-be-processed data packet can be forwarded through the new default WAN port.
[0090] In the embodiment of the present application, if the currently traversed candidate WAN port belongs to an IPv4 single-stack service and the protocol stack is in an available state, then the currently traversed candidate WAN port is determined as the new default WAN port, so that the to-be-processed data packet can be forwarded through the new default WAN port. Exemplarily, if the first traversed candidate WAN port belongs to an IPv4 single-stack service and the protocol stack is in an available state, then the first traversed candidate WAN port is determined as the new default WAN port.
[0091] Step b9, if the currently traversed candidate WAN port belongs to an IPv4 single-stack service and the protocol stack is in an unavailable state, then the next candidate WAN port is traversed until a new default WAN port is determined or the last candidate WAN port is traversed.
[0092] In an embodiment of the present application, if the currently traversed candidate wide area network port belongs to an IPv4 single-stack service and the protocol stack is in an unavailable state, then traverse the next candidate wide area network port until a new default wide area network port is determined or the last candidate wide area network port is traversed. Exemplarily, if the first traversed candidate wide area network port belongs to an IPv4 single-stack service and the protocol stack is in an unavailable state, then when the second traversed candidate wide area network port belongs to an IPv4 single-stack service and the protocol stack is in an available state, the second traversed candidate wide area network port is determined as the new default wide area network port. Thus, by analogy, until a new default wide area network port is determined or the last candidate wide area network port is traversed. That is to say, double-stack services are preferred, followed by IPv6 single-stack services, and finally IPv4 single-stack services. Inside the foregoing three priorities, selection is then made in the order from high to low according to the service priority.
[0093] It should be noted that after a new default wide area network port is determined, in order to ensure that data forwarding can be performed based on the new default wide area network port, the IPv6 prefix and DNS information corresponding to the new default wide area network port can also be synchronized to the LAN port device (such as the aforementioned target terminal device).
[0094] Regarding the above step S130, it should be noted that the specific implementation manner of forwarding the to-be-processed data packet through the wide area network port bound to the target local area network port among the multiple wide area network ports is not limited and can be selected according to actual requirements.
[0095] For example, in an alternative implementation manner, in order to accurately determine the wide area network port bound to the target local area network port, improve the reliability of data forwarding processing, and avoid the problem of different service data being mixed together, the above step S130 may further include step S131 and step S132, and the specific content of each step is as follows.
[0096] Step S131, if the target local area network port is bound to a wide area network port, then based on a pre-determined mapping relationship, determine the wide area network port bound to the target local area network port from the multiple wide area network ports.
[0097] In an embodiment of the present application, if the target local area network port is bound to a wide area network port, then based on a pre-determined mapping relationship, determine the wide area network port bound to the target local area network port from the multiple wide area network ports. In this way, reliable lookup and determination of the bound wide area network port can be achieved through this mapping relationship.
[0098] Step S132, forward the to-be-processed data packet through the wide area network port bound to the target local area network port.
[0099] In an embodiment of the present application, after determining the WAN port bound to the target LAN port, the to-be-processed data packet can be forwarded through the WAN port bound to the target LAN port.
[0100] It can be understood that in the above step S131, the specific manner of determining the WAN port bound to the target LAN port from the multiple WAN ports is not limited. For example, in an alternative embodiment, in order to improve the efficiency of data forwarding, the above step S131 can further include step S131a and step S131b, and the specific content of each step is described as follows.
[0101] Step S131a: If the target LAN port is bound to a WAN port, based on a pre-determined first mapping relationship, according to the port number of the target LAN port, map to obtain the target value of the corresponding target data structure field, and, based on a pre-determined second mapping relationship, according to the target value, map to obtain the identification value of the bound WAN port.
[0102] In an embodiment of the present application, if the target LAN port is bound to a WAN port, based on a pre-determined first mapping relationship, according to the port number of the target LAN port, map to obtain the target value of the corresponding target data structure field, and, based on a pre-determined second mapping relationship, according to the target value, map to obtain the identification value of the bound WAN port. Wherein, the target data structure field is used to mark the to-be-processed data packet in the kernel, and for the downlink data packet from the WAN port to the LAN port, the identification value corresponding to the WAN port will be mapped into the target data structure field according to the second mapping relationship to mark the downlink data packet. That is to say, a mapping link of LAN port number - value of target data structure field - identification value of WAN port - port number of WAN port can be formed in advance. In this way, for the uplink data packet, the bound WAN port can be found in the forward direction of this mapping link; for the downlink data packet, the bound WAN port can be found in the reverse direction of this mapping link.
[0103] Step S131b: Based on the identification value of the bound WAN port, determine the port number of the bound WAN port, and, based on this port number, determine the WAN port bound to the target LAN port from the multiple WAN ports.
[0104] In the embodiments of the present application, based on the identification value of the bound WAN port, the port number of the bound WAN port can be determined, and based on this port number, the WAN port to which the target LAN port is bound can be determined from the multiple WAN ports, as described above. Based on the above mapping link, compared with the traditional routing query method, the amount of calculation can be reduced, and therefore, the data forwarding efficiency can be improved to a certain extent.
[0105] It should also be noted that for the above embodiments, devices without a bound LAN port use the IPv6 prefix of the default WAN port, while devices with a bound LAN port obtain the IPv6 prefix and DNS information of a specific WAN port according to the binding relationship. For example, the radvd process (Router Advertisement Daemon) can be used to dynamically generate the IPv6 prefix distribution configuration, and combined with the skbmask mark, the accurate matching and allocation of IPv6 addresses and DNS information for different WAN connections can be achieved. Specifically, the radvd_policyid.conf file can be dynamically generated according to the policyid of the WAN connection. That is to say, the policyid corresponding to the WAN connection (i.e., the identification value of the above WAN port) can be mapped to the skb->mark of the kernel (i.e., the above target data structure field). Specifically, setsockopt(sock, SOL_SOCKET, SO_MARK, &mark, sizeof(mark)) is used to configure the sock of radvd to carry the mark for forwarding (i.e., binding a mark value to the socket of the radvd process, which is mapped to the skb->mark in the kernel. The mark value will be passed along with the data packet, allowing the kernel to determine which WAN connection the data packet should take according to the mark). In this way, through the wan connection binding relationship in the application layer, the information of multiple wans can be respectively configured to the corresponding radvd for forwarding to achieve the distribution of IPv6 prefix and DNS information, such as the radvd_policyid.conf file:
[0106] interface br-lan
[0107] {
[0108] AdvSendAdvert on;
[0109] prefix 2001:db8:1:: / 64
[0110] {
[0111] AdvValidLifetime 86400;
[0112] AdvPreferredLifetime 14400;
[0113] AdvOnLink on;
[0114] AdvAutonomous on;
[0115] };
[0116] RDNSS 2001:4860:4860::8888 2001:4860:4860::8844 {};
[0117] };
[0118] Among them, interface br-lan: specifies the br-lan interface, which is usually a bridging interface connecting various devices on the internal network.
[0119] AdvSendAdvert on;: indicates enabling the sending of IPv6 router advertisements.
[0120] prefix 2001:db8:1:: / 64: defines an IPv6 prefix and specifies the lifetime of this prefix:
[0121] AdvValidLifetime 86400;: the valid time of the prefix is 86400 seconds (24 hours).
[0122] AdvPreferredLifetime 14400;: the preferred time of the prefix is 14400 seconds (4 hours).
[0123] AdvOnLink on;: indicates that this prefix is directly reachable.
[0124] AdvAutonomous on;: indicates that the automatic configuration mode is enabled.
[0125] RDNSS 2001:4860:4860::8888 2001:4860:4860::8844 {};: provides DNS server addresses for clients (such as the IPv6 addresses of Google DNS).
[0126] Combined with Figure 3 , the embodiment of this application also provides a data processing device based on multiple wide area network ports applicable to the above gateway device. Among them, the data processing device based on multiple wide area network ports may include a port binding situation determination module, a first forwarding processing module, and a second forwarding processing module.
[0127] The port binding situation determination module is configured to determine whether a wide area network port is bound to the target local area network port after receiving a data packet to be processed sent by a target terminal device through the target local area network port. In an embodiment of the present application, the port binding situation determination module can be used to execute Figure 2 the steps S110 shown, and the relevant content of the port binding situation determination module can be referred to the description of step S110 above.
[0128] The first forwarding processing module is configured to, when no wide area network port is bound to the target local area network port, forward the data packet to be processed through the default wide area network port among multiple wide area network ports. In an embodiment of the present application, the first forwarding processing module can be used to execute Figure 2 the steps S120 shown, and the relevant content of the first forwarding processing module can be referred to the description of step S120 above.
[0129] The second forwarding processing module is configured to, when a wide area network port is bound to the target local area network port, forward the data packet to be processed through the wide area network port bound to the target local area network port among the multiple wide area network ports. In an embodiment of the present application, the second forwarding processing module can be used to execute Figure 2 the steps S130 shown, and the relevant content of the second forwarding processing module can be referred to the description of step S130 above.
[0130] In an embodiment of the present application, corresponding to the above data processing method based on multiple wide area network ports applied to the gateway device, a computer-readable storage medium is further provided. A computer program is stored in the computer-readable storage medium, and when the computer program runs, it executes each step of the data processing method based on multiple wide area network ports.
[0131] Among them, each step executed when the foregoing computer program runs will not be elaborated here one by one, and reference can be made to the foregoing explanation of the data processing method based on multiple wide area network ports.
[0132] In summary, for the data processing method, apparatus, device, and medium based on multiple wide area network ports provided in this application, first, after receiving a data packet to be processed sent by a target terminal device through a target local area network port, it is determined whether the target local area network port is bound to a wide area network port; second, if the target local area network port is not bound to a wide area network port, the data packet to be processed is forwarded through the default wide area network port among the multiple wide area network ports; then, if the target local area network port is bound to a wide area network port, the data packet to be processed is forwarded through the wide area network port bound to the target local area network port among the multiple wide area network ports. Based on the above, on the basis of the default wide area network port, since the data packet to be processed can also be forwarded through the wide area network port bound to the target local area network port, different data packets can be forwarded through different wide area network ports. In this way, to a certain extent, the problem that data of different services are likely to be mixed together can be avoided, thereby ensuring service stability and further improving the relatively low reliability of data processing in the existing technology.
[0133] In several embodiments provided in the embodiments of the present application, it should be understood that the disclosed apparatus and method can also be implemented in other ways. The apparatus and method embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions, and operations of apparatuses, methods, and computer program products according to multiple embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0134] In addition, in each embodiment of the present application, the various functional modules may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0135] When the above-mentioned functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or a 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 causing a computer device (which may be a personal computer, an electronic device, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present application. The foregoing storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs. It should be noted that in this article, the term "including", "comprising", or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or device including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such a process, method, article, or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article, or device including the said element.
[0136] The foregoing are only the preferred embodiments of the present application and are not used to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the protection scope of the present application.
Claims
1. A data processing method based on multiple wide area network ports, characterized in that: include: After receiving a data packet to be processed sent by a target terminal device through a target LAN port, determining whether the target LAN port is bound to a WAN port; If the target LAN port is not bound to a WAN port, forwarding the data packet to be processed through a default WAN port among the multiple WAN ports; If the target LAN port is bound to a WAN port, the to-be-processed data packet is forwarded through the WAN port to which the target LAN port is bound among the multiple WAN ports, wherein the WAN port to which the target LAN port is bound is determined in the following manner: Based on a predetermined first mapping relationship, according to the port number of the target LAN port, a target value of the corresponding target data structure field is mapped, and, based on a predetermined second mapping relationship, according to the target value, an identification value of the bound WAN port is mapped, wherein the identification value is policyid, and the target data structure field is the kernel's skb->mark, which is used to mark the data packet to be processed in the kernel, and specifically a mark value is bound to the socket of the radvd process, and the value is mapped with the skb->mark in the kernel, and the mark value is transmitted with the flow of the data packet, so that the transmission path of the data packet is determined in the kernel according to the mark value, and, for a downlink data packet from the WAN port to the LAN port, the identification value corresponding to the WAN port will be mapped to the target data structure field according to the second mapping relationship to mark the downlink data packet; based on the identification value of the bound WAN port, the port number of the bound WAN port is determined, and, based on the port number, the WAN port bound to the target LAN port is determined from the multiple WAN ports.
2. The data processing method based on multiple WAN ports according to claim 1, characterized in that: Before the step of forwarding the data packet to be processed through a default WAN port among multiple WAN ports if the target LAN port is not bound to a WAN port, the data processing method based on multiple WAN ports also includes: Monitoring the state of the default wide area network port to obtain port state information, wherein the port state information is used to reflect whether the default wide area network port is in a connected state or a disconnected state; If the port status information reflects that the default WAN port is in a disconnected state, a new default WAN port is determined from other WAN ports included in the multiple WAN ports except the default WAN port, so that the data packet to be processed can be forwarded and processed through the new default WAN port.
3. The data processing method based on multiple WAN ports according to claim 2, characterized in that: If the port status information reflects that the default WAN port is in a disconnected state, the step of determining a new default WAN port from other WAN ports included in the multiple WAN ports except the default WAN port, so that the data packet to be processed can be forwarded through the new default WAN port includes: If the port status information reflects that the default WAN port is in a disconnected state, then determining each WAN port in a connected state from other WAN ports included in the plurality of WAN ports except the default WAN port, to obtain a plurality of candidate WAN ports; Based on the service priority and protocol stack status of each of the candidate WAN ports, a candidate WAN port is determined from the multiple candidate WAN ports, and the candidate WAN port is determined as a new default WAN port, so that the data packet to be processed can be forwarded and processed through the new default WAN port.
4. The data processing method based on multiple WAN ports according to claim 3 is characterized in that: The step of determining a candidate WAN port from the plurality of candidate WAN ports based on the service priority and protocol stack status of each of the candidate WAN ports, and determining the candidate WAN port as a new default WAN port so that the data packet to be processed can be forwarded through the new default WAN port includes: Based on the service priority of each of the candidate WAN ports, the multiple candidate WAN ports are traversed in sequence for the first time to form the candidate WAN ports currently traversed, wherein the traversal order is from the candidate WAN port with a higher service priority to the candidate WAN port with a lower service priority, and the service priority corresponding to the Ethernet dial-up Internet access service is higher than the service priority corresponding to the IP-based sessionless service, and the service priority corresponding to the IP-based sessionless service is higher than the service priority corresponding to other services, and the other services at least include an Internet Protocol television service; If the candidate WAN port currently traversed belongs to a dual-stack service and at least one protocol stack is in an available state, the candidate WAN port currently traversed is determined as a new default WAN port, so that the data packet to be processed can be forwarded and processed through the new default WAN port; If the currently traversed candidate WAN port belongs to the dual-stack service and each protocol stack is in an unavailable state, or the currently traversed candidate WAN port does not belong to the dual-stack service, the next candidate WAN port is traversed until a new default WAN port is determined or the last candidate WAN port is traversed.
5. The data processing method based on multiple WAN ports according to claim 4, characterized in that: The step of determining a candidate WAN port from the plurality of candidate WAN ports based on the service priority and protocol stack status of each of the candidate WAN ports, and determining the candidate WAN port as a new default WAN port so that the data packet to be processed can be forwarded through the new default WAN port, further includes: If the first traversal fails to determine a new default WAN port, then based on the service priority of each of the candidate WAN ports, the plurality of candidate WAN ports are traversed in sequence for a second time to form a currently traversed candidate WAN port; If the candidate WAN port currently traversed belongs to the single stack service of IPv6 and the protocol stack is in an available state, the candidate WAN port currently traversed is determined as the new default WAN port, so that the data packet to be processed can be forwarded and processed through the new default WAN port; If the currently traversed candidate WAN port belongs to an IPv6 single-stack service and the protocol stack is in an unavailable state, or does not belong to an IPv6 single-stack service, traverse the next candidate WAN port until a new default WAN port is determined or the last candidate WAN port is traversed; If the second traversal fails to determine a new default WAN port, then based on the service priority of each of the candidate WAN ports, the plurality of candidate WAN ports are sequentially traversed for a third time to form a currently traversed candidate WAN port; If the candidate WAN port currently traversed belongs to the single stack service of IPv4 and the protocol stack is in an available state, the candidate WAN port currently traversed is determined as the new default WAN port, so that the data packet to be processed can be forwarded and processed through the new default WAN port; If the currently traversed candidate WAN port belongs to the IPv4 single stack service and the protocol stack is in an unavailable state, the next candidate WAN port is traversed until a new default WAN port is determined or the last candidate WAN port is traversed.
6. A data processing device based on multiple wide area network ports, characterized in that: include: A port binding status determination module, configured to determine whether the target LAN port is bound to a WAN port after receiving a to-be-processed data packet sent by a target terminal device through the target LAN port; A first forwarding processing module, configured to forward the data packet to be processed through a default WAN port among multiple WAN ports when the target LAN port is not bound to a WAN port; The second forwarding processing module is used for forwarding the to-be-processed data packet through the WAN port bound to the target LAN port among the multiple WAN ports when the target LAN port is bound to a WAN port, wherein the WAN port bound to the target LAN port is determined in the following manner: Based on a predetermined first mapping relationship, according to the port number of the target LAN port, a target value of the corresponding target data structure field is mapped, and, based on a predetermined second mapping relationship, according to the target value, an identification value of the bound WAN port is mapped, wherein the identification value is policyid, and the target data structure field is the kernel's skb->mark, which is used to mark the data packet to be processed in the kernel, and specifically a mark value is bound to the socket of the radvd process, and the value is mapped with the skb->mark in the kernel, and the mark value is transmitted with the flow of the data packet, so that the transmission path of the data packet is determined in the kernel according to the mark value, and, for a downlink data packet from the WAN port to the LAN port, the identification value corresponding to the WAN port will be mapped to the target data structure field according to the second mapping relationship to mark the downlink data packet; based on the identification value of the bound WAN port, the port number of the bound WAN port is determined, and, based on the port number, the WAN port bound to the target LAN port is determined from the multiple WAN ports.
7. A gateway device, characterized in that: include: Memory for storing computer programs; A processor connected to the memory is used to execute the computer program stored in the memory to implement the data processing method based on multiple wide area network ports as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is run, the data processing method based on multiple wide area network ports according to any one of claims 1 to 5 is executed.
Citation Information
Patent Citations
Local area network (LAN) and wide area network (WAN) service binding method and service binding system
CN103166854A
Method and device for selecting main WAN port by CPE (Customer Premise Equipment) with multiple WAN ports
CN116132333A