Message distribution method of router, electronic device and computer readable storage medium

CN123020463APending Publication Date: 2026-10-30PURPLE MOUNTAIN LAB
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611257851.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-18
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0004]本发明实施例提供了一种路由器的报文分发方法、电子设备及计算机可读存储介质,以至少解决相关技术中,对路由器的报文分发时,存在报文分发不可靠的技术问题

Benefits of technology

[0183](1)将接收到的上行协议报文的报文内容与分发规则库中的各已注册规则进行匹配,确定分发规则库中是否存在与报文内容匹配的目标分发规则;在匹配成功的情况下才对该上行协议报文执行复制分发操作,能够避免无关报文占用执行体处理资源;在匹配成功后将该上行协议报文复制N份并分别添加包含直连物理接口地址的第一报文头,按照第一报文头中的直连物理接口地址分别向控制面的N个执行体分发对应的更新协议报文,使得主执行体和M个备执行体均能收到该上行协议报文,由于N个执行体均收到相同的上行协议报文,因此M个备执行体能够同步获取主执行体收到的协议报文内容,从而保持与主执行体一致的路由协议状态;同时,由于M个备执行体分别用于在主执行体为故障状态时替换主执行体进行协议报文交互,因此M个备执行体在同步协议报文状态后能够在主执行体发生故障时无缝接管协议报文交互功能,解决因备执行体缺少上行协议报文导致切换时路由协议状态不一致导致的路由震荡,进而提高报文分发的可靠性,进而解决了相关技术中,对路由器的报文分发时,存在报文分发不可靠的技术问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123020463A_ABST
    Figure CN123020463A_ABST
Patent Text Reader

Abstract

The application discloses a message distribution method of a router, electronic equipment and a computer readable storage medium. The method comprises the following steps: receiving an uplink protocol message; matching the message content of the uplink protocol message with each registered rule in a distribution rule library to obtain a rule matching result; in the case that the rule matching result is that a target distribution rule in the distribution rule library matches the message content of the uplink protocol message, copying the uplink protocol message N times to obtain N to-be-distributed protocol messages; adding a first message header in each of the N to-be-distributed protocol messages to obtain N updated protocol messages; and distributing the updated protocol messages to N executors according to the direct-connection physical interface addresses in the first message headers of the updated protocol messages. The application solves the technical problem that message distribution of a router is unreliable in the related art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communications, and more specifically, to a message distribution method for a router, an electronic device, and a computer-readable storage medium. Background Technology

[0002] In related technologies, to reduce the risk of single-point failure of control plane executors, a distributed deployment approach is typically used to horizontally scale the control plane executors, i.e., multiple independent executors constitute a redundant control plane. However, in these technologies, when routers using distributed deployment perform packet distribution, there is a technical problem of poor coordination among multiple executors, leading to unreliable packet distribution.

[0003] There is currently no effective solution to the above problems. Summary of the Invention

[0004] This invention provides a packet distribution method for a router, an electronic device, and a computer-readable storage medium to at least solve the technical problem of unreliable packet distribution in related technologies.

[0005] According to one aspect of the present invention, a packet distribution method for a router is provided, comprising: receiving an uplink protocol packet; matching the packet content of the uplink protocol packet with each registered rule in a distribution rule base to obtain a rule matching result; if the rule matching result indicates that a target distribution rule in the distribution rule base matches the packet content of the uplink protocol packet, copying the uplink protocol packet N times to obtain N protocol packets to be distributed; adding a first packet header to each of the N protocol packets to be distributed to obtain N update protocol packets, wherein the first packet... The header includes the direct physical interface address of the executor corresponding to the protocol message to be distributed; according to the direct physical interface address in the first message header of the N update protocol messages, the corresponding update protocol messages are distributed to the N executors respectively, so that the main executor updates the routing protocol of the router, and the M backup executors synchronize the routing protocol update status of the main executor. The N executors are deployed in the control plane of the router. The N executors include the main executor and the M backup executors corresponding to the main executor. N is an integer greater than 1, and M is N-1.

[0006] Optionally, after distributing the corresponding update protocol messages to the N execution entities on the control plane according to the directly connected physical interface addresses in the first message headers of the N update protocol messages, the process includes: determining the message proxy operation corresponding to each of the N execution entities, wherein the message proxy operation includes any one of the following: a message processing operation, a message discarding operation, so that when the message proxy operation is a message processing operation, the main execution entity performs routing protocol updates on the router, and the routing protocol update status of the M backup execution entities is synchronized with that of the main execution entity; and so that when the message proxy operation is a message discarding operation, the update protocol message is discarded; the message processing operation includes any one of the following: when the corresponding execution entity is a backup execution entity, according to the corresponding update protocol... The system performs state synchronization for routing protocol updates on the backup executor. When the corresponding executor is the primary executor, it determines the service interface number corresponding to the physical service interface address in the header of the corresponding update protocol message, and matches the target identifier corresponding to the update protocol message from the interface identifier mapping table according to the service interface number. Based on the virtual service interface address corresponding to the target identifier, it forwards the corresponding update protocol message to the protocol application in the primary executor, so that the router's routing protocol can be updated through the protocol application. Here, the service interface number is used to uniquely identify the physical service interface address, the target identifier is used to uniquely identify the virtual service interface address, and the protocol application is an application that implements protocol message interaction.

[0007] Optionally, forwarding the corresponding update protocol message to the protocol application in the main execution body based on the virtual service interface address corresponding to the target identifier includes: determining the distribution rule to be registered corresponding to the protocol application; determining whether there is a registered rule identical to the distribution rule to be registered in the distribution rule base, and obtaining a registration determination result; performing a pipeline determination operation corresponding to the registration determination result to obtain the target data pipeline; and forwarding the corresponding update protocol message to the protocol application in the main execution body based on the target data pipeline and the virtual service interface address corresponding to the target identifier.

[0008] Optionally, the step of performing the pipeline determination operation corresponding to the registration determination result to obtain the target data pipeline includes: if the registration determination result is that there is a registered rule in the distribution rule base that is the same as the distribution rule to be registered, reusing the data pipeline corresponding to the registered rule as the target data pipeline; if the registration determination result is that there is no registered rule in the distribution rule base that is the same as the distribution rule to be registered, creating a new data pipeline as the target data pipeline.

[0009] Optionally, the method further includes: receiving a downlink protocol message, wherein the downlink protocol message includes a protocol message to be synchronized and a second message header, the second message header including a status identifier and a destination interface address, the status identifier being used to distinguish between a primary executor and a backup executor; copying the downlink protocol message M times to obtain M first protocol messages, wherein the primary status is the status corresponding to the primary executor; changing the destination interface addresses corresponding to the M first protocol messages to the synchronization interface addresses corresponding to the corresponding backup executors respectively, to obtain M second protocol messages; distributing the protocol message to be synchronized in the corresponding second protocol message to the corresponding backup executor according to the corresponding synchronization interface address, to obtain a synchronization result; determining whether the status identifier in the second message header is the primary status, and if the status identifier is the primary status, distributing the protocol message to be synchronized in the downlink protocol message based on the synchronization result and the destination interface address.

[0010] Optionally, the step of distributing the protocol messages to be synchronized in the downlink protocol messages based on the synchronization result and the destination interface address includes: if the synchronization result includes an adjudication result, determining whether the adjudication result is a predetermined result, and if the adjudication result is a predetermined result, distributing the protocol messages to be synchronized in the downlink protocol messages according to the destination interface address, wherein the adjudication result is determined by: determining the output messages of the M backup executors in the target scenario, wherein the target scenario is the scenario in which the main executor sends the downlink protocol messages; performing consistency adjudication between the output messages corresponding to the M backup executors and the downlink protocol messages to obtain adjudication results.

[0011] Optionally, for any one of the registered rules, the message content of the uplink protocol message is matched with any one of the registered rules in the following manner: if any one of the registered rules includes multiple sub-rules, according to the execution order of the multiple sub-rules, for any one of the multiple sub-rules, the content to be matched in the uplink protocol message is matched with the reference content in the any one of the sub-rules for content consistency matching, until the target condition is reached, and the matching result between the any one of the registered rules and the uplink protocol message is obtained. The content to be matched is the content in the message content of the uplink protocol message at the position to be matched corresponding to the any one of the sub-rules. The any one of the sub-rules includes the position to be matched and the reference content. The target condition includes any one of the following: the matching result is that the content to be matched is inconsistent with the reference content; the multiple sub-rules have been executed.

[0012] According to one aspect of the present invention, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the packet distribution method of a router as described in any of the preceding claims.

[0013] According to one aspect of the present invention, a computer-readable storage medium is provided, wherein when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the packet distribution method of the router described in any of the preceding claims.

[0014] According to one aspect of the present invention, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the packet distribution method of the router described in any of the preceding claims.

[0015] In this embodiment of the invention, the content of the received uplink protocol message is matched with each registered rule in the distribution rule base to determine whether a target distribution rule matching the message content exists in the distribution rule base. Only if a match is successful is the uplink protocol message copied and distributed, thus avoiding irrelevant messages occupying the processing resources of the execution unit. After a successful match, the uplink protocol message is copied N times, and a first message header containing the direct physical interface address is added to each copy. The corresponding update protocol message is then distributed to the N execution units in the control plane according to the direct physical interface address in the first message header, ensuring that both the main execution unit and the M backup execution units receive the uplink protocol message. Since all N execution units... Since all M backup executors receive the same uplink protocol message, they can synchronously obtain the protocol message content received by the primary executor, thus maintaining a consistent routing protocol state with the primary executor. Furthermore, because each of the M backup executors is used to replace the primary executor in protocol message interaction when the primary executor fails, after synchronizing the protocol message state, the M backup executors can seamlessly take over the protocol message interaction function when the primary executor fails. This solves the routing oscillation caused by inconsistent routing protocol states during handover due to the lack of uplink protocol messages in the backup executors, thereby improving the reliability of message distribution. This also solves the technical problem of unreliable message distribution in routers in related technologies. Attached Figure Description

[0016] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0017] Figure 1 This is a flowchart of a packet distribution method for a router according to an embodiment of the present invention;

[0018] Figure 2 This is a schematic diagram of the packet distribution system architecture of a router in an optional embodiment of the present invention;

[0019] Figure 3 This is a schematic diagram of the uplink protocol message distribution process in an optional embodiment of the present invention;

[0020] Figure 4 This is a schematic diagram of the rule matching process for message content in an optional embodiment of the present invention;

[0021] Figure 5 This is a schematic diagram of the internal architecture of the IO module in an optional embodiment of the present invention;

[0022] Figure 6 This is a schematic diagram of the data pipeline registration process in an optional embodiment of the present invention;

[0023] Figure 7 This is a schematic diagram of the downlink protocol message distribution process in an optional embodiment of the present invention. Detailed Implementation

[0024] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0026] Example 1

[0027] According to an embodiment of the present invention, an embodiment of a packet distribution method for a router is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0028] Figure 1 This is a flowchart of a packet distribution method for a router according to an embodiment of the present invention, as shown below. Figure 1 As shown, the method includes the following steps:

[0029] S102, Receive uplink protocol message;

[0030] This involves uplink protocol messages, which are routing protocol messages received from the router's data plane (i.e., data plane forwarding devices) and need to be passed to the control plane execution unit for processing. Uplink protocol messages are typically sent by other routers that have established a routing protocol peering relationship with the current router (i.e., associated routers). They enter the router via the physical service interface of the data plane and are ultimately distributed to the primary or backup execution unit of the control plane for updating and synchronizing routing protocol states. These uplink protocol messages carry state information or routing update information required for routing protocol interaction, such as Border Gateway Protocol (BGP) messages and Open Shortest Path First (OSPF) protocol messages.

[0031] This involves receiving, which is the action of the data plane's protocol message processing module acquiring uplink protocol messages through the physical service interface. Specifically, after the data plane's hardware abstraction layer receives the raw Ethernet protocol message from the associated router through the physical service interface, it passes the message to the protocol message processing module. The protocol message processing module, as the receiving end, acquires the uplink protocol message and triggers the subsequent matching and distribution process. The receiving operation is the starting point of the uplink message distribution process, ensuring that the uplink protocol message can be correctly captured and enter the router's message distribution and processing pipeline.

[0032] This involves a router, a network device used to forward data packets between different networks and maintain routing tables based on routing protocols to determine the optimal transmission path for data packets. The router employs a distributed control plane architecture, with its control plane containing multiple execution units (i.e., a primary execution unit and multiple backup execution units) to achieve redundancy and high availability. The router's data plane is responsible for the physical sending and receiving of packets and preliminary processing, while the control plane is responsible for running routing protocol applications and generating routing table entries. The two interact with each other through the device's internal network channels.

[0033] S104, match the message content of the uplink protocol message with each registered rule in the distribution rule base to obtain the rule matching result;

[0034] This involves the message content, which is the complete set of byte data carried by the uplink protocol message.

[0035] This involves a distribution rule base, which is a set of rules used to filter and distribute packets from various routing protocols. The distribution rule base includes multiple registered rules.

[0036] This involves registered rules, which are message filtering rules that have been successfully registered and are in effect in the distribution rule base, used to match and filter protocol messages. Specifically, each registered rule corresponds to the receiving requirements of the user-space program (such as a protocol proxy program) in the executable for the corresponding type of protocol message. A registered rule can contain multiple sub-rules (i.e., a filter array). Each sub-rule specifies the position to be matched (i.e., the message offset in bytes) and the reference content (i.e., the message byte content to be matched). The registered rule is matched with the uplink protocol message only when all sub-rules match successfully.

[0037] This involves rule matching results, which determine whether a target distribution rule exists in the distribution rule base that matches the message content of the uplink protocol message. Specifically, the rule matching results include two cases: the target distribution rule exists in the distribution rule base that matches the message content of the uplink protocol message; or the target distribution rule does not exist in the distribution rule base that matches the message content of the uplink protocol message.

[0038] S106, if the rule matching result is that there is a target distribution rule in the distribution rule base that matches the message content of the uplink protocol message, copy the uplink protocol message N times to obtain N protocol messages to be distributed;

[0039] This involves the target distribution rule, which is the registered rule in the distribution rule base that successfully matches the message content of the uplink protocol message.

[0040] This involves protocol messages to be distributed, which are copies of the original messages obtained by copying the uplink protocol messages. The content of the protocol messages to be distributed is exactly the same as that of the uplink protocol messages, and there are N such protocol messages.

[0041] S108, add the first message header to each of the N protocol messages to be distributed to obtain N update protocol messages, wherein the first message header includes the direct physical interface address of the execution body corresponding to the protocol message to be distributed;

[0042] This involves the first header, a custom Ethernet header added before the protocol message to be distributed. This header carries forwarding control information required for message transmission within the router's internal network channel (i.e., the device's internal network channel). The first header includes the directly connected physical interface address and is primarily used for internal forwarding and addressing within the device.

[0043] This involves the direct physical interface address, which is the hardware address of the direct physical network interface (used for internal router communication) connecting the corresponding actuator to the router's internal network channel. Specifically, it can be the Media Access Control (MAC) address of the direct physical network interface. The direct physical interface address uniquely identifies the communication endpoint of each actuator in the control plane within the device's internal network channel. The data plane's protocol message processing module uses this direct physical interface address to direct the corresponding update protocol message to the corresponding actuator. Each actuator has a unique and fixed direct physical interface address.

[0044] This involves executors, which are independent protocol processing units deployed in the router's control plane. These units run routing protocol applications and execute the processing logic for routing protocol messages. The control plane contains N executors, which are functionally equivalent, forming an N-redundant control plane. These N executors include one primary executor and M backup executors (M=N-1). Only one executor is active as the primary executor at any given time, while the others are in standby mode. Each executor is connected to the device's internal network channel through its own independent direct physical network interface. N is an integer greater than 1, and M is N-1. Executors can be implemented using any virtualized or physical form, such as physical hardware, virtual machines, containers, or operating system namespaces.

[0045] This involves update protocol messages, which are obtained by adding a first header to the front of the protocol messages to be distributed. That is, the update protocol message consists of two parts: a first header and an uplink protocol message (i.e., the protocol message to be distributed). Each protocol message to be distributed corresponds to one update protocol message, and the direct physical interface address in the first header of different update protocol messages is different, corresponding to different execution entities. The update protocol message is the protocol message that the data plane protocol message processing module ultimately sends to each execution entity in the control plane through the direct physical network interface.

[0046] S110, according to the directly connected physical interface address in the first message header of the N update protocol messages, distribute the corresponding update protocol messages to the N execution entities respectively, so that the main execution entity updates the routing protocol of the router, and the M backup execution entities synchronize the routing protocol update status of the main execution entity. The N execution entities are deployed in the control plane of the router. The N execution entities include the main execution entity and the M backup execution entities corresponding to the main execution entity. N is an integer greater than 1, and M takes the value of N-1, that is, M=N-1.

[0047] This involves the control plane, a functional area within the router device independently responsible for routing protocol calculation, neighbor session negotiation, routing table generation, and protocol state maintenance, isolated from the data plane responsible for traffic forwarding. The router's control plane deploys N execution entities. Specifically, the control plane can be divided into two layers: user space and kernel space. The user space of the control plane deploys protocol applications, protocol proxy programs, and output decision programs (optional), while the kernel space deploys input / output (I / O) modules and virtual service interfaces.

[0048] This involves a master executor, one of N executors in the control plane. It is the currently active executor responsible for processing routing protocol messages and controlling router routing protocol updates. In other words, the master executor is the currently active node in the control plane, responsible for interacting with external routers using routing protocols and generating routing forwarding table entries to send to the data plane. At any given time, only one of the N executors acts as the master executor.

[0049] This involves routing protocol updates, which is the process by which the main executor maintains and updates the router's routing table based on the routing protocol information in the received uplink protocol messages.

[0050] This involves M backup executors (M=N-1), which are the other executors in the control plane besides the primary executor. They are currently in a standby state, not actively interacting with external routers via routing protocols, but continuously receiving and processing update protocol messages from the data plane. The core function of the backup executors is to synchronize the routing protocol update state of the primary executor. That is, by receiving the same uplink protocol messages, the backup executors also execute the same routing protocol update logic, ensuring their routing protocol state remains consistent with the primary executor in real time. When the primary executor fails, one of the M backup executors seamlessly switches over to become the new primary executor, taking over the routing protocol interaction function. Because the backup executor has synchronized the routing protocol update state of the primary executor, the switchover will not cause routing oscillations.

[0051] Through steps S102-S110, the content of the received uplink protocol message is matched with each registered rule in the distribution rule base to determine whether a target distribution rule matching the message content exists. Only if a match is successful is the uplink protocol message copied and distributed, preventing irrelevant messages from consuming execution resources. After a successful match, the uplink protocol message is copied N times, and a first message header containing the direct physical interface address is added to each copy. The corresponding update protocol message is then distributed to the N execution units on the control plane according to the direct physical interface address in the first message header, ensuring that both the main execution unit and the M backup execution units receive the uplink protocol message. Since N... Since all the executors receive the same uplink protocol messages, the M backup executors can synchronously obtain the protocol message content received by the primary executor, thereby maintaining a consistent routing protocol state with the primary executor. Simultaneously, because the M backup executors are used to replace the primary executor in protocol message interaction when the primary executor fails, after synchronizing the protocol message state, the M backup executors can seamlessly take over the protocol message interaction function when the primary executor fails. This solves the routing oscillation caused by inconsistent routing protocol states during handover due to the lack of uplink protocol messages in the backup executors, thereby improving the reliability of message distribution. This also solves the technical problem of unreliable message distribution in routers in related technologies.

[0052] As an optional embodiment, after distributing the corresponding update protocol messages to the N execution entities of the control plane according to the directly connected physical interface addresses in the first message headers of the N update protocol messages, the process includes: determining the message proxy operation corresponding to each of the N execution entities, wherein the message proxy operation includes any one of the following: a message processing operation, a message discarding operation, such that when the message proxy operation is a message processing operation, the main execution entity performs routing protocol updates on the router, and the routing protocol update status of the M backup execution entities is synchronized with that of the main execution entity; and such that when the message proxy operation is a message discarding operation, the update protocol message is discarded; the message processing operation includes any one of the following: when the corresponding execution entity is a backup execution entity, according to According to the corresponding update protocol message, the backup executor performs state synchronization for routing protocol updates. When the corresponding executor is the primary executor, it determines the service interface number corresponding to the physical service interface address in the header of the corresponding update protocol message, and matches the target identifier corresponding to the update protocol message from the interface identifier mapping table according to the service interface number. Based on the virtual service interface address corresponding to the target identifier, it forwards the corresponding update protocol message to the protocol application in the primary executor, so that the router can be updated via the protocol application. Here, the service interface number is used to uniquely identify the physical service interface address, the target identifier is used to uniquely identify the virtual service interface address, and the protocol application is the application that implements the protocol message interaction.

[0053] This involves message proxy operations, which are the specific processing actions performed by protocol proxy programs on each execution unit of the control plane upon receiving update protocol messages. Message proxy operations are determined by the protocol proxy program based on its own logic and the role of the current execution unit (main or backup), and include two types: message processing operations and message discarding operations. The core function of message proxy operations is as follows: for the main execution unit, it ultimately delivers the uplink protocol message in the update protocol message to the protocol application to achieve routing protocol updates; for the backup execution unit, it uses the update protocol message for local routing protocol state synchronization to maintain consistency with the main execution unit's state; simultaneously, the protocol proxy program can choose to discard the message, thereby blocking its transmission to the local kernel protocol stack (Network stack).

[0054] This involves message processing operations, which are further processing of update protocol messages. The message processing operations are divided into two scenarios depending on the role of the executor: when the corresponding executor is a backup executor, the message processing operation synchronizes the routing protocol update status of the backup executor according to the update protocol message; when the corresponding executor is a primary executor, the message processing operation forwards the uplink protocol message in the update protocol message to the protocol application in the primary executor through a virtual service interface to achieve the routing protocol update.

[0055] This involves message discarding, which is an active process of discarding update protocol messages and preventing them from being delivered to the protocol application. For example, message discarding can be used by a protocol proxy to block specific messages based on its own policies (such as security filtering, flow control, and message deduplication), thereby achieving flexible control plane message management capabilities.

[0056] When a message proxy operation is a message processing operation, the following conditions must be met:

[0057] The update protocol message matches the pending message type registered by the protocol agent program;

[0058] Furthermore, the content of the update protocol message is verified through a preset security filtering policy;

[0059] Furthermore, the current message processing queue load is below a preset threshold;

[0060] Furthermore, the update protocol message was not marked as a processed message by the protocol proxy program.

[0061] When a message proxy operation is a message discard operation, the following conditions must be met:

[0062] Alternatively, the update protocol message does not match the message type to be processed registered by the protocol agent;

[0063] Or, the content of the update protocol message has not passed the preset security filtering policy verification;

[0064] Alternatively, the current message processing queue load is greater than or equal to a preset threshold;

[0065] Alternatively, the update protocol message may be marked as a processed message by the protocol agent.

[0066] This involves the physical service interface address, which is the hardware address of the physical service interface on the data plane that communicates with external systems; specifically, it is the Media Access Control (MAC) address of the physical service interface. A physical service interface is a physical network port on the data plane used for sending and receiving protocol messages with associated external routers. Each physical service interface on the data plane uniquely corresponds to a service interface number. The physical service interface address corresponds one-to-one with the service interface number in the first header of the update protocol message, identifying which physical service interface the message originates from.

[0067] This involves the service interface number, which uniquely identifies the physical service interface on the data plane. Each physical service interface is assigned a unique service interface number during system initialization, and this number is bound to attributes such as the physical service interface name and media access control (MAC) address on the data plane. The service interface number exists as a field in the custom message header, enabling the control plane execution body to identify the physical service interface corresponding to the update protocol message, thereby correctly associating the message with the corresponding virtual service interface.

[0068] This involves an interface identifier mapping table, which maps service interface numbers to virtual service interface names and service interface channel file descriptors. The keys of the interface identifier mapping table are the service interface numbers, and the values ​​are the virtual service interface names and service interface channel file descriptors. The interface identifier mapping table is stored in the I / O module of the control plane and is maintained and managed by the I / O module. Through the interface identifier mapping table, the corresponding virtual service interface can be quickly found based on the service interface number, thereby achieving accurate and fast mapping of packets from the data plane physical service interface to the control plane virtual service interface.

[0069] This involves a target identifier, which is a channel file descriptor used to uniquely identify a virtual service interface. The target identifier serves as a communication endpoint during bidirectional data interaction between the IO module and the virtual service interface. The IO module uses this target identifier to send or read messages from the corresponding virtual service interface. The target identifier is maintained by an interface file descriptor mapping table, obtained by querying the service interface number index. The key of the interface file descriptor mapping table is the service interface channel file descriptor, and the values ​​are the virtual service interface name and the service interface number.

[0070] This involves virtual service interface addresses, which are the network addresses of virtual service interfaces in the control plane, specifically their Media Access Control (MAC) addresses. Specifically, a virtual service interface is a logical network interface created by the I / O module in the control plane kernel space, and it forms a one-to-one mapping relationship with the physical service interfaces on the data plane through a number. One end of the virtual service interface connects to the kernel protocol stack, and the other end connects to the I / O module, serving as a logical channel for bidirectional transmission of protocol messages between the control plane kernel protocol stack and the I / O module. The virtual service interface address identifies the endpoint of this logical channel in network communication. The I / O module forwards update protocol messages to the kernel protocol stack in the main execution unit through the virtual service interface corresponding to this address.

[0071] This involves a protocol application, which is an application that implements the interaction of routing protocol messages and runs in the user space of the control plane execution body. Specifically, the protocol application can be a routing protocol process, such as a Border Gateway Protocol (BGP) process or an Open Shortest Path First (OSPF) process. The protocol application communicates with the kernel protocol stack through the operating system's socket API, receives uplink protocol messages from virtual service interfaces, and performs routing protocol logic processing (such as updating the routing table and maintaining neighbor states), thereby implementing the router's routing protocol update function.

[0072] In this optional embodiment, the primary executor matches the target identifier in the interface identifier mapping table according to the service interface number, and forwards the update protocol message to the protocol application based on the virtual service interface address corresponding to the target identifier. This enables the primary executor to obtain the uplink protocol message to complete the routing protocol update. At the same time, the backup executor synchronizes the routing protocol update status according to the update protocol message. Since all executors receive the same copy of the uplink protocol message, the backup executor can reproduce the routing protocol status changes of the primary executor in real time, avoiding routing oscillations caused by inconsistent routing protocol status during primary-backup switching, and effectively improving the reliability of message distribution. In addition, when the message proxy operation is a message discard operation, the update protocol message is directly discarded, which can block unnecessary messages from interfering with the protocol application and prevent irrelevant messages from occupying the processing resources of the executor.

[0073] As an optional embodiment, based on the virtual service interface address corresponding to the target identifier, the corresponding update protocol message is forwarded to the protocol application in the main execution body, including: determining the distribution rule to be registered corresponding to the protocol application; determining whether there is a registered rule with the same name as the distribution rule to be registered in the distribution rule base, and obtaining a registration determination result; performing a pipeline determination operation corresponding to the registration determination result to obtain a target data pipeline; and forwarding the corresponding update protocol message to the protocol application in the main execution body based on the target data pipeline and the virtual service interface address corresponding to the target identifier.

[0074] This includes the registration and distribution rules, which are filtering rules used to declare what types of uplink protocol messages the application expects to receive.

[0075] This involves determining the registration result, which is obtained by analyzing whether a rule identical to the one to be registered exists in the distribution rule base. For example, this registration result can be obtained by the data pipeline management module of the IO module comparing the rule to be registered with all existing registered distribution rules in the distribution rule base after receiving the rule. The registration result includes two scenarios: either a rule identical to the one to be registered exists in the distribution rule base, or no rule identical to the one to be registered exists in the distribution rule base.

[0076] This involves a pipeline determination operation, which is a data pipeline determination operation corresponding to the registration determination result. It is used to obtain the target data pipeline based on the registration determination result. That is, it executes the pipeline determination operation corresponding to the registration determination result to obtain the target data pipeline, including two scenarios: if the registration determination result is that there is a registered rule in the distribution rule base that is the same as the distribution rule to be registered, the data pipeline corresponding to the registered rule is reused as the target data pipeline; if the registration determination result is that there is no registered rule in the distribution rule base that is the same as the distribution rule to be registered, a new data pipeline is created as the target data pipeline.

[0077] This involves a target data pipeline, which is a channel for message transmission obtained after performing a pipeline determination operation. Specifically, it is a data pipeline used for bidirectional communication between the IO module and the protocol application. One end of the target data pipeline is connected to the IO module, and the other end is connected to the protocol application. The IO module transmits messages to the protocol application through the target data pipeline, and the protocol application can also send messages back to the IO module through the target data pipeline.

[0078] In this optional embodiment, the distribution rule to be registered corresponding to the protocol application is first determined. Then, the distribution rule to be registered is compared with the registered rules in the distribution rule library to obtain the registration determination result. Based on this, the pipeline determination operation corresponding to the registration determination result is executed. When the same rule already exists in the distribution rule library, the existing data pipeline is reused to avoid the waste of resources caused by repeatedly creating data pipelines for the same filtering rule. When the same rule does not exist in the distribution rule library, a new data pipeline is created to ensure that the protocol application can obtain a dedicated target data pipeline. Based on the target data pipeline, the update protocol message is forwarded to the protocol application in the main execution body.

[0079] As an optional implementation, for any one of the registered rules, the message content of the uplink protocol message is matched with any one of the registered rules in the following manner: If any one of the registered rules includes multiple sub-rules, according to the execution order of the multiple sub-rules, for any one of the multiple sub-rules, the content to be matched in the uplink protocol message is matched with the reference content in any one of the sub-rules for content consistency matching, until the target condition is met, and the matching result between any one of the registered rules and the uplink protocol message is obtained. Here, the content to be matched is the content in the message content of the uplink protocol message at the position to be matched corresponding to any one of the sub-rules. Any one of the sub-rules includes the position to be matched and the reference content. The target condition includes any one of the following: the matching result is that the content to be matched is inconsistent with the reference content; multiple sub-rules have been executed.

[0080] This involves sub-rules, which are the smallest matching units in a registered rule. They specify the matching conditions that the byte content at a corresponding position in the uplink protocol message must meet. Each sub-rule includes two core elements: the position to be matched and the reference content. A registered rule consists of multiple sub-rules arranged in a specific execution order, and all sub-rules together constitute the complete matching conditions of that registered rule.

[0081] This involves the position to be matched, which is the position specified in each sub-rule where the content to be matched needs to be extracted in the uplink protocol message. Specifically, it is the number of offset bytes (i.e., byte offset) calculated from the beginning of the message.

[0082] This involves reference content, which is the reference byte content specified in the sub-rule and used for comparison with the content to be matched in the uplink protocol message. The length of the reference content is specified by the matching byte length field in the sub-rule, and its specific value is the expected message byte content to be matched (such as protocol number, port number, or flag combination). The sub-rule is considered a successful match only if the byte content at the position to be matched in the uplink protocol message is exactly the same as the reference content.

[0083] This involves the content to be matched, which is the actual byte content at the corresponding match position extracted from the uplink protocol message based on the match position for each sub-rule. Its length is consistent with the matching byte length specified in the sub-rule. The content to be matched is the actual comparison object during the matching process. By comparing its content consistency with the reference content, it is determined whether the sub-rule matched successfully. The extraction position of the content to be matched is determined by the match position, and the extraction length is determined by the matching byte length in the sub-rule.

[0084] This involves target conditions, which are the conditions for terminating the matching process of the currently registered rule, used to determine whether to continue processing subsequent sub-rules or end the matching process. Target conditions include any of the following: the matching result is that the content to be matched is inconsistent with the reference content; multiple sub-rules have been executed. Specifically, if the matching result is that the content to be matched is inconsistent with the reference content, the matching process of the currently registered rule is immediately terminated, and the registered rule is determined not to match the uplink protocol message; if all sub-rules have been executed and all match consistently, the registered rule is determined to match the uplink protocol message.

[0085] In this optional embodiment, for any registered rule in the distribution rule base, according to the execution order of the multiple sub-rules contained in the rule, the message content corresponding to the position to be matched in the sub-rule is extracted from the uplink protocol message in turn, i.e., the content to be matched. The content to be matched is compared with the reference content in the sub-rule. If the matching result of a sub-rule is inconsistent, the processing of the current rule is stopped, which can quickly eliminate mismatched rules and avoid consuming too much processing time for invalid matching operations on the same message. If all sub-rules of the current rule are matched, it is determined that the uplink protocol message matches the registered rule, and the matching process ends immediately. This ensures that the matching process terminates after hitting the first completely matched rule, avoiding conflicts between rules and improving matching efficiency.

[0086] As an optional embodiment, the method further includes: receiving a downlink protocol message, wherein the downlink protocol message includes a protocol message to be synchronized and a second message header, the second message header including a status identifier and a destination interface address, the status identifier being used to distinguish between the primary executor and the backup executor; copying the downlink protocol message M times to obtain M first protocol messages, wherein the primary status corresponds to the status of the primary executor; changing the destination interface address corresponding to each of the M first protocol messages to the synchronization interface address corresponding to the corresponding backup executor, respectively, to obtain M second protocol messages; distributing the protocol message to be synchronized in the corresponding second protocol message to the corresponding backup executor according to the corresponding synchronization interface address, to obtain a synchronization result; determining whether the status identifier in the second message header is the primary status, and if the status identifier is the primary status, distributing the protocol message to be synchronized in the downlink protocol message based on the synchronization result and the destination interface address.

[0087] This involves downlink protocol messages, which are routing protocol messages determined based on the synchronization protocol messages issued by the execution body of the control plane. Specifically, after the execution body issues the synchronization protocol messages, the synchronization protocol messages are sent to the kernel protocol stack via the operating system socket interface through the protocol application on the execution body. The kernel protocol stack passes the synchronization protocol messages to the virtual service interface corresponding to the physical service interface. After the IO module on the execution body reads the synchronization protocol messages through the virtual service interface, it adds a second message header (containing a status identifier and a destination interface address) to the front of the synchronization protocol messages to obtain the downlink protocol messages.

[0088] This involves a synchronization protocol message, which is a routing protocol message issued by the control plane execution body.

[0089] This involves a second header, which is a custom header in the downlink protocol message. Specifically, this second header can be a custom header added by the IO module to the front end of the protocol message to be synchronized, used to carry the forwarding control information required for the transmission of the downlink protocol message in the device's internal network channel. The second header includes a status identifier and a destination interface address.

[0090] This involves a status identifier, which is the message flag field in the second message header. This identifier identifies whether the executor sending the downlink protocol message is the primary or backup executor. Specifically, the IO module can fill in this information based on the role of the current executor when adding the second message header. The status identifier is the basis for the data plane protocol message processing module to determine whether to send the downlink protocol message outward through the physical service interface: if the status identifier is primary, the protocol message processing module will send the protocol message to be synchronized to the external associated router through the physical service interface; if the status identifier is backup, the protocol message processing module will not send the message to the external associated router.

[0091] This involves the destination interface address, which is the physical service interface address in the second header. This address indicates which physical service interface on the data plane the downlink protocol message ultimately needs to be sent to the external associated router via. Specifically, the destination interface address is the Media Access Control (MAC) address of the physical service interface on the data plane. This address is determined and filled in by the IO module on the main execution unit when adding the second header, based on the physical service interface corresponding to the virtual service interface from which the synchronization protocol message originates.

[0092] This involves M first protocol messages, which are message copies obtained by copying the downlink protocol messages M times. The content of the first protocol messages is exactly the same as that of the downlink protocol messages.

[0093] This involves the synchronization interface address, which is the hardware address of the direct physical network interface connecting each backup executor in the control plane to the internal network channel of the device. Specifically, it is the Media Access Control (MAC) address of the direct physical network interface. The synchronization interface address uniquely identifies the communication endpoint of each backup executor in the internal network channel of the device. The protocol message processing module in the data plane fills this address into the destination interface address field of the first protocol message, directing the message to the corresponding backup executor. Each backup executor has a unique and fixed synchronization interface address, which is different from the direct physical interface address of the primary executor in the address space.

[0094] This involves M second protocol messages, which are update messages obtained by modifying the destination interface address in the first protocol message to the corresponding synchronization interface address of the backup executor.

[0095] In this optional embodiment, after receiving the downlink protocol message, the protocol message processing module copies the downlink protocol message M times to obtain M first protocol messages. Then, it changes the destination interface address of each of the M first protocol messages to the synchronization interface address corresponding to each backup executor, obtaining M second protocol messages. The module then distributes the corresponding synchronization protocol messages from the second protocol messages to each backup executor according to the synchronization interface address, ensuring that all backup executors receive the synchronization protocol messages sent by the master executor, thus ensuring that the routing protocol state between the backup executors and the master executor remains synchronized in real time. Simultaneously, it determines the status identifier in the second message header. When the status identifier is in the master state, it distributes the synchronization protocol messages from the downlink protocol messages based on the synchronization result and the destination interface address. Since the messages are only sent to the external associated router when the status identifier is in the master state, it avoids routing protocol conflicts caused by backup executors sending messages incorrectly. Furthermore, since the messages are distributed to the backup executors before being distributed, it ensures that the backup executors receive the synchronization protocol messages before or simultaneously with the external associated router, avoiding the problem of inconsistent routing protocol states during master-backup switching due to backup executors not synchronizing in time.

[0096] As an optional embodiment, based on the synchronization result and the destination interface address, the protocol messages to be synchronized in the downlink protocol messages are distributed, including: if the synchronization result includes an adjudication result, determining whether the adjudication result is a predetermined result, and if the adjudication result is a predetermined result, distributing the protocol messages to be synchronized in the downlink protocol messages according to the destination interface address, wherein the adjudication result is determined in the following way: determining the output messages of M backup executors in the target scenario, wherein the target scenario is a scenario in which the main executor sends downlink protocol messages; performing consistency adjudication between the output messages corresponding to the M backup executors and the downlink protocol messages respectively to obtain the adjudication result.

[0097] This involves synchronization results, which are a set of feedback information obtained after distributing the second protocol message to M backup executors. These results indicate whether each backup executor has successfully received and processed the protocol message to be synchronized. Specifically, the synchronization results include the reception status of each backup executor (e.g., successful reception, no response after timeout), and the output messages of the backup executors in the target scenario. The synchronization results serve as the foundational data source for subsequent adjudication and message distribution decisions.

[0098] This involves the adjudication result, which is the judgment information obtained after adjudicating the consistency of the output messages and downlink protocol messages of the M backup executors in the target scenario. It is used to indicate whether the output messages of each backup executor are consistent with the downlink protocol messages sent by the main executor.

[0099] This involves a predetermined result, which indicates that the output messages of the M backup executors in the target scenario are completely consistent with the downlink protocol messages sent by the primary executor. The predetermined result is a prerequisite for the protocol message processing module to allow the protocol messages to be synchronized in the downlink protocol messages to be sent to the external associated router through the physical service interface. Only when the decision result is the predetermined result will the protocol message processing module perform subsequent message distribution operations, thereby ensuring that the protocol messages sent by the primary executor have been correctly synchronized and verified in the backup executors.

[0100] This involves the target scenario, which is the operational scenario where the main executor sends downlink protocol messages.

[0101] This involves output messages, which are routing protocol messages generated by the corresponding backup executors after processing the received downlink protocol messages in the target scenario.

[0102] In this optional embodiment, by determining the output packets of M backup executors in the target scenario and performing consistency adjudication between the output packets of the M backup executors and the downlink protocol packets to obtain the adjudication results, the synchronized state of the backup executors can be verified. Then, it is determined whether the adjudication result is a predetermined result. Only when the adjudication result is a predetermined result, i.e., the output packets of all backup executors are consistent with the downlink protocol packets, are the packets to be synchronized in the downlink protocol packets distributed according to the destination interface address. This ensures that the packets to be synchronized sent by the main executor have been correctly synchronized and verified in the backup executors before being sent out, avoiding abnormal outputs of the main executor being directly sent to external associated routers, thereby improving the security and reliability of packet distribution.

[0103] Based on the above embodiments and optional embodiments, an optional implementation method is provided, which is described in detail below.

[0104] In related technologies, to reduce the risk of single-point failure of control plane executors, a distributed deployment approach is typically used to horizontally scale the control plane executors, i.e., multiple independent executors constitute a redundant control plane. However, in these technologies, when routers using distributed deployment perform packet distribution, there is a technical problem of poor coordination among multiple executors, leading to unreliable packet distribution.

[0105] Example: When adopting a distributed deployment, the control plane execution can be horizontally scaled, which improves the reliability of router devices to some extent, but the following core technical issues still exist:

[0106] 1) Lack of user space control over kernel protocol stack messages:

[0107] The relevant technologies do not have the ability to perform bidirectional input / output control of packets between the network interface card (NIC) and the kernel protocol stack in user space. When implementing protocol proxy, intermediate node devices need to be introduced to monitor and control packets, which makes the overall complexity and deployment difficulty too high.

[0108] 2) The horizontally expanded control plane execution entities lack the ability to synchronize routing protocol states in real time:

[0109] In related technologies, control plane executors can be horizontally expanded, but real-time synchronization of routing protocol states between control plane executors cannot be achieved, which will cause routing oscillations when switching between primary and backup executors.

[0110] 3) Lack of ability to monitor and adjudicate the output of the main execution unit of the control plane:

[0111] In related technologies, there is a lack of ability to monitor and adjudicate the output of routing protocol messages of the main execution unit of the control plane, and it is impossible to monitor and correct abnormal outputs of the main execution unit of the control plane, resulting in a lack of security.

[0112] There is currently no effective solution to the above problems.

[0113] In view of this, an optional embodiment of the present invention provides a packet distribution method for a router, which can effectively solve the above-mentioned technical problems.

[0114] Figure 2 This is a schematic diagram of the packet distribution system architecture of a router in an optional embodiment of the present invention, such as... Figure 2 As shown, the packet distribution system architecture of a router includes a control plane and a data plane (i.e., data plane forwarding devices).

[0115] The control plane consists of N execution bodies, which are functionally equivalent. N is a positive integer greater than 1. The N execution bodies constitute an N-redundant control plane. At any given time, only one execution body is the master execution body (in working state), and the others are backup execution bodies (in offline state).

[0116] The N execution entities can be N independent physical execution entities, or N1 physical execution entities and N2 virtual execution entities, where the sum of N1 and N2 is N, and both N1 and N2 are greater than or equal to 0. The virtualization implementation methods for the virtual execution entities include, but are not limited to, virtual machines, containers, and operating system namespaces.

[0117] Among them, N actuators and data planes are all connected to the internal network channel of the device through direct physical network interfaces (direct connection ports), forming direct internal network data transmission channels between actuators and between actuators and data planes.

[0118] For each of the N executors, the space is divided into user space and kernel space. Each executor deploys an I / O module, a protocol application, and a protocol proxy. Additionally, each executor may optionally deploy an output adjudicator. Specifically, the protocol application, protocol proxy, and output adjudicator are deployed in the user space of each executor in the control plane, while the I / O module is deployed in the kernel space of each executor in the control plane.

[0119] In each execution unit, virtual service interfaces [vp-0, vp-1, …, vp-n] are generated in the kernel space of the control plane based on the hardware configuration information of the data plane. These virtual network interfaces are mapped one-to-one with the physical service interfaces [wp-0, wp-1, …, wp-n] on the data plane through their numbers [0, 1, …, n]. In other words, the virtual service interfaces correspond one-to-one with the physical service interfaces on the data plane, where n is the total number of interfaces.

[0120] The I / O module runs in kernel space. A bidirectional data channel is established between the I / O module and the virtual network interface for transmitting routing protocol messages (also known as network messages). A bidirectional data channel is also established between the I / O module and the directly connected physical network interface for transmitting routing protocol messages. A one-to-one bidirectional data pipe is established between the I / O module and user-space programs (i.e., protocol proxy programs and / or output decision programs) (i.e., one bidirectional data pipe per user-space program) for registering protocol message filtering rules (i.e., distribution rules) with the I / O module and for transmitting routing protocol messages.

[0121] The data plane contains a protocol message processing module and a hardware abstraction layer.

[0122] The protocol message processing module operates in the user space of the data plane. A bidirectional data channel is established between the protocol message processing module and the directly connected physical network interface for transmitting routing protocol messages. The protocol message processing module is responsible for copying and distributing uplink protocol messages from the data plane to all executors, and for copying and distributing downlink protocol messages issued by the primary executor out of N executors to the other executors (i.e., M backup executors). It also sends the downlink protocol messages from the primary executor outward from the corresponding physical service interface through the hardware abstraction layer interface. N is an integer greater than 1, and M is N-1.

[0123] The hardware abstraction layer provides a unified hardware operation interface and data transmission interface for forwarding devices, shielding the differences in underlying forwarding hardware implementations to adapt to different forwarding hardware.

[0124] Through the collaborative work of the above modules, peer-to-peer routing protocol message distribution and processing are realized, providing core technical support for the horizontal expansion of the router control plane, real-time synchronization of routing protocol status, and input / output adjudication of the control plane execution body. This enhances the security and stability of the control plane, reduces the risk of single point of failure of the control plane, improves the overall stability of the router device, and eliminates routing oscillations caused by control plane execution body switching.

[0125] Figure 3 This is a schematic diagram of the uplink protocol message distribution process in an optional embodiment of the present invention, such as... Figure 3 As shown, taking the upstream protocol message as a BGP protocol message (denoted as message 1) as an example, the specific steps are as follows:

[0126] Su1, the physical service interface on the data plane receives message 1 sent by the associated router (another router that has established a routing protocol peering relationship with the current router).

[0127] Su2, the hardware abstraction layer on the data plane receives message 1 and transmits message 1 to the protocol message processing module through the channel file descriptor [port_fd] corresponding to the business interface data channel of the hardware abstraction layer.

[0128] Su3, after receiving message 1, the protocol message processing module on the data plane matches the message content of message 1 with the registered rules in the distribution rule base to obtain the rule matching result. If the rule matching result shows that there is a target distribution rule (such as a BGP filtering rule corresponding to the BGP protocol message) in the distribution rule base that matches the message content of message 1, message 1 is copied N times to obtain N protocol messages to be distributed. A first message header is added to each of the N protocol messages to be distributed to obtain N update protocol messages (denoted as message 2). The first message header includes the direct physical interface address of the executor of the corresponding protocol message to be distributed. According to the direct physical interface address in the first message header of the N messages 2, the corresponding message 2 is distributed to the N executors respectively.

[0129] Specifically, taking the filtering rules in the filtering rule chain as an example, if the rule matching result shows that there is a BGP filtering rule in the filtering rule chain that matches the message content of the uplink protocol message, the protocol message processing module generates a custom message header as the first message header. In this first message header, [dst_mac] is filled with the address of the direct physical network interface (referred to as the direct interface) of the corresponding execution entity, that is, the destination interface address, specifically the media access control (MAC) address of the direct interface; [src_mac] is filled with the MAC address of the data plane's own direct interface; [mca_id] is the execution entity number of the control plane, which is filled with 0; and [payload_length] is filled with the total number of bytes of the Ethernet message of message 1. Message 1 is added as the message payload to the end of the custom message header to obtain message 2. The protocol message processing module sends message 2 to all execution entities through the corresponding direct physical network interface.

[0130] Figure 4 This is a schematic diagram of the rule matching process for message content in an optional embodiment of the present invention, such as... Figure 4 As shown, for any one of the registered rules, the message content of the uplink protocol message is matched with any one of the registered rules in the following way:

[0131] When any registered rule includes multiple sub-rules, following the execution order of the sub-rules, for any one of the sub-rules, the content to be matched in the uplink protocol message is matched against the reference content in any one of the sub-rules for content consistency matching, until the target condition is met, thus obtaining the matching result between any registered rule and the uplink protocol message. The content to be matched is the content in the uplink protocol message message at the position corresponding to the sub-rule to be matched. Each sub-rule includes the position to be matched and the reference content. The target condition includes any one of the following:

[0132] The matching result is that the content to be matched does not match the reference content;

[0133] Multiple sub-rules have been executed.

[0134] Based on the above, the I / O module on the control plane execution unit transmits protocol messages to the user space process according to the registered filtering rules (i.e., registered rules), and the protocol message processing module on the data plane (DP) distributes messages to the control plane according to the filtering rules (i.e., registered rules). A filtering rule specifies the matching rules for an Ethernet message. A single filtering rule [filter_rule] (i.e., sub-rule) consists of [filter_cnt, filter_list]. Here, [filter_cnt] is the number of elements in the filter array of the rule, and [filter_list] is the filter array. The filter [filter] content in the filter array [filter_list] is [offset, length, value], where [offset] is the offset in bytes when matching the message (i.e., the position to be matched), [length] is the length of the message bytes to be matched, and [value] is the byte content of the message to be matched (the length of the byte content is also length). Specifically, the filter array element [filter] in the filtering rule [filter_rule] is retrieved. Based on the packet offset, number of matching bytes, and matching byte content specified in the [filter] element, the corresponding content of the Ethernet packet is retrieved for byte matching. If no match is found, it means that the packet does not match the [filter_rule], and the processing ends. If a match is found, the next array element [filter] is retrieved and the process continues, and so on, until all filter array elements have been traversed and processed (that is, multiple sub-rules have been executed). If all filters match, it means that the packet matches the [filter_rule], and the processing ends.

[0135] This abstract filtering rule provides dynamic support for routing protocols and allows for customized processing of corresponding routing protocol packets.

[0136] Su4, message 2 reaches the direct network ports of each actuator on the control plane via the internal network channel of the device.

[0137] Su5, the I / O modules on each execution body of the control plane read message 2 through the local direct network port.

[0138] Figure 5 This is a schematic diagram of the internal architecture of the IO module in an optional embodiment of the present invention, such as... Figure 5 As shown.

[0139] The IO module is deployed in the control plane execution unit and runs in the kernel space. The IO module includes a business interface management module, a data pipeline management module, and a message sending and receiving control module.

[0140] The business interface management module is used to maintain the business interface mapping table. The business interface mapping table specifically includes an interface identifier mapping table and a file descriptor mapping table. The key of the file descriptor mapping table is the business interface channel file descriptor, and the value is the virtual business interface name and the business interface number.

[0141] Using the interface identifier mapping table as the port_id mapping table and the file descriptor mapping table as the port_fd mapping table as an example: Specifically:

[0142] The port_id mapping table key is the service interface number [port_id], and the value is [port_name, port_fd], where [port_name] is the name of the virtual service interface in the kernel space of the control plane, and [port_fd] is the file descriptor corresponding to the service interface data channel.

[0143] The port_fd mapping table key is the file descriptor [port_fd] corresponding to the service interface data channel, and the value is [port_name, port_id], where [port_name] is the name of the virtual service interface in the kernel space of the control plane, and [port_id] is the service interface number.

[0144] When a virtual business interface is created, the business interface management module adds corresponding mapping table entries to the port_id mapping table and the port_fd mapping table;

[0145] When a business interface is deleted, the business interface management module deletes the corresponding mapping table entries from the port_id mapping table and the port_fd mapping table.

[0146] When the IO module starts, it generates virtual service interfaces [vp-0, vp-1, …, vp-n] in the kernel space of the control plane based on the hardware configuration information of the data plane. These virtual network interfaces are mapped one-to-one with the physical service interfaces [wp-0, wp-1, …, wp-n] on the data plane through their numbers [0, 1, …, n]. In other words, the virtual service interfaces correspond one-to-one with the physical service interfaces on the data plane.

[0147] When creating and opening a virtual service interface, the IO module generates a corresponding channel file descriptor [port_fd] for the service interface data channel and binds it to the virtual service interface. Bidirectional data interaction is then performed between the [port_fd] and the virtual service interface. During virtual service interface creation, the virtual service interface name and MAC address are automatically generated according to a unified rule based on [port_id], ensuring uniqueness. Simultaneously, it ensures that the virtual service interface name and MAC address on the control plane correspond one-to-one with the physical service interface name and MAC address on the data plane.

[0148] The virtual service interface created by the IO module connects to the kernel protocol stack on one end and the IO module on the other. That is, when the kernel protocol stack sends protocol messages through the virtual service interface, the protocol messages are received by the IO module; conversely, when the IO module sends protocol messages to the virtual service interface, the protocol messages are received by the kernel protocol stack.

[0149] The data pipeline management module is used to maintain a linked list of data pipelines that communicate bidirectionally with user space programs (such as protocol proxy programs and output adjudication programs).

[0150] Specifically, the data pipe linked list stores data pipe elements [pipe_item]. Each [pipe_item] stores data as [filter_rule, pid, pipe_fd], where [filter_rule] is the message filtering rule, [pid] is the process ID of the user-space program that registered the element, and [pipe_fd] is the pipe file descriptor used for communication with the user-space program that registered the element. Data pipes are bound to user-space processes, enabling bidirectional communication between the kernel-space I / O module and the user-space process.

[0151] In Su6, the I / O modules on each execution unit of the control plane match the message content of message 2 with the filtering rules in the data pipeline chain (i.e., the registered rules in the distribution rule base). If a BGP filtering rule corresponding to the BGP protocol message matches the message content of message 2, the corresponding pipe file descriptor [pipe_fd] is determined. This pipe file descriptor [pipe_fd] is registered by the protocol agent program (in this case, the BGP agent process), and message 2 is transmitted to the BGP agent process through this pipe file descriptor. For details, please refer to the matching logic with the protocol message processing module, which will not be elaborated further.

[0152] Su7: The BGP agent process on each execution body of the control plane receives message 2 through the corresponding target data pipe and performs message proxy operation on message 2 according to its own logic. The message proxy operation includes either message processing operation or message discarding operation (that is, the BGP agent process can also discard the message, thereby blocking the message from being sent to the local virtual service interface).

[0153] Furthermore, message processing operations include any of the following:

[0154] When the corresponding executor is the backup executor, the state synchronization of the routing protocol update is performed on the backup executor according to the corresponding message 2, including: modifying messages and storing messages according to the process logic of the BGP agent process;

[0155] With the corresponding execution unit as the main execution unit, message 2 is sent back to the IO modules on each execution unit via the target data pipe. After receiving message 2 through the corresponding target data pipe, the IO modules on each execution unit in the control plane determine the corresponding service interface number [port_id] in the custom message header of message 2. Based on the service interface number [port_id], they search for the matching channel file descriptor [port_fd] (i.e., the target identifier) ​​in the port_id mapping table, and then strip the custom message header from message 2 to obtain message 1 sent by the associated router. The IO module sends message 1 to the virtual service interface corresponding to the corresponding channel file descriptor [port_fd] through the virtual service interface address, and the kernel protocol stack receives message 1 through the virtual service interface and passes message 1 to the BGP application process (i.e., the BGP process). After completing the transmission of message 1, message 1 sent by the associated router to the current router finally reaches the BGP application process on the main execution unit, so as to realize the routing protocol update and forward the corresponding update protocol message to the protocol application in the main execution unit.

[0156] Before sending message 2 back to the IO module, the process also includes modifying the message and storing the message according to the process logic of the BGP agent process.

[0157] Specifically, when routing protocol messages are transmitted between the virtual service interfaces of the control plane and the physical service interfaces of the data plane, a custom Ethernet header is added so that the IO module and the protocol message processing module can identify and distribute them to the corresponding service interfaces. The custom Ethernet header structure is [dst_mac, src_mac, type, port_id, mca_id, pkt_flags, payload_length], where [dst_mac] is the 6-byte destination MAC address, [src_mac] is the 6-byte source MAC address, [type] is the 2-byte message type, [port_id] is the 4-byte service port number, [mca_id] is the 1-byte execution entity number (each execution entity number in the control plane is unique), [pkt_flags] is the status flag, specifically the 2-byte message flags value, and [payload_length] is the 2-byte length of the message payload data. The payload data following the custom Ethernet header is the original Ethernet protocol message.

[0158] Figure 6 This is a schematic diagram of the data pipeline registration process in an optional embodiment of the present invention, such as... Figure 6 As shown, before searching for the matching channel file descriptor [port_fd] (i.e., the target identifier) ​​in the port_id mapping table based on the business interface number [port_id], the target data pipeline is determined in the following way:

[0159] Determine the message matching filtering rule [filter_rule] corresponding to the protocol application, and denot it as the distribution rule to be registered;

[0160] User-space programs call the IO module function interface to pass the distribution rules to be registered to the data pipeline management module and apply for registration of the data pipeline. That is, user-space programs, such as protocol proxy programs and output adjudication programs, register the data pipeline with the IO module through the function interface provided by the IO module according to the message type to be processed. When registering, the message matching filter rule [filter_rule], that is, the distribution rule to be registered, must be provided.

[0161] The data pipeline management module determines whether there is a registered rule identical to the one to be registered in the distribution rule base based on the distribution rule to be registered passed in by the user space program, and obtains the registration confirmation result;

[0162] If the registration result indicates that a registered rule identical to the distribution rule to be registered already exists in the distribution rule base, the registration failure is returned, and the data pipeline corresponding to the registered rule is reused as the target data pipeline.

[0163] If the registration result indicates that there is no registered rule identical to the distribution rule to be registered in the distribution rule base, a new data pipeline is created as the target data pipeline. Creating a new data pipeline includes:

[0164] Based on the distribution rules to be registered, a new data pipeline element [pipe_item] is created, and the [pipe_item] is added to the distribution rule library (specifically, the data pipeline linked list). The distribution rule to be registered is then sent to the data plane protocol message processing module, and the pipeline file descriptor [pipe_fd] is returned to the user space program.

[0165] Figure 7 This is a schematic diagram of the downlink protocol message distribution process in an optional embodiment of the present invention, such as... Figure 7 As shown, the following example uses a BGP protocol message (denoted as message 3) as the general downstream protocol message, and Executor 1 (main state) as the main executor. The BGP application on Executor 1 calls the operating system socket interface to send message 3. After being processed by the kernel protocol stack on the control plane, message 3 is sent outward through the virtual service network interface. The specific steps are as follows:

[0166] Sd1, the IO module on execution body 1 reads packet 3 through the channel file descriptor [port_fd] corresponding to the virtual service interface. The IO module looks up the port_fd mapping table based on the [port_fd] to obtain the [port_id] corresponding to the service network interface; and looks up the filtering rules in the data pipeline chain based on the content of packet 3 to match the pipe file descriptor [pipe_fd] registered by the BGP agent process (i.e., the BGP agent program).

[0167] In Sd2, the IO module on Executor 1 adds a custom header to message 3 as a second header. In the custom header, [dst_mac] is the MAC address of the data plane directly connected interface; [src_mac] is the MAC address of Executor 1's own directly connected interface; [port_id] is the [port_id] value obtained in the previous step; [mca_id] is the identifier (ID) of Executor 1; [pkt_flags] marks the primary / backup status of Executor 1; and [payload_length] is the total number of bytes in this downlink BGP Ethernet packet. Message 3 is appended as payload data to the end of the custom header, resulting in message 4. The IO module then transmits message 4 to the BGP agent process through the pipe file descriptor [pipe_fd] obtained in the previous step.

[0168] Sd3, the BGP agent process on execution body 1 receives message 4 through the data pipe, processes the message according to its own logic (e.g., modifies the message content, stores the message, etc.), and then passes it back to the IO module through the data pipe. The BGP agent process can also discard the message, thereby blocking the message from being sent out. (The interaction between the BGP agent process and the IO module here can be referred to in the interaction between the BGP agent process and the IO module in the uplink protocol message, and will not be repeated here).

[0169] Sd4, the IO module on execution body 1 receives message 4 through the data pipeline and sends message 4 directly to the data plane through the direct connection network port corresponding to execution body 1.

[0170] Sd5, message 4, arrives at the direct-connect port on the data plane via the device's internal network channel.

[0171] Sd6, the protocol message processing module on the data plane reads message 4.

[0172] Sd7, the protocol message processing module copies message 4 M times to obtain M first protocol messages, denoted as M messages 5. After modifying the destination interface address in the [dst_mac] of the custom message header of message 5 to the synchronization interface address of other executors (i.e., the M backup executors) (specifically the MAC address of the directly connected network interface), M second protocol messages are obtained, denoted as M messages 6. Message 6 is sent to other executors except executor 1 through the corresponding directly connected network interface.

[0173] Sd8, message 6 reaches the direct network port of other actuators on the control plane via the internal network channel of the device.

[0174] Sd9, the IO modules on other execution units receive message 6 through their own direct network ports.

[0175] In Sd10, the IO modules on other execution units match the various rules in the data pipeline chain (i.e., the registered rules in the distribution rule base) based on the message content of message 6. If a BGP filtering rule is matched, the corresponding pipe file descriptor [pipe_fd] (obtained by the BGP agent process) is determined, and message 6 is transmitted to the BGP agent process through this pipe file descriptor [pipe_fd]. The BGP agent process receives message 6 through the corresponding data pipeline, identifies message 3 in message 6 as originating from execution unit 1 based on the [mca_id] in the custom header, and processes the message accordingly (e.g., modifying message content, storing the message, etc.) before discarding it. The transmission of message 6 in this execution unit ends. The logic of the BGP agent process processing the message here can be referenced from the logic of the BGP agent process processing the message according to its own logic in the uplink protocol message, and will not be elaborated further.

[0176] Sd11, the protocol message processing module differentiates and processes messages based on the status flags [pkt_flags] in the custom message header of message 4:

[0177] If [pkt_flags] is marked as standby, it will not be sent to the associated router through the physical service network interface;

[0178] If [pkt_flags] indicates the primary state, then after stripping the custom header of message 4, message 3 is obtained. The corresponding hardware abstraction layer channel file descriptor [port_fd] is found in the port_id mapping table using the [port_id] in the custom header of message 4. The channel file descriptor [port_fd] is then used to call the hardware abstraction layer data transmission function interface to send message 3.

[0179] Sd12, the Hardware Abstraction Layer (HAL) sends message 3 to external neighbors through the corresponding physical service network interface. Message 3 completes the distribution and transmission between control plane executors and is sent to the associated router through the data plane physical service network interface. Message 3 sent by the BGP application on executor 1 is ultimately sent to the associated router through the data plane physical service network interface.

[0180] The distribution rule base is stored in the filter rule linked list and the data pipeline linked list, respectively. That is, the filter rules in the filter rule linked list are the registered rules in the distribution rule base, and the filter rules in the data pipeline linked list are also the registered rules in the distribution rule base.

[0181] Through the above steps, the protocol proxy program and output adjudication program on the control plane executor are equipped with the ability to control the transmission of output messages from the main executor, modify messages, and monitor message content. They are also equipped with the ability to monitor, compare, and adjudicate output messages from other executors, providing a technical foundation for real-time synchronization of protocol status and message comparison and adjudication between executors.

[0182] The above optional implementation methods can achieve at least the following beneficial effects:

[0183] (1) Match the content of the received uplink protocol message with each registered rule in the distribution rule base to determine whether there is a target distribution rule in the distribution rule base that matches the message content; only if the match is successful will the uplink protocol message be copied and distributed, which can avoid irrelevant messages occupying the processing resources of the execution body; after the match is successful, the uplink protocol message is copied N times and a first message header containing the direct physical interface address is added to each of them, and the corresponding update protocol message is distributed to the N execution bodies of the control plane according to the direct physical interface address in the first message header, so that the main execution body and the M backup execution bodies can receive the uplink protocol message. Since the N execution bodies all receive the corresponding update protocol message, the update protocol message is distributed to the N execution bodies of the control plane according to the direct physical interface address in the first message header. Since the M backup executors receive the same uplink protocol messages, they can synchronously obtain the protocol message content received by the primary executor, thus maintaining a consistent routing protocol state with the primary executor. Furthermore, because the M backup executors are each used to replace the primary executor in protocol message interaction when the primary executor fails, they can seamlessly take over the protocol message interaction function when the primary executor fails after synchronizing the protocol message state. This solves the routing oscillation caused by inconsistent routing protocol states during handover due to the lack of uplink protocol messages in the backup executors, thereby improving the reliability of message distribution. This also solves the technical problem of unreliable message distribution in routers in related technologies.

[0184] (2) After receiving the downlink protocol message, the protocol message processing module copies the downlink protocol message M times to obtain M first protocol messages. Then, it changes the destination interface address of each of the M first protocol messages to the synchronization interface address corresponding to each backup executor to obtain M second protocol messages. The module then distributes the corresponding synchronization protocol messages in the second protocol messages to each backup executor according to the synchronization interface address, so that all backup executors can receive the synchronization protocol messages sent by the master executor, ensuring that the routing protocol status between the backup executor and the master executor is kept synchronized in real time. At the same time, it determines the status identifier in the second message header. When the status identifier is in the master state, it distributes the synchronization protocol messages in the downlink protocol message based on the synchronization result and the destination interface address. Since the message is only sent to the external associated router when the status identifier is in the master state, it can avoid routing protocol conflicts caused by the backup executor sending messages incorrectly. At the same time, since the message is distributed to the backup executor before the message is distributed, it can ensure that the backup executor receives the synchronization protocol messages before or in sync with the external associated router, avoiding the problem of inconsistent routing protocol status during master-backup switching due to the backup executor not synchronizing in time.

[0185] (3) By determining the output messages of M backup executors in the target scenario and performing consistency adjudication between the output messages of the M backup executors and the downlink protocol messages, the state of the backup executors after synchronization can be verified. Then, it is determined whether the adjudication result is the predetermined result. Only when the adjudication result is the predetermined result, that is, the output messages of all backup executors are consistent with the downlink protocol messages, are the messages to be synchronized in the downlink protocol messages distributed according to the destination interface address. This ensures that the messages to be synchronized sent by the main executor have been correctly synchronized and verified in the backup executors before being sent out, thus avoiding the abnormal output of the main executor being directly sent to the external associated router, thereby improving the security and reliability of message distribution.

[0186] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.

[0187] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.

[0188] Example 2

[0189] According to another aspect of the present invention, a packet distribution system for a router is also provided, comprising: a packet distribution module configured to implement the steps of any of the above-described packet distribution methods for a router.

[0190] Example 3

[0191] According to another aspect of the present invention, an electronic device is also provided, comprising: a processor; and a memory for storing processor-executable instructions, wherein the processor is configured to execute instructions to implement the packet distribution method of the router described above.

[0192] Example 4

[0193] According to another aspect of the present invention, a computer-readable storage medium is also provided, which, when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform the packet distribution method of the router described above.

[0194] Example 5

[0195] According to another aspect of the present invention, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps of the packet distribution method of the router described above.

[0196] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0197] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0198] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0199] The units described as separate components may or may not be physically separate. 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 units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0200] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0201] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0202] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A packet distribution method for a router, characterized in that, include: Receive uplink protocol messages; The message content of the uplink protocol message is matched with each registered rule in the distribution rule base to obtain the rule matching result; If the rule matching result shows that there is a target distribution rule in the distribution rule base that matches the message content of the uplink protocol message, the uplink protocol message is copied N times to obtain N protocol messages to be distributed. Add a first message header to each of the N protocol messages to be distributed to obtain N update protocol messages, wherein the first message header includes the direct physical interface address of the execution body corresponding to the protocol message to be distributed; According to the directly connected physical interface address in the first message header corresponding to the N update protocol messages, the corresponding update protocol messages are distributed to the N execution entities respectively, so that the main execution entity updates the routing protocol of the router, and the M backup execution entities synchronize the routing protocol update status of the main execution entity. The N execution entities are deployed in the control plane of the router. The N execution entities include the main execution entity and the M backup execution entities corresponding to the main execution entity. N is an integer greater than 1, and M is N-1.

2. The method according to claim 1, characterized in that, After distributing the corresponding update protocol messages to the N execution entities on the control plane according to the direct physical interface addresses in the first message headers of the N update protocol messages, the process includes: Determine the message proxy operation corresponding to each of the N executors, wherein the message proxy operation includes any one of the following: message processing operation, message discarding operation, so that when the message proxy operation is a message processing operation, the main executor performs routing protocol updates on the router, and the routing protocol update status of the M backup executors is synchronized with that of the main executor, and so that when the message proxy operation is a message discarding operation, the update protocol message is discarded; The message processing operation includes any of the following: When the corresponding executor is a backup executor, the backup executor is synchronized with the routing protocol update state according to the corresponding update protocol message; When the corresponding executor is the main executor, the service interface number corresponding to the physical service interface address in the header of the corresponding update protocol message is determined, and the target identifier corresponding to the corresponding update protocol message is matched from the interface identifier mapping table according to the service interface number; based on the virtual service interface address corresponding to the target identifier, the corresponding update protocol message is forwarded to the protocol application in the main executor, so as to update the routing protocol of the router through the protocol application. Here, the service interface number is used to uniquely identify the physical service interface address, the target identifier is used to uniquely identify the virtual service interface address, and the protocol application is an application that implements protocol message interaction.

3. The method according to claim 2, characterized in that, Based on the virtual service interface address corresponding to the target identifier, the corresponding update protocol message is forwarded to the protocol application in the main execution body, including: Determine the registration and distribution rules corresponding to the protocol application; Determine whether there exists a registered rule identical to the distribution rule to be registered in the distribution rule base, and obtain the registration determination result; Perform the pipeline determination operation corresponding to the registration determination result to obtain the target data pipeline; Based on the target data pipeline and the virtual service interface address corresponding to the target identifier, the corresponding update protocol message is forwarded to the protocol application in the main execution body.

4. The method according to claim 3, characterized in that, The process of performing the pipeline determination operation corresponding to the registration determination result to obtain the target data pipeline includes: If the registration determination result is that there is a registered rule in the distribution rule base that is the same as the distribution rule to be registered, the data pipeline corresponding to the registered rule is reused as the target data pipeline. If the registration determination result is that there is no registered rule in the distribution rule base that is the same as the distribution rule to be registered, a new data pipeline is created as the target data pipeline.

5. The method according to claim 1, characterized in that, The method further includes: Receive downlink protocol messages, wherein the downlink protocol messages include a synchronization protocol message and a second message header, the second message header including a status identifier and a destination interface address, the status identifier being used to distinguish between the primary executor and the backup executor; The downlink protocol message is copied M times to obtain M first protocol messages, wherein the main state is the state corresponding to the main execution body; The destination interface addresses corresponding to the M first protocol messages are respectively changed to the synchronization interface addresses corresponding to the corresponding backup execution entities to obtain M second protocol messages; According to the corresponding synchronization interface address, the corresponding second protocol message to be synchronized is distributed to the corresponding backup execution body to obtain the synchronization result; Determine whether the status identifier in the second message header is in the primary state, and if the status identifier is in the primary state, distribute the protocol messages to be synchronized in the downlink protocol messages based on the synchronization result and the destination interface address.

6. The method according to claim 5, characterized in that, The step of distributing the protocol messages to be synchronized in the downlink protocol messages based on the synchronization result and the destination interface address includes: If the synchronization result includes an adjudication result, it is determined whether the adjudication result is a predetermined result. If the adjudication result is a predetermined result, the protocol messages to be synchronized in the downlink protocol messages are distributed according to the destination interface address. The adjudication result is determined in the following way: Determine the output messages of the M backup executors in the target scenario, wherein the target scenario is the scenario in which the main executor sends the downlink protocol message; The output messages corresponding to the M backup executors are respectively matched with the downlink protocol messages to determine consistency, and the result of the matching is obtained.

7. The method according to any one of claims 1 to 6, characterized in that, For any one of the registered rules, the message content of the uplink protocol message is matched with any one of the registered rules in the following manner: When any of the registered rules includes multiple sub-rules, in accordance with the execution order of the multiple sub-rules, for any one of the multiple sub-rules, the content to be matched in the uplink protocol message is matched with the reference content in the same sub-rule for content consistency matching until the target condition is met, thereby obtaining the matching result between the registered rule and the uplink protocol message. The content to be matched is the content in the uplink protocol message at the position corresponding to the sub-rule to be matched. Each sub-rule includes the position to be matched and the reference content. The target condition includes any one of the following: The matching result is that the content to be matched is inconsistent with the reference content; All the sub-rules have been executed.

8. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the packet distribution method of the router as described in any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is able to perform the packet distribution method of the router as described in any one of claims 1 to 7.

10. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the steps of the packet distribution method of the router as described in any one of claims 1 to 7.