Routing protocol process processing method and device, equipment and storage medium

By establishing an inter-process session between the main dashboard protocol process and the backup protocol session process in a network device, backing up the target protocol session information, and when the main dashboard protocol process is interrupted, the backup protocol session process takes over the target protocol session, solving the problem of session interruption when the routing protocol process is restarted, improving the security and reliability of the session.

CN119544599APending Publication Date: 2025-02-28RUIJIE NETWORKS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311113285.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-31
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

The existing technology cannot effectively avoid protocol neighbor session interrupts when the routing protocol process is restarted, resulting in layer three routing interrupts and affecting data packet forwarding.

Method used

By pre-establishing an inter-process session between the main dashboard protocol process and the backup protocol session process in the network device, the target protocol session information is backed up, and the backup protocol session process takes over the target protocol session when the main dashboard protocol process is interrupted.

Benefits of technology

It realizes the security and reliability of the session when the routing protocol process is restarted, avoids session interruption and reduces memory consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119544599A_ABST
    Figure CN119544599A_ABST
Patent Text Reader

Abstract

The invention provides a routing protocol process processing method and device, equipment and a storage medium. The method comprises the following steps: establishing a first inter-process session between a main control board protocol process and a backup protocol session process; when a target protocol session is established between the main control board protocol process and the neighbor device, first session information of the target protocol session is transmitted to the backup protocol session process through the first inter-process session; establishing a first internal session corresponding to the target protocol session according to the first session information through the backup protocol session process, wherein the first internal session is configured to be in a non-response state; and when the main control board protocol process is interrupted, setting the first internal session to be in an enabling response state through the backup protocol session process, so that the backup protocol session process takes over the target protocol session through the first internal session. According to the method, the target protocol session is taken over through the backup protocol session process, the memory consumption is reduced, and the security and reliability of the session in the restarting process of the protocol process are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a method, device, equipment and storage medium for processing a routing protocol process. Background Art

[0002] In data communication networks, Layer 3 packets are forwarded through routing, and the Layer 3 routing information used to guide data packet forwarding mainly comes from the following aspects:

[0003] 1. The network segment routing of the configured interface.

[0004] 2. Through manually configured static routing.

[0005] 3. Routes dynamically learned through routing protocols.

[0006] Most of the routes are learned dynamically from routing protocols. When the routing protocol software on the network device fails and the routing protocol process is restarted, the routing protocol session will be interrupted, resulting in interruption of the three-layer routing and affecting the forwarding of user data packets.

[0007] There are currently several solutions to this problem:

[0008] 1) Routing protocol level graceful restart (GR, Graceful Restart)

[0009] When the routing protocol process is restarted, although the routing protocol session will be interrupted, the neighboring device still maintains the routing; after the process is restarted, the protocol neighbor session is re-established, and the neighboring device will assist the restarting device in restoring routing information until the recovery is consistent with the situation before the restart.

[0010] Disadvantages: This solution requires the process interaction between the device where the process is restarted and the neighboring devices according to the process defined in the protocol standard to ensure its complete recovery. However, in practice, compatibility issues often occur due to different understandings of the standards between different manufacturers, resulting in incomplete or impossible recovery. In addition, since the device where the process is restarted needs neighboring devices to assist in recovery, this technical solution cannot support the situation where multiple devices fail at the same time.

[0011] 2) Full protocol process backup

[0012] The protection is carried out through a complete hot backup mode of the routing protocol process. The backup routing protocol process has the same information as the original routing protocol process. When the original routing protocol process is restarted, the backup routing protocol is upgraded to the main routing protocol process to interact with external devices.

[0013] Disadvantage: Since the protocol process is fully backed up, the routing information that occupies the most memory will also exist twice in the system, resulting in doubling of the protocol's routing memory usage. In the case of the same routing volume, its memory cost doubles.

[0014] In addition: Since the protocol process is fully backed up, the backup protocol process has most of the same logic as the main protocol process. The same software failure may occur in both processes, and it is more likely that both processes will be restarted at the same time.

[0015] 3) Trigger the master-slave control board to switch to NSR protection

[0016] For devices with master-slave control boards and non-stop routing (NSR) protection, when a routing protocol process on the master control board restarts, the master-slave control board is directly triggered to switch, so that the routing protocol process on the slave control board is used for recovery.

[0017] Disadvantages: First, this technical solution is only useful when there are devices with master-slave control boards; second, similar to the full protocol process backup, since the slave-to-master protocol process is also fully backed up, the protocol process of the slave control board has most of the same logic as the protocol process of the master control board. The same software failure may occur in both processes, and there is a high possibility that both processes will be restarted at the same time.

[0018] 4) Sending of proxy protocol keep-alive messages

[0019] When the routing protocol process is restarted, the service board or the control board sends keep-alive messages on behalf of the routing protocol process, thereby ensuring that the neighboring device will not have a session timeout interruption problem due to failure to receive the keep-alive message.

[0020] Disadvantages: It can only ensure that neighbor devices will not be disconnected, but because the proxy itself does not process the protocol state machine, it cannot respond when the session is interrupted. The proxy does not receive and process the messages sent by the neighbor, so for the TCP-based routing protocol process, the TCP timeout may occur due to the lack of response TCPACK sequence number (the proxy does not receive the read message), resulting in the interruption of the routing protocol session.

[0021] It can be seen that how to ensure that the protocol neighbor session is not interrupted when the protocol process is restarted and improve the reliability of the routing protocol has become a technical problem that needs to be solved urgently. Summary of the invention

[0022] The main purpose of the embodiments of the present application is to provide a routing protocol process processing method, device, equipment and storage medium, so that when the main control board protocol process where the target protocol session is located is interrupted and restarted, the target protocol session is taken over by the backup protocol session process, thereby reducing memory consumption and improving the security and reliability of the session during the protocol process restart process.

[0023] In a first aspect, an embodiment of the present application provides a routing protocol process processing method, which is applied to a network device, wherein the network device includes a main control board protocol process and a backup protocol session process; the method includes: establishing a first inter-process session between the main control board protocol process and the backup protocol session process; when a target protocol session is established between the main control board protocol process and a neighboring device, passing the first session information of the target protocol session to the backup protocol session process through the first inter-process session; establishing a first internal session corresponding to the target protocol session according to the first session information through the backup protocol session process, and the first internal session is configured to be in an unresponsive state; when the main control board protocol process is interrupted, setting the first internal session to an enabled response state through the backup protocol session process, so that the backup protocol session process takes over the target protocol session through the first internal session.

[0024] In one embodiment, the first session information of the target protocol session is passed to the backup protocol session process through the first inter-process session, including: passing the identification information of the target protocol session to the backup protocol session process through the first inter-process session; and passing the first session information of the target protocol session to the backup protocol session process according to the identification information through the first inter-process session.

[0025] In one embodiment, the identification information of the target protocol session is passed to the backup protocol session process through the first inter-process session, including: passing the first identifier of the target protocol session to the protocol stack through the main control board protocol process; assigning a second identifier to the backup protocol session process according to the first identifier through the protocol stack, and associating the second identifier with the target protocol session; and passing the second identifier to the backup protocol session process through the protocol stack.

[0026] In one embodiment, before the first session information of the target protocol session is passed to the backup protocol session process according to the identification information through the first inter-process session, it also includes: setting the session associated with the second identifier to an unresponsive state to the protocol stack through the backup protocol session process; querying the protocol stack for the first identifier associated with the same session as the second identifier through the backup protocol session process; and the backup protocol session process storing the association relationship between the first identifier and the second identifier.

[0027] In one embodiment, the first session information of the target protocol session is passed to the backup protocol session process according to the identification information through the first inter-process session, including: carrying the first identifier in the first session information of the target protocol session through the main control board protocol process and passing it to the backup protocol session process.

[0028] In one embodiment, the establishing of the first internal session corresponding to the target protocol session according to the first session information through the backup protocol session process includes: parsing the first identifier carried in the first session information through the backup protocol session process, and searching for the second identifier locally associated with the first identifier; establishing the first internal session corresponding to the target protocol session according to the first session information through the backup protocol session process, and associating the first internal session with the second identifier.

[0029] In one embodiment, when the main control board protocol process is interrupted, the first internal session is set to an enabled response state through the backup protocol session process to take over the target protocol session, including: when the main control board protocol process is interrupted, the protocol stack notifies the backup protocol session process that the first inter-process session is disconnected; the backup protocol session process deletes the association relationship stored locally; the backup protocol session process sets the first internal session to the enabled response state to the protocol stack according to the second identifier; and the keep-alive processing of the target protocol session is started through the backup protocol session process.

[0030] In one embodiment, it also includes: when there is received data from the neighboring device in the protocol stack, determining whether there is a complete protocol message in the received data; if there is a complete protocol message in the received data, reading the complete protocol message from the protocol stack for protocol processing; if there is no complete protocol message in the received data, waiting for the protocol message in the received data to be complete, and then reading the complete protocol message from the protocol stack for protocol processing.

[0031] In one embodiment, the determining whether a complete protocol message exists in the received data includes: determining whether the message length of the received data is greater than or equal to the target protocol message header length; if the message length of the received data is greater than or equal to the target protocol message header length, pre-reading first data of the header length from the protocol stack; parsing the first data to obtain the target protocol message header; determining the complete length of the target protocol message according to the target protocol message header; determining whether the message length of the received data is greater than or equal to the complete length, if the message length of the received data is greater than or equal to the complete length, determining that a complete protocol message exists in the received data; if the message length of the received data is less than the target protocol message header length, or the message length of the received data is greater than or equal to the target protocol message header length, and the message length of the received data is less than the complete length, determining that a complete protocol message does not exist in the received data.

[0032] In one embodiment, after setting the first internal session to an enabled response state through the backup protocol session process to take over the target protocol session, reading the complete protocol message from the protocol stack for protocol processing includes: if the complete protocol message is a routing message, adding the complete protocol message to a shared queue of routing-related protocol messages to be processed through the backup protocol session process.

[0033] In one embodiment, it also includes: when the current network device sends the target message to the neighbor device, if the target message is not completely sent, the unsent data in the target message is added to the shared queue of messages to be sent, and retrying the sending of the unsent data is started.

[0034] In one embodiment, it also includes: after the main control board protocol process is restarted, the second session information of the target protocol session maintained by the backup protocol session process is passed to the main control board protocol process; a second internal session corresponding to the target protocol session is established by the main control board protocol process according to the second session information, and the second internal session is configured to be in an unresponsive state; a takeover request for the target protocol session is sent to the backup protocol session process by the main control board protocol process; the first internal session is set to an unresponsive state by the backup protocol session process; the takeover request is responded to by the backup protocol session process; and the second internal session is set to an enabled response state by the main control board protocol process, so that the main control board protocol process takes over the target protocol session through the second internal session.

[0035] In one embodiment, the network device also includes a slave control board protocol process; the method also includes: notifying the slave control board protocol process through the main control board protocol process to back up the target protocol session, and the slave control board protocol process backs up the information of the target protocol session and / or the routing information of the target protocol session; when the main control board protocol process is interrupted and restarted, the routing information of the target protocol session is synchronized to the main control board protocol process through the slave control board protocol process.

[0036] In a second aspect, an embodiment of the present application provides a routing protocol process processing device, which is applied to a network device, wherein the network device includes a main control board protocol process and a backup protocol session process; the device includes:

[0037] A first establishing module, used for establishing a first inter-process session between the main control board protocol process and the backup protocol session process;

[0038] A transfer module, used for transferring the first session information of the target protocol session to the backup protocol session process through the first inter-process session when the target protocol session is established between the main control board protocol process and the neighboring device;

[0039] A second establishing module, configured to establish a first internal session corresponding to the target protocol session according to the first session information through the backup protocol session process, wherein the first internal session is configured to be in an unresponsive state;

[0040] The takeover module is used to set the first internal session to an enabled response state through the backup protocol session process when the main control board protocol process is interrupted, so that the backup protocol session process takes over the target protocol session through the first internal session.

[0041] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0042] at least one processor; and

[0043] a memory communicatively coupled to the at least one processor;

[0044] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the electronic device to execute the method described in any one of the above aspects.

[0045] In a fourth aspect, an embodiment of the present application provides a cloud device, including:

[0046] at least one processor; and

[0047] a memory communicatively coupled to the at least one processor;

[0048] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the cloud device to execute any of the methods described above.

[0049] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the method described in any one of the above aspects is implemented.

[0050] In a sixth aspect, an embodiment of the present application provides a computer program product, including a computer program, which implements the method described in any of the above aspects when executed by a processor.

[0051] The routing protocol process processing method, apparatus, device and storage medium provided in the embodiments of the present application pre-establish a first inter-process session between the main control board protocol process and the backup protocol session process. When the network device establishes a target protocol session with the neighboring device, the first session information of the target protocol session is backed up to the backup protocol session process, that is, a first internal session corresponding to the target protocol session is established in the backup protocol session process, and the first internal session is kept in an unresponsive state during the normal operation of the main control board protocol process. When the main control board protocol process is interrupted, the backup protocol session process takes over the target protocol session by configuring the first internal session to enable response state, so that the backup protocol session process can send and receive protocol messages of the target protocol session and perform periodic keep-alive operations. In this way, there is no need to perform a full protocol process backup, which reduces memory consumption and improves the security and reliability of the protocol process interruption and restart process. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application. Obviously, the drawings described below are some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor.

[0053] Figure 1 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0054] Figure 2 A schematic diagram of a network topology structure in actual application of a routing protocol process processing solution provided in an embodiment of the present application;

[0055] Figure 3 A schematic diagram of a routing protocol process processing system scenario architecture provided in an embodiment of the present application;

[0056] Figure 4 A schematic diagram of a routing protocol process processing system scenario architecture provided in an embodiment of the present application;

[0057] Figure 5 A flowchart of a method for processing a routing protocol process provided by an embodiment of the present application;

[0058] Figure 6 A signaling interaction diagram of a routing protocol process processing method provided in an embodiment of the present application;

[0059] Figure 7 A schematic diagram of a main control board protocol process receiving a protocol message processing flow provided in an embodiment of the present application;

[0060] Figure 8 A schematic diagram of a BGP protocol message header provided in an embodiment of the present application;

[0061] Fig. 9 A schematic diagram of a protocol message sending mechanism flow provided in an embodiment of the present application;

[0062] Fig.10 A schematic diagram of a specific process of a backup protocol session process taking over a target protocol session 2 provided in an embodiment of the present application;

[0063] Fig.11 A schematic diagram of a process flow of receiving a protocol message by a backup protocol session process provided in an embodiment of the present application;

[0064] Fig.12 A schematic diagram of a new protocol process startup flow of a main control board provided in an embodiment of the present application;

[0065] Fig.13 A schematic diagram of the structure of a network device without a slave control board provided in an embodiment of the present application;

[0066] Fig.14 A schematic diagram of the structure of a routing protocol process processing device provided in an embodiment of the present application;

[0067] Fig.15 A schematic diagram of the structure of a cloud device provided in an embodiment of the present application.

[0068] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0069] Here, exemplary embodiments are described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application.

[0070] The term "and / or" in this article is used to describe the association relationship of associated objects, specifically indicating that there may be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.

[0071] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0072] In order to clearly describe the technical solution of the embodiment of the present application, the terms involved in the present application are first defined:

[0073] GR: Graceful Restart, graceful restart at the routing protocol level.

[0074] NSR: Non-Stop Routing.

[0075] TCP: Transmission Control Protocol.

[0076] ACK: Acknowledge, confirm the message.

[0077] Socket: socket.

[0078] BGP: Border Gateway Protocol.

[0079] IP: Internet Protocol, refers to the Internet interconnection protocol.

[0080] AS: Autonomous System, refers to a group of networks that use a unified internal routing protocol.

[0081] OSPF: Open Shortest Path First, OSPF routing protocol is a link state routing protocol used in Internet Protocol networks.

[0082] IS-IS, Intermediate system to intermediate system, intermediate system to intermediate system.

[0083] In data communication networks, Layer 3 packets are forwarded through routing, and the Layer 3 routing information used to guide data packet forwarding mainly comes from the following aspects:

[0084] 1. The network segment routing of the configured interface.

[0085] 2. Through manually configured static routing.

[0086] 3. Routes dynamically learned through routing protocols.

[0087] Most of the routes are learned dynamically from routing protocols. When the routing protocol software on the network device fails and the routing protocol process is restarted, the routing protocol session will be interrupted, resulting in interruption of the three-layer routing and affecting the forwarding of user data packets.

[0088] There are currently several solutions to this problem:

[0089] 1) Routing protocol level graceful restart (GR, Graceful Restart)

[0090] When the routing protocol process is restarted, although the routing protocol session is interrupted, the neighbor device still maintains the route. After the process is restarted, the protocol neighbor session is reestablished, and the neighbor device will assist the restarting device to restore the routing information until the recovery is consistent with the pre-restart.

[0091] Disadvantages: This solution requires the process interaction between the device where the process is restarted and the neighboring devices according to the process defined in the protocol standard to ensure its complete recovery. However, in practice, compatibility issues often occur due to different understandings of the standards between different manufacturers, resulting in incomplete or impossible recovery. In addition, since the device where the process is restarted needs neighboring devices to assist in recovery, this technical solution cannot support the situation where multiple devices fail at the same time.

[0092] 2) Full protocol process backup

[0093] The protection is carried out through a complete hot backup mode of the routing protocol process. The backup routing protocol process has the same information as the original routing protocol process. When the original routing protocol process is restarted, the backup routing protocol is upgraded to the main routing protocol process to interact with external devices.

[0094] Disadvantage: Since the protocol process is fully backed up, the routing information that occupies the most memory will also exist twice in the system, resulting in doubling of the protocol's routing memory usage. In the case of the same routing volume, its memory cost doubles.

[0095] In addition: Since the protocol process is fully backed up, the backup protocol process has most of the same logic as the main protocol process. The same software failure may occur in both processes, and it is more likely that both processes will be restarted at the same time.

[0096] 3) Trigger the master-slave control board to switch to NSR protection

[0097] For devices with master-slave control boards and non-stop routing (NSR) protection, when a routing protocol process on the master control board restarts, the master-slave control board is directly triggered to switch, so that the routing protocol process on the slave control board is used for recovery.

[0098] Disadvantages: First, this technical solution is only useful if there are devices with master and slave control boards. Second, similar to the full protocol process backup, since the slave-master protocol process is also fully backed up, the protocol process of the slave control board has most of the same logic as the protocol process of the master control board. The same software failure may occur in both processes, and it is more likely that both processes will be restarted at the same time.

[0099] 4) Sending of proxy protocol keep-alive messages

[0100] When the routing protocol process is restarted, the service board or the control board sends keep-alive messages on behalf of the routing protocol process, thereby ensuring that the neighboring device will not have a session timeout interruption problem due to failure to receive the keep-alive message.

[0101] Disadvantages: It can only ensure that neighbor devices will not be disconnected, but because the proxy itself does not process the protocol state machine, it cannot respond when the session is interrupted. The proxy does not receive and process the messages sent by the neighbor, so for the TCP-based routing protocol process, it may cause TCP timeout due to no response to the TCP ACK sequence number (the proxy does not receive the read message), resulting in the interruption of the routing protocol session.

[0102] It can be seen that how to ensure that the protocol neighbor session is not interrupted when the protocol process is restarted and improve the reliability of the routing protocol has become a technical problem that needs to be solved urgently.

[0103] In order to solve the above problems, an embodiment of the present application provides a routing protocol process processing solution, which pre-establishes a first inter-process session between a main control board protocol process and a backup protocol session process. When a network device establishes a target protocol session with a neighboring device, the first session information of the target protocol session is backed up to the backup protocol session process, that is, a first internal session corresponding to the target protocol session is established in the backup protocol session process, and the first internal session is kept in an unresponsive state during the normal operation of the main control board protocol process. When the main control board protocol process is interrupted, the backup protocol session process takes over the target protocol session by configuring the first internal session to enable response state, so that the backup protocol session process can send and receive protocol messages of the target protocol session and perform periodic keep-alive operations. In this way, there is no need to perform a full protocol process backup, which reduces memory consumption and improves the security and reliability of the protocol process interruption and restart process.

[0104] like Figure 1 As shown, this embodiment provides an electronic device 1, including: at least one processor 11 and a memory 12, Figure 2 A processor is taken as an example. The processor 11 and the memory 12 are connected via a bus 10. The memory 12 stores instructions that can be executed by the processor 11, and the instructions are executed by the processor 11 so that the electronic device 1 can execute all or part of the process of the method in the following embodiment, so as to realize that when the main control board protocol process where the target protocol session is located is interrupted and restarted, the target protocol session is taken over by the backup protocol session process, thereby reducing memory consumption and improving the security and reliability of the session during the restart of the protocol process.

[0105] In one embodiment, the electronic device 1 may be a network device such as a switch, a router, a gateway, etc., or may be a mobile phone, a tablet computer, a laptop computer, a desktop computer, or a large computing system composed of multiple computers.

[0106] Figure 2 A schematic diagram of a network topology structure of a routing protocol process processing solution provided in an embodiment of the present application in actual application. Figure 2 As shown, the structure includes: network device R1 and network device R2, wherein:

[0107] In an actual communication network, R1 and R2 can establish a protocol neighbor relationship, such as a BGP neighbor relationship, and can establish a protocol session and transmit session information. Assume that the address of R1 is 1.1.1.1 and the AS number is 100. The address of R2 is 2.2.2.2 and the AS number is 100.

[0108] The following describes the implementation scheme of this patent using the R1 device.

[0109] The network device R1 and the network device R2 mentioned above can both be implemented by the electronic device 1 .

[0110] The routing protocol process processing solution of the embodiment of the present application can be deployed on the network device R1, can also be deployed on the network device R2, or can be deployed partially on the network device R1 and partially on the network device R2. In actual scenarios, it can be selected based on actual needs, and this embodiment does not limit it.

[0111] When the routing protocol process processing solution is fully or partially deployed on the network device R1, a calling interface may be opened to the network device R2 to provide algorithm support to the network device R2.

[0112] The method provided in the embodiment of the present application can be implemented by executing corresponding software codes by the electronic device 1 and by interacting with the server for data.

[0113] The protocol process processing method of the embodiment of the present application can be applied to any field that requires protocol session process processing.

[0114] like Figure 3 The figure is a schematic diagram of a routing protocol process processing system scenario architecture provided by an embodiment of the present application, which is applied to Figure 2 The network device R1 and / or the network device R2 shown include a main control board protocol process, a backup protocol session process and a protocol stack.

[0115] Among them, the main control board protocol process is used to establish a target protocol session with a neighboring device, and establish an inter-process session with the backup protocol session process through the protocol stack, so that the backup protocol session process can back up the target protocol session through the inter-process session, so that when the main control board protocol process where the target protocol session is located is interrupted and restarted, the backup protocol session process can take over the target protocol session, thereby reducing memory consumption and improving the security and reliability of the session during the restart of the protocol process.

[0116] like Figure 4 As shown, a schematic diagram of a routing protocol process processing system scenario architecture provided in an embodiment of the present application is provided. Taking a network device with master-slave control board switching NSR protection as an example, the network device may also include: a slave control board, in which a slave control board protocol process is configured, which is used to perform a complete backup of the master control board protocol process, so as to trigger the master-slave control board switching NSR protection when the master control board protocol process where the target protocol session is located is interrupted and restarted.

[0117] Some embodiments of the present application are described in detail below in conjunction with the accompanying drawings. In the case where there is no conflict between the embodiments, the following embodiments and the features in the embodiments can be combined with each other. In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.

[0118] Please see Figure 5 , which is a routing protocol process processing method of an embodiment of the present application, the method can be Figure 1 The electronic device 1 shown is used to perform and can be applied to Figures 2 to 4 In the application scenario of the protocol process processing shown in , when the main control board protocol process where the target protocol session is located is interrupted and restarted, the target protocol session is taken over by the backup protocol session process, thereby reducing memory consumption and improving the security and reliability of the session during the protocol process restart. This embodiment takes the network device R1 as an execution end as an example, and the method includes the following steps:

[0119] Step 501: Establish a first inter-process session between the main control board protocol process and the backup protocol session process.

[0120] In this step, the first inter-process session can be a Socket session. The main control board protocol process can establish an inter-process Socket session 1 (i.e., the first inter-process session) between the protocol stack and the backup protocol session process. Socket session 1 can be established in advance before the target protocol session is established, so as to back up the target protocol session in time.

[0121] Step 502: When a target protocol session is established between the main control board protocol process and the neighbor device, first session information of the target protocol session is transferred to the backup protocol session process through the first inter-process session.

[0122] In this step, the main control board protocol process successfully establishes the target protocol session, and notifies the backup protocol session process of the first session information and the corresponding Socket information. Assume that the target protocol session refers to the protocol session between the network device R1 and the neighbor device R2, and assume that the target protocol session is a BGP session. When the main control board protocol process of the network device R1 establishes a BGP session 2 with the neighbor device R2, the first session information of the session 2 is passed to the backup protocol session process through the Socket session 1 pre-established in step 501.

[0123] In one embodiment, step 502 may specifically include: passing identification information of the target protocol session to the backup protocol session process through the first inter-process session. Passing first session information of the target protocol session to the backup protocol session process according to the identification information through the first inter-process session.

[0124] In this embodiment, when the first session information of the target protocol session 2 is passed to the backup protocol session, the target protocol session 2 can be marked with identification information. The identification information of the target protocol session 2 is first passed to the backup protocol session process, and then the first session information is passed to the backup protocol session process using the identification information as a mark, thereby ensuring the security and reliability of the first session information transmission process.

[0125] In one embodiment, in step 502, the identification information of the target protocol session is passed to the backup protocol session process through the first inter-process session, including: passing the first identification of the target protocol session to the protocol stack through the main control board protocol process, assigning a second identification to the backup protocol session process according to the first identification through the protocol stack, and associating the second identification with the target protocol session.

[0126] In this embodiment, the identification information of the session can be represented by a Socket descriptor, which is a pointer to an internal data structure, and it points to an entry in the descriptor table. In this embodiment, the Socket descriptor N represents the Nth Socket descriptor, not the actual Socket descriptor value, where N is a positive integer. Assuming that the first identifier is represented by Socket descriptor 1, and the second identifier is represented by Socket descriptor 2, the main control board protocol process passes the Socket session descriptor 1 of the target protocol session 2 to the backup protocol session process through the Socket session 1 between the first processes. In this process, when the protocol stack receives the Socket descriptor 1 and passes it to the backup protocol session process, the backup protocol session process allocates Socket descriptor 2 for this Socket, and associates Socket descriptor 2 with the Socket corresponding to Socket descriptor 1, that is, the Socket descriptor 1 of the main control board protocol process and the Socket descriptor 2 of the backup protocol session process are actually associated with the Socket of the target protocol session 2. Then the protocol stack passes the Socket session descriptor 2 to the backup protocol session process.

[0127] In one embodiment, in step 502, before passing the first session information of the target protocol session to the backup protocol session process according to the identification information through the first inter-process session, it also includes: setting the session associated with the second identifier to an unresponsive state to the protocol stack through the backup protocol session process. Querying the protocol stack for the first identifier associated with the same session as the second identifier through the backup protocol session process. The backup protocol session process stores the association relationship between the first identifier and the second identifier.

[0128] In this embodiment, the session being in an unresponsive state may mean that the Socket of this session needs to be prohibited from responding to the corresponding process for readable data. Specifically, when the backup protocol session process receives the Socket session descriptor 2 of the target protocol session 2, it can set the protocol stack that this Socket needs to be prohibited from responding to the backup protocol session process for readable data, that is, when this Socket receives data, it does not need to send a notification to the backup protocol session process to avoid the backup protocol session process from reading the data. The backup protocol session process queries the protocol stack for the Socket descriptors of other processes of the same Socket session associated with Socket descriptor 2, that is, Socket descriptor 1. The backup protocol session process then stores the association between the Socket descriptors 1 of other processes and the local Socket descriptor 2.

[0129] In one embodiment, in step 502, the first session information of the target protocol session is passed to the backup protocol session process according to the identification information through the first inter-process session, including: carrying the first identifier in the first session information of the target protocol session through the main control board protocol process and passing it to the backup protocol session process.

[0130] In this embodiment, the main control board protocol process notifies the backup protocol session process of the first session information of the target protocol session 2 through the first inter-process Socket session 1, and the first session information is identified by the Socket descriptor 1 of the main control board protocol process, so as to ensure that the first session information is accurately transmitted to the backup protocol session process.

[0131] Step 503: A first internal session corresponding to the target protocol session is established according to the first session information through the backup protocol session process, and the first internal session is configured to be in an unresponsive state.

[0132] In this step, the backup protocol session process establishes a first internal session corresponding to the target protocol session 2 according to the first session information, so as to back up the session information and Socket of the target protocol session 2. In actual scenarios, the routing information of the target protocol session 2 includes various routing table information, which will occupy a large amount of memory resources. Here, the backup protocol session process does not back up the routing information of the target protocol session 2, which can greatly save memory resources while ensuring that the session is not interrupted. The first internal session is configured to be unresponsive, that is, when the Socket of the target protocol session 2 receives data, it does not need to send a notification to the backup protocol session process, so as to avoid the backup protocol session process from reading the data.

[0133] In one embodiment, step 503 may specifically include: parsing the first identifier carried in the first session information through the backup protocol session process, and searching for the second identifier locally associated with the first identifier. Establishing a first internal session corresponding to the target protocol session according to the first session information through the backup protocol session process, and associating the first internal session with the second identifier.

[0134] In this embodiment, the backup protocol session process receives the first session information of the target protocol session 2, and searches for the associated local Socket descriptor 2 according to the first identifier Socket descriptor 1 carried in the first session information. The backup protocol session process creates a first internal session according to the first session information, and associates the first internal session with the local Socket descriptor 2.

[0135] In one embodiment, the network device R1 further includes a slave control board protocol process. The method further includes: notifying the slave control board protocol process through the master control board protocol process to back up the target protocol session, and the slave control board protocol process backs up the information of the target protocol session.

[0136] In this embodiment, if the network device R1 has an uninterrupted routing function, that is, it has the following Figure 4 The slave control board protocol process shown can notify the slave control board protocol process through the master control board protocol process to back up the information of the target protocol session 2. The specific steps can be implemented according to the relevant process of the routing protocol NSR (Non-Stop Routing).

[0137] Step 504: When the main control board protocol process is interrupted, the first internal session is set to an enabled response state through the backup protocol session process, so that the backup protocol session process takes over the target protocol session through the first internal session.

[0138] In this step, when the main control board protocol process is interrupted, in order to ensure the normal sending and receiving of messages of the target protocol session 2, the backup protocol session process takes over the target protocol session 2. Specifically, the backup protocol session process sets the first internal session to an enabled response state, that is, sets the first internal session to enable read data response, so that the backup protocol session process takes over the target protocol session through the first internal session.

[0139] In one embodiment, step 504 may specifically include: when the main control board protocol process is interrupted, the protocol stack notifies the backup protocol session process that the first inter-process session is disconnected. The backup protocol session process deletes the locally stored association relationship. The backup protocol session process sets the first internal session to the enabled response state to the protocol stack according to the second identifier. The keep-alive processing of the target protocol session is started through the backup protocol session process.

[0140] In this embodiment, the first internal session is a backup of the session information and Socket of the target protocol session 2 by the backup protocol session process. When the main control board protocol process is interrupted, the protocol stack notifies the backup protocol session process that the inter-process Socket session 1 is disconnected. The backup protocol session process deletes the association between the previously stored local protocol session Socket descriptor 2 and the Socket descriptor 1 of the main control board protocol process. Then the backup protocol session process performs the following processing on the synchronized first internal session: first, set the Socket descriptor 2 corresponding to the first internal session to the protocol stack to enable the read data response. Then start the keep-alive message periodic sending timer of the first internal session. And the keep-alive timeout timer of the first internal session can be started. Finally, the backup protocol session process takes over the keep-alive message periodic sending processing and keep-alive message timeout detection processing of the target protocol session 2.

[0141] The above-mentioned routing protocol process processing method pre-establishes a first inter-process session between the main control board protocol process and the backup protocol session process. When the network device establishes a target protocol session with the neighboring device, the first session information of the target protocol session is backed up to the backup protocol session process, that is, a first internal session corresponding to the target protocol session is established in the backup protocol session process, and the first internal session is kept in an unresponsive state during the normal operation of the main control board protocol process. When the main control board protocol process is interrupted, the first internal session is configured to be in an enabled response state, and the backup protocol session process takes over the target protocol session, so that the backup protocol session process can send and receive protocol messages of the target protocol session and perform periodic keep-alive operations. In this way, there is no need to perform a full protocol process backup, which reduces memory consumption and improves the security and reliability of the protocol process interruption and restart process.

[0142] Please see Figure 6 , which is a signaling interaction diagram of a routing protocol process processing method according to an embodiment of the present application, the method can be Figure 1 The electronic device 1 shown is used to perform and can be applied to Figures 2 to 4 In the application scenario of the protocol process processing shown in , when the protocol process of the main control board where the target protocol session is located is interrupted and restarted, the target protocol session is taken over by the backup protocol session process, thereby reducing memory consumption and improving the security and reliability of the session during the restart of the protocol process. This embodiment takes the network device R1 with a master-slave control board as the execution end, and takes the protocol session establishment process under normal circumstances as an example. The method includes the following steps:

[0143] 1) The main control board protocol process establishes an inter-process Socket session 1 with the backup protocol session process through the protocol stack.

[0144] 2) The backup protocol session process establishes an inter-process Socket session 1 with the main control board protocol process through the protocol stack.

[0145] 3) The main control board protocol process establishes protocol session 2 with the neighboring device.

[0146] 4) The main control board protocol process passes the Socket session descriptor 1 of the protocol session 2 to the backup protocol session process through the Socket session 1 between processes.

[0147] 5) When the protocol stack receives the Socket session descriptor 1 and passes it to the backup protocol session process, the backup protocol session process allocates Socket descriptor 2 for this Socket, and associates Socket descriptor 2 with the Socket corresponding to Socket descriptor 1, that is, Socket descriptor 1 of the main control board protocol process and Socket descriptor 2 of the backup protocol session process are actually associated with the Socket of protocol session 2.

[0148] 6) The protocol stack passes Socket descriptor 2 to the backup protocol session process.

[0149] 7) The backup protocol session process receives the Socket descriptor 2 of this protocol session, and sets the protocol stack that this Socket needs to prohibit responding to data readability to this process (that is, when receiving data, there is no need to send a notification to the process to allow it to read the data).

[0150] 8) The backup protocol session process queries the protocol stack for the Socket descriptor of other processes of the same Socket session associated with Socket descriptor 2, that is, Socket descriptor 1.

[0151] 9) The backup protocol session process stores the association between the Socket descriptor 1 of other processes and the local Socket descriptor 2.

[0152] 10) The main control board protocol process notifies the backup protocol session process of the session information of the protocol session 2 through the inter-process Socket session 1, and the session information is identified by the Socket descriptor 1 of the main control board protocol process.

[0153] 11) The backup protocol session process receives the session information of the protocol session 2, and searches for the associated local Socket descriptor 2 according to the identifier Socket descriptor 1 carried in the session information.

[0154] 12) The backup protocol session process creates an internal session (ie, the first internal session) according to the session information and associates it with the local Socket descriptor 2.

[0155] 13) The master control board protocol process notifies the slave control board protocol process of the session information backup. When the master control board protocol process learns the protocol message (including routing related messages) and stores the routing information, it synchronizes the protocol message to the slave control board protocol process in real time, and the slave control board protocol process stores the routing information.

[0156] Take the target protocol session 2 as BGP session as an example. Figure 2 As shown, a BGP neighbor relationship is established between network device R1 and network device R2, where the address of R1 is 1.1.1.1 and the address of R2 is 2.2.2.2. The following describes in detail the BGP session establishment and process processing under normal circumstances, taking network device R1 as the execution subject:

[0157] 1) The main control board BGP process establishes an inter-process Socket session 1 with the backup protocol session process through the protocol stack.

[0158] 2) The main control board BGP process establishes a BGP session with the neighbor device R2, where the local IP address is 1.1.1.1, the local AS number is 100, the neighbor IP address is 2.2.2.2, and the neighbor AS number is 100. The socket descriptor corresponding to this BGP session on the main control board BGP process is 100.

[0159] 3) The main control board BGP process passes the Socket descriptor 100 of the BGP session to the backup protocol session process through the Socket session 1 between processes.

[0160] 4) When the protocol stack receives the Socket descriptor 100 and passes it to the backup protocol session process, the backup protocol session process allocates a Socket descriptor 200 for the Socket and associates the Socket descriptor 200 with the Socket corresponding to the Socket descriptor 100.

[0161] 5) The protocol stack passes the Socket descriptor 200 to the backup protocol session process.

[0162] 6) The backup protocol session process receives the Socket descriptor 200 of this BGP session and sets the protocol stack that this Socket needs to prohibit the response data to this process from being readable.

[0163] 7) The backup protocol session process queries the protocol stack for the Socket descriptors 100 of other processes of the same Socket session to which the Socket descriptor 200 is associated.

[0164] 8) The backup protocol session process stores the association between the Socket descriptor 100 of other processes and the local Socket descriptor 200.

[0165] 9) The main control board BGP process notifies the backup protocol session process of the session information of the BGP session through the inter-process Socket session 1, and the session information is identified by the Socket descriptor 100 of the main control board protocol process. The session information may include the local IP address, local AS number, neighbor IP address, neighbor AS number and other information of the BGP session.

[0166] 10) The backup protocol session process receives the session information of the BGP session, and searches for the associated local Socket descriptor 200 according to the identification Socket descriptor 100 carried in the BGP session information.

[0167] 11) The backup protocol session process creates an internal BGP session based on the BGP session information and associates it with the local Socket descriptor 200.

[0168] 12) The master control board BGP process notifies the slave control board BGP process of the BGP session information.

[0169] In one embodiment, when the relevant protocol is processing the received protocol message, generally the protocol stack will read as much data as there is data. Even if the message data cannot form a complete protocol message, the data will be read from the protocol stack first, and then placed in the message cache inside the process to wait for the message to be complete before processing. In order to ensure that the received data will not be lost when the subsequent backup protocol session process takes over, the method may also include: when there is received data from a neighboring device in the protocol stack, determining whether there is a complete protocol message in the received data. If there is a complete protocol message in the received data, read the complete protocol message from the protocol stack for protocol processing. If there is no complete protocol message in the received data, wait until the protocol message in the received data is complete, and then read the complete protocol message from the protocol stack for protocol processing.

[0170] In this embodiment, in order to ensure that the subsequent backup protocol session process will not lose the received data when taking over, a pre-reading protocol message header is provided, the protocol message header is parsed, and then the complete protocol message is pre-read according to the protocol message header for processing. Only when there is a complete received protocol message in the protocol stack, the reading process is performed to ensure that when the subsequent main control board protocol process is restarted, the backup protocol session process will not lose the received data when taking over.

[0171] In one embodiment, determining whether a complete protocol message exists in the received data includes: determining whether the message length of the received data is greater than or equal to the target protocol message header length. If the message length of the received data is greater than or equal to the target protocol message header length, pre-reading the first data of the header length from the protocol stack. Parsing the first data to obtain the target protocol message header. According to the target protocol message header, determining the complete length of the target protocol message. Determining whether the message length of the received data is greater than or equal to the complete length, if the message length of the received data is greater than or equal to the complete length, determining that a complete protocol message exists in the received data. If the message length of the received data is less than the target protocol message header length, or the message length of the received data is greater than or equal to the target protocol message header length, and the message length of the received data is less than the complete length, determining that a complete protocol message does not exist in the received data.

[0172] In this embodiment, the protocol message header may be pre-read, the protocol message header may be parsed, and then the complete protocol message may be pre-read according to the protocol message header for processing.

[0173] like Figure 7 As shown, it is a flowchart of the main control board protocol process receiving the protocol message processing in an embodiment of the present application, taking the network device R1 with the master-slave control board as the execution end, taking the main control board protocol process receiving the protocol message process under normal circumstances as an example, which may include the following steps:

[0174] 1. The protocol stack notifies the main control board that there is readable data in the socket descriptor 1 of the protocol session 2. The readable data here refers to the received data of the network device R1 through the target protocol session 2.

[0175] 2. If the opt (selection) module determines that the message length of the readable data in the protocol stack is greater than or equal to the target protocol message header length, the main control board protocol process pre-reads the first data of the target protocol message header length from the protocol stack. Pre-reading means that although the data is read, the read message data is still in the protocol stack. Otherwise, exit the processing and wait for the data message to be complete.

[0176] 3. According to the pre-read first data, parse out the target protocol message header.

[0177] 4. According to the parsed target protocol message header, if the opt module determines that the length of the readable data message in the protocol stack is greater than or equal to the complete protocol message length specified by the target protocol message header (i.e. the complete length of the target protocol message), the main control board protocol process pre-reads the complete protocol message length from the protocol stack according to the complete message length specified by the protocol message header. Otherwise, exit the processing and wait for the data message to be complete.

[0178] 5. The main control board protocol process performs protocol processing based on the pre-read complete protocol message.

[0179] 6. The protocol process of the master control board synchronizes the pre-read complete protocol message to the protocol process of the slave control board.

[0180] 7. Perform protocol processing on the synchronized complete protocol message from the control board protocol process.

[0181] 8. The slave control board protocol process replies to the master control board protocol process that the protocol message has been processed.

[0182] 9. The main control board protocol process actually reads the data of the complete protocol message from the protocol stack.

[0183] Take the network device R1 receiving the BGP update message from the neighbor device R2 as an example. Assume that the neighbor device R2 sends a BGP update message (routing related message) to the network device R1, and the length of the BGP update message is assumed to be 200 bytes. Figure 8 The following is a schematic diagram of the BGP protocol message header, including:

[0184] Marker: Checks whether the synchronization information of the BGP peer is complete. If this verification is not used, all bits are 1.

[0185] Length: The total length of the BGP message, including the message header, in bytes.

[0186] Type: BGP message type.

[0187] In actual scenarios, the BGP message header is 19 bytes. Assuming that network device R1 has a master-slave control board, the processing flow of network device R1 receiving the BGP update message from neighbor device R2 can be as follows:

[0188] 1. The protocol stack notifies the main control board that there is readable data in the BGP session socket descriptor 100.

[0189] 2. If the length of the readable data message 200 bytes in the protocol stack is greater than the 19 bytes of the BGP message header, the main control board BGP process will pre-read 19 bytes of data from the protocol stack.

[0190] 3. Parse the BGP message header based on the pre-read 19-byte data.

[0191] 4. According to the parsed BGP message header, the complete length of this BGP message is 200 bytes. The readable data message length 200 bytes in the protocol stack is equal to the expected complete length 200 bytes of the BGP message. The backup protocol session process protocol stack pre-reads the byte data (since the previous 19 bytes were not actually read, this pre-reading still starts from the beginning).

[0192] 5. The main control board BGP process performs protocol processing based on the pre-read BGP message.

[0193] 6. The master control board BGP process synchronizes the pre-read BGP message to the slave control board BGP process.

[0194] 7. Perform protocol processing on the synchronized BGP messages from the control board BGP process.

[0195] 8. The slave control board BGP process replies to the master control board BGP process that the BGP message has been processed.

[0196] 9. The main control board BGP process actually reads 200 bytes of BGP data from the protocol stack.

[0197] In one embodiment, in order to ensure that when the backup protocol session process takes over when the subsequent main control board protocol process is restarted, no data loss occurs, the method may also include: when the current network device sends a target message to a neighboring device, if the target message is not sent completely, the unsent data in the target message is added to the shared queue of messages to be sent, and a retry is initiated for the unsent data.

[0198] In this embodiment, the shared queue of messages to be sent can be shared by the main control board protocol process and the backup protocol session process. When sending protocol messages, for protocol messages that have not been sent completely, the remaining messages that have not been sent successfully are stored in the shared queue of messages to be sent, so that when the main control board protocol process is restarted later, there will be no loss of sent data when the backup protocol session process takes over.

[0199] like Fig. 9 As shown, a protocol message sending mechanism process provided in an embodiment of the present application includes:

[0200] Step 901: Determine whether there is a message in the shared queue of messages to be sent. If so, jump to step 902. Otherwise, jump to step 908. The shared queue of messages to be sent here stores the complete protocol message information that has not been sent to the protocol stack (that is, there may be only a part of the data of the protocol stack). This queue is shared by the main control board protocol process and the backup protocol session process, and each protocol session has a queue. In terms of time, only one process will operate at the same time. When the main control board protocol process is normal, the main control board protocol process will operate this queue. When the main control board protocol process is restarted and restored, the backup protocol process will take over the session, and at this time, the backup protocol process will operate this queue.

[0201] Step 902: Add the protocol message to be sent to the shared queue of messages to be sent.

[0202] Step 903: Determine whether the shared queue of messages to be sent is empty, if not, jump to step 904. Otherwise, jump to step 911.

[0203] Step 904: Send the protocol message at the head of the queue to the protocol.

[0204] Step 905: Determine whether the protocol message is sent completely, if not, jump to step 906. Otherwise, jump to step 907.

[0205] Step 906: Update the protocol message information cached in the head of the shared queue of messages to be sent, and delete part of the message data that has been sent out. Jump to step 911.

[0206] Step 907: Pop out the protocol message at the head of the shared queue of messages to be sent (ie, the first protocol message data at the head of the queue), and then continue to jump to step 903.

[0207] Step 908: Send the protocol message to the protocol stack.

[0208] Step 909: Determine whether the protocol message is sent completely, if not, jump to step 910. Otherwise, jump to step 911.

[0209] Step 910: Add the protocol message that has not been completely sent to the shared queue of messages to be sent. Part of the message data that has been sent does not need to be added to the queue. Jump to step 911.

[0210] Step 911: Determine whether the shared queue of messages to be sent is empty. If not, proceed to step 912; otherwise, exit the process.

[0211] Step 912: Start the retry sending timer and perform the retry sending process.

[0212] In one embodiment, assuming that the aforementioned network device R1 is used as the current network device, taking R1 sending a BGP update message to R2 as an example, wherein the length of the BGP update message is assumed to be 200 bytes, the BGP update message sending process may be as follows:

[0213] 1. Assume that network device R1 determines that there is no message in the shared queue of messages to be sent for the BGP session, and the main control board BGP process directly sends the protocol message to the protocol stack. Assume that there are a large number of TCP retransmission messages in the protocol stack for the current BGP session, so only 100 bytes are successfully sent to the protocol stack.

[0214] 2. Since the 200-byte BGP message has not been completely sent, the remaining 100-byte BGP message that has not been sent is added to the shared queue of messages to be sent.

[0215] 3. Start the retry sending timer and perform the retry sending process.

[0216] In one embodiment, when the main control board protocol process is interrupted and restarted, the specific process of the backup protocol session process taking over the target protocol session 2 in step 504 can be as follows: Fig.10 As shown, including:

[0217] 1. The protocol stack notifies the backup protocol session process that the inter-process Socket session 1 is disconnected.

[0218] 2. The backup protocol session process deletes the association between the previously stored local protocol session Socket descriptor 2 and the Socket descriptor 1 of the main control board protocol process.

[0219] 3. The backup protocol session process performs the following processing on the synchronized protocol session: first, the Socket descriptor 2 corresponding to the protocol session is set to the protocol stack to enable the read data response.

[0220] 4. Start the keep-alive message period sending timer of the protocol session.

[0221] 5. Start the keep-alive timeout timer for the protocol session.

[0222] pass Fig.10 Steps 4 and 5 shown are used to implement the periodic sending of keep-alive messages and the timeout detection of keep-alive messages of the protocol session taken over by the backup protocol session process.

[0223] Taking the target protocol session 2 as a BGP session as an example, assuming that the aforementioned network device R1 is the current network device, taking the main control board BGP process restart and the backup protocol session process taking over the BGP session as an example, the takeover process can be as follows:

[0224] 1. The protocol stack notifies the backup protocol session process that Socket session 1 between the backup protocol session process and the BGP process on the main control board is disconnected.

[0225] 2. The backup protocol session process deletes the association between the local Socket descriptor 200 of the BGP session stored previously and the Socket descriptor 100 of the main control board protocol process.

[0226] 3. The backup protocol session process sets the Socket descriptor 200 corresponding to the BGP session to the protocol stack to enable the response data to be readable.

[0227] 4. The backup protocol session process starts the keepalive message period sending timer of the BGP session.

[0228] 5. The backup protocol session process starts the keep-alive timeout timer of the BGP session.

[0229] In one embodiment, after step 504, that is, after the backup protocol session process takes over the target protocol session, the complete protocol message is read from the protocol stack for protocol processing, which may specifically include: if the complete protocol message is a routing message, the complete protocol message is added to the shared queue of routing-related protocol messages to be processed through the backup protocol session process.

[0230] In this embodiment, the backup protocol session process will not back up the routing information of the target protocol session when it takes over, and therefore will not process routing messages. In order to avoid the loss of routing information, a shared queue of protocol messages related to routing to be processed can be configured. After the main control board protocol process is interrupted and before it is restarted and restored, the backup protocol session process will add the routing messages to the shared queue of protocol messages related to routing to be processed, so that after the subsequent main control board protocol process is restarted, the routing information can be obtained from the shared queue of protocol messages related to routing to be processed for processing, thereby ensuring the information integrity of the target protocol session.

[0231] like Fig.11 As shown, it is a schematic diagram of a process of receiving a protocol message by a backup protocol session process provided in an embodiment of the present application. After the backup protocol session process takes over the target protocol session, the protocol message receiving process may specifically include:

[0232] 1. The protocol stack notifies the backup protocol session process that readable data exists in Socket descriptor 2 of target protocol session 2.

[0233] 2. If the opt module determines that the length of the readable data message in the protocol stack is greater than or equal to the protocol message header, the backup protocol session process pre-reads the data of the protocol message header length from the protocol stack. Otherwise, it exits the processing and waits for the data message to be complete.

[0234] 3. Parse the protocol message header based on the pre-read data.

[0235] 4. According to the parsed protocol message header, if the opt module determines that the length of the readable data message in the protocol stack is greater than or equal to the complete protocol message length specified by the protocol message header, the backup protocol session process pre-reads the complete protocol message length from the protocol stack according to the complete message length specified by the protocol message header. Otherwise, the process is exited and the data message is waited for to be complete.

[0236] 5. If the protocol message read is a routing-related message, the message is added to the shared queue of routing-related protocol messages to be processed. Since the backup protocol session process only processes the protocol session state machine and does not include routing-related processing, routing-related messages need to be cached and processed by the new protocol process after the main control board is restarted.

[0237] 6. Otherwise, the backup protocol session process processes the protocol message.

[0238] 7. The backup protocol session process actually reads the protocol message data from the protocol stack.

[0239] Taking the target protocol session 2 as a BGP session as an example, assuming that the aforementioned network device R1 is the current network device, after the backup protocol session process takes over the BGP session, when the R2 device sends a BGP update message (route-related message) to the R1 device, the length of the BGP update message is assumed to be 200 bytes, and the backup protocol session process receives the BGP update message of R2 specifically including:

[0240] 1. The protocol stack notifies the backup protocol session process that there is readable data in the BGP session Socket descriptor 200.

[0241] 2. If the length of the readable data message in the protocol stack (200 bytes) is greater than the length of the BGP message header (19 bytes), the backup BGP session process will pre-read 19 bytes of data from the protocol stack.

[0242] 3. Parse the BGP message header based on the pre-read 19-byte data.

[0243] 4. According to the parsed BGP message header, the complete length of this BGP message is 200 bytes. The readable data message length 200 bytes in the protocol stack is equal to the expected complete length 200 bytes of the BGP message. The backup protocol session process protocol stack pre-reads the byte data (since the previous 19 bytes were not actually read, this pre-reading still starts from the beginning).

[0244] 5. According to the BGP message header, it is known that this protocol message is a BGP update message, which is a routing-related message. The message is added to the shared queue of routing-related protocol messages to be processed.

[0245] 6. The backup protocol session process actually reads 200 bytes of BGP message data from the protocol stack.

[0246] In one embodiment, after step 504, the process may also include: a process of restarting the main control board protocol process, which may specifically include: after the main control board protocol process is restarted, the second session information of the target protocol session maintained by the backup protocol session process is passed to the main control board protocol process. A second internal session corresponding to the target protocol session is established through the main control board protocol process according to the second session information, and the second internal session is configured to be in an unresponsive state. A takeover request for the target protocol session is sent to the backup protocol session process through the main control board protocol process. The first internal session is set to an unresponsive state through the backup protocol session process. The takeover request is answered through the backup protocol session process. The second internal session is set to an enabled response state through the main control board protocol process, so that the main control board protocol process takes over the target protocol session through the second internal session.

[0247] In this embodiment, when the main control board protocol process is restarted, it requests the backup protocol session process to restore the session information. The backup protocol session process synchronizes the session and socket information to the main control board protocol process. The main control board protocol process creates a corresponding session and associates the socket, and requests the backup protocol session process to take over the session. The backup protocol session process no longer processes the operation processing of sending and receiving session messages and keeping alive, and sends a request to take over a response to the main control board protocol process, so that the restarted new main control board protocol process takes over the operation processing of sending and receiving session messages and keeping alive.

[0248] In one embodiment, for a network device including a slave control board protocol process, if the slave control board protocol process backs up information of a target protocol session and routing information from the target protocol session, when the master control board protocol process is interrupted and restarted, the routing information of the target protocol session can be synchronized from the slave control board protocol process to the master control board protocol process.

[0249] In one embodiment, when the main control board protocol process is restarted:

[0250] 1. The backup protocol session process senses the restart of the main control board protocol process through the interaction channel between the backup protocol session process and the main control board protocol process.

[0251] 2. The backup protocol session process takes over the sending, receiving and keep-alive operations of session messages.

[0252] 3. The backup protocol session process periodically sends keep-alive messages.

[0253] 4. The backup protocol session process receives and processes the message sent by the neighbor device. If it is a routing-related message, it is cached in the shared routing message cache. If it is a keep-alive message, the keep-alive timer is reset.

[0254] In one embodiment, the backup protocol session process may periodically receive and process messages sent by neighboring devices, such as the time at which keep-alive messages are sent.

[0255] 6. When the main control board protocol process restarts, it requests the backup protocol session process to restore the session information. The backup protocol session process synchronizes the session and socket information to the main control board protocol process.

[0256] 7. The main control board protocol process creates the corresponding session and associates the Socket, and requests the backup protocol session process to take over the session.

[0257] 8. The backup protocol session process no longer handles the sending and receiving of session messages and the keep-alive operation processing, and sends a request to take over the response to the main control board protocol process.

[0258] 9. The main control board protocol process takes over the sending, receiving and keep-alive operations of session messages.

[0259] 10. The master control board protocol process requests the slave control board protocol process to synchronize the original routing information.

[0260] 11. The slave control board protocol process synchronizes routing related information to the master control board protocol process, and the master control board protocol process restores the original routing information storage.

[0261] 12. During this period, the main control board protocol process periodically sends keep-alive messages to neighboring devices, and receives and processes messages sent by neighboring devices. If they are routing-related messages, they are cached in the shared routing message cache (the routing has not been restored, so routing-related messages can be cached first). If they are keep-alive messages, the keep-alive timer is reset.

[0262] In one embodiment, the main control board protocol process may periodically receive and process messages sent by neighboring devices during this period, such as the keep-alive message sending time.

[0263] 14. After the slave control board protocol process completes synchronizing routing related information to the master control board protocol process, the master control board protocol process processes the cached shared routing message cache and resumes normal interaction with neighbor devices.

[0264] like Fig.12 As shown, it is a schematic diagram of a new protocol process startup process of a main control board provided by an embodiment of the present application. When the new protocol process of the main control board is restarted, the protocol session processing will be taken over again from the backup protocol session process. The specific process can be as follows:

[0265] 1. After the main control board protocol process is started, an inter-process Socket session 3 (second inter-process session) will be established with the backup protocol session process through the protocol stack.

[0266] 2. The protocol stack establishes an inter-process Socket session 3 between the main control board protocol process and the backup protocol session process.

[0267] 3. The backup protocol session process performs the following processing on the first internal session: passing the Socket descriptor 2 of the target protocol session 2 to the main control board protocol process through the protocol stack.

[0268] 4. The protocol stack allocates Socket descriptor 3 for the new protocol process of the main control board, and associates Socket descriptor 3 with the Socket of Socket description 2.

[0269] 5. The protocol stack passes the socket descriptor 3 of the target protocol session 2 to the main control board protocol process.

[0270] 6. The main control board protocol process sets Socket descriptor 3 to the protocol stack to prohibit triggering a read data response to this process. Since the target protocol session 2 is still taken over by the backup protocol session process at this time, the main control board protocol process needs to be set in this way.

[0271] 7. The main control board protocol process queries the protocol stack for Socket descriptor 2 of other processes with the same Socket associated with Socket descriptor 3.

[0272] 8. The main control board protocol process stores the association between local Socket descriptor 3 and Socket descriptor 2.

[0273] 9. After passing Socket descriptor 2 of target protocol session 2, the backup protocol session process continues to notify the main control board protocol process of the session information of target protocol session 2, which is identified as Socket descriptor 2.

[0274] 10. The main control board protocol process receives the session information of the target protocol session 2, and searches for the associated local Socket descriptor 3 according to its identification Socket descriptor 2.

[0275] 11. The main control board protocol process creates an internal protocol session, that is, creates a second internal session, according to the session information of the notified protocol session 2, and associates the second internal session with the local Socket descriptor 3.

[0276] 12. When the target protocol session 2 and the session Socket descriptor of the main control board protocol process have been restored, the main control board protocol process requests the backup protocol session process to take over the protocol session 2, which is identified as the Socket descriptor 2 of the backup protocol process.

[0277] 13. The backup protocol session process searches for the corresponding protocol session based on Socket descriptor 2.

[0278] 14. The backup protocol session process sets Socket descriptor 2 to the protocol stack to prohibit triggering a read data response to this process.

[0279] 15. The backup protocol session process closes the protocol session 2 related timers (such as keep-alive message sending timer, timeout timer), reads and writes message data processing, and state machine processing.

[0280] 16. The backup protocol session process queries the protocol stack for Socket descriptor 3 of other processes that are associated with the same Socket as Socket descriptor 2.

[0281] 17. The backup protocol session process stores the association relationship between the local Socket descriptor 2 and the Socket descriptors 3 of other processes associated with the same Socket.

[0282] 18. The backup protocol process responds to the main control board protocol process that the protocol process can receive the protocol session 2 management.

[0283] 19. The main control board protocol process sets the Socket descriptor 3 corresponding to the session to the protocol stack to enable the response data to be readable.

[0284] 20. The main control board protocol process starts the keep-alive message period sending timer of the protocol session

[0285] 21. The main control board protocol process starts the keep-alive timeout timer of the protocol session.

[0286] 22. The master control board protocol process requests the slave control board protocol process to synchronize the original routing information from the protocol session

[0287] 23. The slave control board protocol process synchronizes the routing information from the protocol session to the master control board protocol process.

[0288] 24. The main control board protocol process stores the synchronized routes.

[0289] 25. After synchronizing the routes from the protocol session, the protocol process on the slave control board notifies the protocol process on the master control board that the routes of the protocol session have been notified.

[0290] 26. If the opt module determines that there are messages in the shared queue of protocol messages related to the routing to be processed, it processes the protocol messages in the queue.

[0291] Taking the target protocol session 2 as a BGP session as an example, assuming that the aforementioned network device R1 is the current network device, when the new BGP protocol process of the main control board is restarted, the main control board BGP protocol process will take over the BGP session processing from the backup protocol session process. The specific process is as follows:

[0292] 1. After the BGP process of the main control board is started, an inter-process Socket session will be established between the protocol stack and the backup protocol session process.

[0293] 2. The backup protocol session process transmits the Socket descriptor 200 of the protocol BGP session to the main control board BGP process through the protocol stack.

[0294] 3. The protocol stack allocates socket descriptor 300 to the BGP process of the main control board and associates it with the socket of socket description 200.

[0295] 4. The protocol stack passes the Socket descriptor 300 of the BGP session to the BGP process of the main control board.

[0296] 5. The BGP process on the main control board sets the socket descriptor 300 to the protocol stack to prohibit the response data from being readable to this process.

[0297] 6. The BGP process of the main control board queries the protocol stack for the Socket descriptor 200 of the same Socket associated with the Socket descriptor 300.

[0298] 7. Store the association relationship between the local Socket descriptor 300 and the Socket descriptors 200 of other processes.

[0299] 8. The backup protocol session process continues to notify the main control board BGP process of the session information of the BGP session, which is identified by Socket descriptor 200.

[0300] 9. The BGP process of the main control board receives the notification BGP session information and searches for the associated local Socket descriptor 300 according to its identification Socket descriptor 200.

[0301] 10. The main control board BGP process creates a BGP session based on the notified BGP session information and associates it with the local Socket descriptor 300.

[0302] 11. The BGP process of the main control board requests the backup protocol session process to take over the BGP session, which is identified by the Socket descriptor 200 of the backup protocol session process.

[0303] 12. The backup protocol session process searches for the corresponding BGP session based on Socket descriptor 200.

[0304] 13. The backup protocol session process sets the Socket descriptor 200 to the protocol stack to prohibit the response data from being readable to this process.

[0305] 14. The backup protocol session process turns off BGP session related timers (such as keep-alive message sending timer, timeout timer), reads and writes message data processing, and state machine processing.

[0306] 15. The backup protocol session process queries the protocol stack for the socket descriptor 300 of the BGP process associated with the same socket as the socket descriptor 200.

[0307] 16. The backup protocol session process stores the association relationship between the local Socket descriptor 200 and the Socket descriptor 300 associated with the same Socket.

[0308] 17. The backup protocol session process responds to the main control board BGP process that the BGP process can receive BGP session management.

[0309] 18. The BGP process on the main control board sets the Socket descriptor 300 corresponding to the session to the protocol stack to enable the response data to be readable.

[0310] 19. The main control board BGP process starts the BGP session keepalive message period sending timer

[0311] 20. The BGP process of the main control board starts the keep-alive timeout timer of the BGP session.

[0312] 21. The master control board BGP process requests the slave control board BGP process to synchronize BGP routing information from the BGP session

[0313] 22. Synchronize the routing information from the BGP session from the control board BGP process to the main control board BGP process.

[0314] 23. The main control board BGP process stores the synchronized routes.

[0315] 24. After the slave control board protocol process completes synchronizing the routes from the BGP session, it notifies the master control board BGP process that the routes of the BGP session have been notified.

[0316] 25. If there are messages in the shared queue of protocol messages related to the routing to be processed, the BGP process of the main control board continues to process the protocol messages in the queue.

[0317] In an optional embodiment, for network devices that do not have a slave control board, the original routing information can also be restored through other means, such as storage and recovery through a local database, or the routing protocol itself supports requesting neighboring devices to retransmit routing, then the routing protocol's retransmission routing function mechanism can be used.

[0318] like Fig.13 As shown, it is a structural diagram of a network device without a slave control board. The main control board of the network device may include: a main control board protocol process, a backup protocol session process, and a database of routing-related protocol data. For the case where there is less protocol routing data (such as OSPF, IS-IS protocol), the database can be directly used to store its routing-related protocol data. The database can be shared. When the main control board protocol process is restarted and restored, its routing information can be restored by the shared database. In this way, it is not necessary to require the network device to have a master-slave control board, which expands the scope of application of the technical solution of the present application.

[0319] The routing protocol process processing method of the embodiment of the present application backs up the target protocol session and Socket to the backup protocol session process. When the protocol process where the target protocol session is located is restarted, the backup protocol session process takes over the protocol message sending, receiving and periodic keep-alive operation processing of the target protocol session. Then the restarted protocol process restores the session information and Socket through the backup protocol session process, and takes over the protocol message sending, receiving and periodic keep-alive operation processing of the session again. Then the routing information is restored, and normal protocol interaction is restored after the restoration is completed. In this way, it is ensured that when the protocol process is restarted, the protocol neighbor session will not be interrupted, the service routing and message forwarding will not be interrupted, and the reliability of the routing protocol is improved.

[0320] In order to ensure that the received data is not lost when the subsequent backup protocol session process takes over, the embodiment of the present application provides pre-reading of the protocol message header, parsing of the protocol message header, and then pre-reading of the complete protocol message for processing based on the protocol message header.

[0321] In order to ensure that when the backup protocol session process takes over when the main control board protocol process is restarted later, no data loss occurs, an embodiment of the present application provides a mechanism for sending protocol messages. For protocol messages that are not sent completely, the remaining messages that have not been sent successfully are stored in a shared queue of messages to be sent.

[0322] Furthermore, the technical solution of the embodiment of the present application does not require other devices to collaborate in recovery, so there are no interactive compatibility issues between different manufacturers, thereby increasing the scope of application.

[0323] For details of each step of the above method, please refer to the relevant description of the above-mentioned embodiments, which will not be repeated here.

[0324] Please see Fig.14 , which is a routing protocol process processing device 1400 of an embodiment of the present application, which can be applied to Figure 1 The electronic device 1 shown can be applied to Figures 2 to 4 In the application scenario of the protocol process processing of the network device shown in , when the main control board protocol process where the target protocol session is located is interrupted and restarted, the target protocol session is taken over by the backup protocol session process, thereby reducing memory consumption and improving the security and reliability of the session during the protocol process restart. The device includes: a first establishment module 1401, a transmission module 1402, a second establishment module 1403 and a takeover module 1404, and the functional principles of each module are as follows:

[0325] The first establishing module 1401 is used to establish a first inter-process session between the main control board protocol process and the backup protocol session process.

[0326] The transfer module 1402 is used to transfer the first session information of the target protocol session to the backup protocol session process through the first inter-process session when the target protocol session is established between the main control board protocol process and the neighbor device.

[0327] The second establishing module 1403 is used to establish a first internal session corresponding to the target protocol session according to the first session information through the backup protocol session process, and the first internal session is configured to be in an unresponsive state.

[0328] The takeover module 1404 is used to set the first internal session to an enable response state through the backup protocol session process when the main control board protocol process is interrupted, so that the backup protocol session process takes over the target protocol session through the first internal session.

[0329] In one embodiment, the transfer module 1402 is used to transfer the identification information of the target protocol session to the backup protocol session process through the first inter-process session. Through the first inter-process session, the first session information of the target protocol session is transferred to the backup protocol session process according to the identification information.

[0330] In one embodiment, the transfer module 1402 is used to transfer the first identifier of the target protocol session to the protocol stack through the main control board protocol process. The protocol stack allocates a second identifier to the backup protocol session process according to the first identifier, and associates the second identifier with the target protocol session. The protocol stack transfers the second identifier to the backup protocol session process.

[0331] In one embodiment, the transfer module 1402 is also used to set the session associated with the second identifier to an unresponsive state to the protocol stack through the backup protocol session process before the first session information of the target protocol session is transferred to the backup protocol session process according to the identification information through the first inter-process session. The backup protocol session process queries the protocol stack for the first identifier of the same session associated with the second identifier. The backup protocol session process stores the association relationship between the first identifier and the second identifier.

[0332] In one embodiment, the transfer module 1402 is further configured to carry the first identifier in the first session information of the target protocol session through the main control board protocol process and transfer the first identifier to the backup protocol session process.

[0333] In one embodiment, the first establishment module 1401 is used to parse the first identifier carried in the first session information through the backup protocol session process, and find the second identifier locally associated with the first identifier. The backup protocol session process establishes a first internal session corresponding to the target protocol session according to the first session information, and associates the first internal session with the second identifier.

[0334] In one embodiment, the takeover module 1404 is used for the protocol stack to notify the backup protocol session process that the first inter-process session is disconnected when the main control board protocol process is interrupted. The backup protocol session process deletes the locally stored association relationship. The backup protocol session process sets the first internal session to the enabled response state to the protocol stack according to the second identifier. The keep-alive processing of the target protocol session is started through the backup protocol session process.

[0335] In one embodiment, the method further includes: a judgment module, which is used to judge whether there is a complete protocol message in the received data when there is received data from a neighboring device in the protocol stack. A processing module, which is used to read the complete protocol message from the protocol stack for protocol processing if there is a complete protocol message in the received data. If there is no complete protocol message in the received data, wait until the protocol message in the received data is complete, and then read the complete protocol message from the protocol stack for protocol processing.

[0336] In one embodiment, the judgment module is used to judge whether the message length of the received data is greater than or equal to the target protocol message header length. If the message length of the received data is greater than or equal to the target protocol message header length, pre-read the first data of the header length from the protocol stack. Parse the first data to obtain the target protocol message header. According to the target protocol message header, determine the complete length of the target protocol message. Judge whether the message length of the received data is greater than or equal to the complete length. If the message length of the received data is greater than or equal to the complete length, determine that a complete protocol message exists in the received data. If the message length of the received data is less than the target protocol message header length, or the message length of the received data is greater than or equal to the target protocol message header length, and the message length of the received data is less than the complete length, determine that there is no complete protocol message in the received data.

[0337] In one embodiment, the processing module is also used to set the first internal session to an enabled response state through a backup protocol session process to take over the target protocol session. If the complete protocol message is a routing message, the complete protocol message is added to a shared queue of routing-related protocol messages to be processed through the backup protocol session process.

[0338] In one embodiment, it also includes: a sending module, which is used to add the unsent data in the target message to the shared queue of messages to be sent, and start retrying the unsent data when the current network device sends the target message to the neighboring device if the target message is not sent completely.

[0339] In one embodiment, it also includes: a recovery module, which is used to pass the second session information of the target protocol session maintained by the backup protocol session process to the main control board protocol process after the main control board protocol process is restarted. A second internal session corresponding to the target protocol session is established by the main control board protocol process according to the second session information, and the second internal session is configured to be in an unresponsive state. A takeover request for the target protocol session is sent to the backup protocol session process by the main control board protocol process. The first internal session is set to an unresponsive state by the backup protocol session process. The takeover request is answered by the backup protocol session process. The second internal session is set to an enabled response state by the main control board protocol process, so that the main control board protocol process takes over the target protocol session through the second internal session.

[0340] In one embodiment, the network device further includes a slave control board protocol process. The device further includes: a notification module, which is used to notify the slave control board protocol process through the master control board protocol process that the target protocol session is backed up, and the slave control board protocol process backs up the information of the target protocol session and / or the routing information of the target protocol session. A synchronization module, which is used to synchronize the routing information of the target protocol session to the master control board protocol process through the slave control board protocol process when the master control board protocol process is interrupted and restarted.

[0341] For a detailed description of the above-mentioned routing protocol process processing device 1400, please refer to the description of the relevant method steps in the above-mentioned embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.

[0342] Fig.15 The following is a schematic diagram of a cloud device 150 provided in an exemplary embodiment of the present application. The cloud device 150 can be used to run the method provided in any of the above embodiments. Fig.15 As shown, the cloud device 150 may include: a memory 1504 and at least one processor 1505, Fig.15 A processor is taken as an example.

[0343] The memory 1504 is used to store computer programs and can be configured to store various other data to support operations on the cloud device 150. The memory 1504 can be an object storage service (OSS).

[0344] Memory 1504 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.

[0345] The processor 1505 is coupled to the memory 1504 and is used to execute the computer program in the memory 1504 to implement the solution provided by any of the above method embodiments. The specific functions and technical effects that can be achieved are not repeated here.

[0346] Furthermore, if Fig.15 The cloud device also includes: a firewall 1501, a load balancer 1502, a communication component 1506, a power supply component 1503 and other components. Fig.15 Only some components are shown schematically, which does not mean that the cloud device only includes Fig.15 Components shown.

[0347] In one embodiment, the above Fig.15 The communication component 1506 in is configured to facilitate wired or wireless communication between the device where the communication component 1506 is located and other devices. The device where the communication component 1506 is located can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, LTE (Long Term Evolution, Long Term Evolution, referred to as LTE), 5G and other mobile communication networks, or a combination thereof. In an exemplary embodiment, the communication component 1506 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1506 also includes a near field communication (Near Field Communication, referred to as NFC) module to facilitate short-range communication. For example, the NFC module can be based on Radio Frequency Identification (Radio Frequency Identification, referred to as RFID) technology, Infrared Data Association (Infrared Data Association, referred to as IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (bluetooth, referred to as BT) technology and other technologies to achieve.

[0348] In one embodiment, the above Fig.15 The power supply component 1503 provides power to various components of the device where the power supply component 1503 is located. The power supply component 1503 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device where the power supply component is located.

[0349] An embodiment of the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the method of any of the aforementioned embodiments is implemented.

[0350] An embodiment of the present application also provides a computer program product, including a computer program, which implements the method of any of the aforementioned embodiments when executed by a processor.

[0351] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed.

[0352] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the methods of various embodiments of the present application.

[0353] It should be understood that the above-mentioned processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor. The memory may include a high-speed RAM (Random Access Memory) memory, and may also include non-volatile storage NVM (Nonvolatile memory, NVM for short), such as at least one disk storage, and can also be a USB flash drive, a mobile hard disk, a read-only memory, a disk or an optical disk, etc.

[0354] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special computer.

[0355] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic device or a main control device.

[0356] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0357] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0358] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods of each embodiment of the present application.

[0359] In the technical solution of this application, the collection, storage, use, processing, transmission, provision and disclosure of user data and other information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0360] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for processing a routing protocol process, characterized in that: Applied to a network device, the network device includes a main control board protocol process and a backup protocol session process; the method includes: Establishing a first inter-process session between the main control board protocol process and the backup protocol session process; When a target protocol session is established between the main control board protocol process and a neighbor device, first session information of the target protocol session is transmitted to the backup protocol session process through the first inter-process session; Establishing a first internal session corresponding to the target protocol session according to the first session information through the backup protocol session process, wherein the first internal session is configured to be in an unresponsive state; When the main control board protocol process is interrupted, the first internal session is set to an enabled response state through the backup protocol session process, so that the backup protocol session process takes over the target protocol session through the first internal session.

2. The method according to claim 1, characterized in that The step of transmitting the first session information of the target protocol session to the backup protocol session process through the first inter-process session includes: Passing the identification information of the target protocol session to the backup protocol session process through the first inter-process session; The first session information of the target protocol session is transferred to the backup protocol session process according to the identification information through the first inter-process session.

3. The method according to claim 2, characterized in that The step of transmitting the identification information of the target protocol session to the backup protocol session process through the first inter-process session includes: Passing the first identifier of the target protocol session to a protocol stack through the main control board protocol process; Allocating a second identifier to the backup protocol session process according to the first identifier by the protocol stack, and associating the second identifier with the target protocol session; The second identifier is transmitted to the backup protocol session process through the protocol stack.

4. The method according to claim 3, characterized in that: Before transmitting the first session information of the target protocol session to the backup protocol session process according to the identification information through the first inter-process session, the method further includes: Setting the session associated with the second identifier to an unresponsive state in the protocol stack through the backup protocol session process; querying the protocol stack, through the backup protocol session process, for the first identifier associated with the same session as the second identifier; The backup protocol session process stores the association relationship between the first identifier and the second identifier.

5. The method according to claim 3, characterized in that: The step of transmitting the first session information of the target protocol session to the backup protocol session process according to the identification information through the first inter-process session includes: The first identifier is carried in the first session information of the target protocol session through the main control board protocol process and is transmitted to the backup protocol session process.

6. The method according to claim 5, characterized in that The step of establishing a first internal session corresponding to the target protocol session according to the first session information through the backup protocol session process includes: Parsing the first identifier carried in the first session information through the backup protocol session process, and searching for the second identifier locally associated with the first identifier; A first internal session corresponding to the target protocol session is established according to the first session information through the backup protocol session process, and the first internal session is associated with the second identifier.

7. The method according to claim 4, characterized in that When the main control board protocol process is interrupted, setting the first internal session to an enabled response state through the backup protocol session process to take over the target protocol session includes: When the main control board protocol process is interrupted, the protocol stack notifies the backup protocol session process that the first inter-process session is disconnected; The backup protocol session process deletes the locally stored association relationship; The backup protocol session process sets the first internal session to an enable response state in the protocol stack according to the second identifier; The keep-alive processing of the target protocol session is started through the backup protocol session process.

8. The method according to claim 1, characterized in that Also includes: When there is received data from the neighbor device in the protocol stack, determining whether there is a complete protocol message in the received data; If there is a complete protocol message in the received data, read the complete protocol message from the protocol stack for protocol processing; If there is no complete protocol message in the received data, wait until the protocol message in the received data is complete, and then read the complete protocol message from the protocol stack to perform protocol processing.

9. The method according to claim 8, characterized in that The determining whether there is a complete protocol message in the received data includes: Determine whether the message length of the received data is greater than or equal to the target protocol message header length; If the message length of the received data is greater than or equal to the target protocol message header length, pre-reading first data of the header length from the protocol stack; Parsing the first data to obtain the target protocol message header; Determining the complete length of the target protocol message according to the target protocol message header; Determine whether the message length of the received data is greater than or equal to the complete length, and if the message length of the received data is greater than or equal to the complete length, determine that a complete protocol message exists in the received data; If the message length of the received data is less than the target protocol message header length, or the message length of the received data is greater than or equal to the target protocol message header length, and the message length of the received data is less than the complete length, it is determined that no complete protocol message exists in the received data.

10. The method according to claim 8, characterized in that After setting the first internal session to an enabled response state through the backup protocol session process to take over the target protocol session, reading a complete protocol message from the protocol stack for protocol processing includes: If the complete protocol message is a routing message, the complete protocol message is added to a shared queue of routing-related protocol messages to be processed through the backup protocol session process.

11. The method according to claim 1, characterized in that: Also includes: When the current network device sends a target message to the neighbor device, if the target message is not completely sent, the unsent data in the target message is added to a shared queue of messages to be sent, and a retry is started for the unsent data.

12. The method according to claim 1, characterized in that Also includes: After the main control board protocol process is restarted, the second session information of the target protocol session maintained by the backup protocol session process is transmitted to the main control board protocol process; Establishing, by the main control board protocol process, a second internal session corresponding to the target protocol session according to the second session information, wherein the second internal session is configured to be in an unresponsive state; Sending a takeover request for the target protocol session to the backup protocol session process through the main control board protocol process; Setting the first internal session to an unresponsive state through the backup protocol session process; Responding to the takeover request through the backup protocol session process; The second internal session is set to an enable response state through the main control board protocol process, so that the main control board protocol process takes over the target protocol session through the second internal session.

13. The method according to claim 1, characterized in that The network device also includes a slave control board protocol process; the method also includes: Notifying the slave control board protocol process through the master control board protocol process that the target protocol session is backed up, and the slave control board protocol process backs up the information of the target protocol session and / or the routing information of the target protocol session; When the main control board protocol process is interrupted and restarted, the routing information of the target protocol session is synchronized to the main control board protocol process through the slave control board protocol process.

14. A routing protocol process processing device, characterized in that: Applied to a network device, the network device includes a main control board protocol process and a backup protocol session process; the device includes: A first establishing module, used for establishing a first inter-process session between the main control board protocol process and the backup protocol session process; A transfer module, used for transferring the first session information of the target protocol session to the backup protocol session process through the first inter-process session when the target protocol session is established between the main control board protocol process and the neighboring device; A second establishing module, configured to establish a first internal session corresponding to the target protocol session according to the first session information through the backup protocol session process, wherein the first internal session is configured to be in an unresponsive state; The takeover module is used to set the first internal session to an enabled response state through the backup protocol session process when the main control board protocol process is interrupted, so that the backup protocol session process takes over the target protocol session through the first internal session.

15. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the electronic device to execute the method described in any one of claims 1-13.

16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the method according to any one of claims 1 to 13 is implemented.