Control method, system and interactive terminal for bidirectional forwarding detection session
By introducing sequence identifiers and acknowledgment identifiers into BFD session messages and using communication timers and message retransmission mechanisms, the problem of inconsistent BFD session messages in the architecture of separation between the forwarding plane and the control plane is solved, achieving higher detection accuracy and faster response.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA TELECOM CORP LTD
- Filing Date
- 2021-12-23
- Publication Date
- 2026-07-07
AI Technical Summary
In network devices with a separate forwarding plane and control plane architecture, BFD session messages may become inconsistent and mismatched due to communication anomalies, affecting the accuracy and speed of link detection.
By adding sequence and acknowledgment identifiers to BFD session messages, combined with communication timers and message retransmission mechanisms, message consistency and accuracy are ensured.
It improves the consistency and accuracy of BFD session messages between the forwarding plane and the control plane, ensuring rapid response and reliability of link fault detection.
Smart Images

Figure CN116366704B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of network security technology, and in particular to a control method, system and interactive terminal for bidirectional forwarding detection sessions. Background Technology
[0002] Network devices need to achieve millisecond-level link failure detection so that the system can quickly switch to backup links and maintain network connectivity.
[0003] Bidirectional Forwarding Detection (BFD) is a network protocol used to detect faults between two forwarding points. BFD is a bidirectional forwarding detection mechanism that can provide millisecond-level detection, enabling rapid link detection. Summary of the Invention
[0004] The inventors discovered that in network devices with a separate forwarding plane and control plane architecture, due to the separate deployment of the forwarding plane and control plane, when the control plane generates changes in link information or configuration information, it will trigger operations such as the creation, updating, and deletion of BFD sessions and send configuration information to the forwarding plane, which will then process the information accordingly. If the message channel between the forwarding plane and control plane experiences significant latency or communication anomalies such as information loss, inconsistencies and mismatches in the BFD session messages between the forwarding plane and control plane will cause BFD session anomalies.
[0005] One of the technical problems this disclosure aims to solve is how to improve the consistency and accuracy of BFD session messages between the forwarding plane and the control plane.
[0006] According to some embodiments of this disclosure, a BFD session control method is provided, comprising: a first interactive terminal adding a first sequence identifier and a first response identifier to a first BFD session message, wherein the first sequence identifier is a unique identifier for this message interaction, and the first response identifier is set to a value indicating no response; the first interactive terminal sending the first BFD session message to a second interactive terminal; the first interactive terminal receiving a second BFD session message sent by the second interactive terminal, wherein the second BFD session message includes: a second sequence identifier and a second response identifier; the first interactive terminal determining that the second BFD session message is a response message to the first BFD session message when the second sequence identifier is the same as the first sequence identifier and the second response identifier is set to a value indicating a response.
[0007] In some embodiments, the method further includes: after the first interactive terminal sends the first BFD session message, it starts a communication timer; if the first interactive terminal resends the first BFD session message after the communication timer expires and no response message is received for the first session message, wherein the first BFD session message includes a first sequence identifier and a first response identifier.
[0008] In some embodiments, the method further includes: after the first interactive terminal retransmits the first BFD session message, extending the duration of the communication timer by a preset increment and starting the communication timer; when the communication timer expires and no response message for the first session message is received, the first interactive terminal retransmits the first BFD session message and increments the retransmission count by 1, wherein the first BFD session message includes a first sequence identifier and a first response identifier; the first interactive terminal determines whether the retransmission count has reached a threshold, and if it has not reached the threshold, the above steps are repeated; if it has reached the threshold, the communication timer is set to the maximum value and the communication timer is started, and the step of retransmitting the first BFD session message when the communication timer expires and no response message for the first session message is received is repeated.
[0009] In some embodiments, the method further includes: when the first interactive terminal does not receive an acknowledgment message for the first BFD session message and generates a third BFD session message, sending a third BFD session message, wherein the third BFD session message includes: a third sequence identifier and a third acknowledgment identifier, the sending order represented by the third sequence identifier is 1 greater than the sending order represented by the first sequence identifier, and the third acknowledgment identifier is set to a value indicating no acknowledgment; the first interactive terminal stops sending the first BFD session message, resets the communication timer to its initial value, and starts the communication timer.
[0010] In some embodiments, the method further includes: the first interactive terminal obtains a first sequence identifier from a local sequence identifier pool, wherein the values of each sequence identifier in the sequence identifier pool are sequentially increased within a preset range, different BFD session messages correspond to different sequence identifiers according to the sending order, and the same BFD session messages sent repeatedly use the same sequence identifier. When the sequence identifier corresponding to the maximum value within the preset range is obtained, the sequence identifier is regenerated starting from the minimum value within the preset range.
[0011] In some embodiments, the method further includes: if the second sequence identifier is different from the first sequence identifier and the second response identifier is set to a value indicating a response, the first interactive terminal discards the second BFD session message.
[0012] In some embodiments, the method further includes: when the second response flag is set to a value indicating no response, the first interactive terminal determines the maximum value among the sequence flags of all valid messages received before the second sequence flag; the first interactive terminal determines the sum of the maximum value among all received sequence flags and a preset value as a calibration value; the first interactive terminal determines whether the calibration value is greater than the maximum value within a preset range, and if it is, uses the difference between the calibration value and the maximum value within the preset range as a reference value, otherwise uses the calibration value as the reference value; the first interactive terminal determines whether the reference value is greater than the maximum value among the sequence flags of all received valid messages, and if the reference value is greater than the maximum value among the sequence flags of all received valid messages, then determines the second sequence flag. If the second sequence identifier is greater than the maximum value among all received valid message sequence identifiers and less than the reference value, then the second BFD session message is determined to be a valid message, and a response message for the second BFD session message is generated. If the reference value is less than or equal to the maximum value among all received valid message sequence identifiers, then the second sequence identifier is determined to be greater than the maximum value among all received valid message sequence identifiers and less than the maximum value within a preset range, or greater than the minimum value within a preset range and less than the reference value. If both are true, then the second BFD session message is determined to be a valid message, and a response message for the second BFD session message is generated. The first interactive terminal sends the response message for the second BFD session message to the second interactive terminal.
[0013] In some embodiments, the first BFD session message further includes a first BFD session identifier, wherein the first BFD session identifier is assigned when the BFD session is created, and all messages during the process from the creation to the deletion of the BFD session carry the first BFD session identifier; when the first BFD session message is a BFD session deletion message, the first interaction terminal is a control plane device, the second interaction terminal is a forwarding plane device, and the second BFD session message is a BFD session deletion confirmation message, the method further includes: the first interaction terminal releasing the memory occupied by the BFD session and the first BFD session identifier.
[0014] In some embodiments, the first BFD session message further includes: a first BFD session identifier, and the second BFD session message further includes: a second BFD session identifier; the first interactive terminal receiving the second BFD session message sent by the second interactive terminal includes: after receiving the second BFD session message sent by the second interactive terminal, the first interactive terminal determines whether the second BFD session identifier is the same as an existing session identifier; if the second BFD session identifier is the same as the first BFD session identifier, the first interactive terminal determines whether the second response identifier is set to a value indicating a response, and whether the second sequence identifier is the same as the first sequence identifier.
[0015] In some embodiments, where the second BFD session identifier is different from the existing session identifier and the first interaction terminal is a control plane device, the method further includes: the first interaction terminal generating a BFD session deletion message based on the second BFD session message, wherein the BFD session deletion message includes: a second BFD session identifier, a second sequence identifier, and an acknowledgment identifier set to a value indicating no acknowledgment; the first interaction terminal sending the BFD session deletion message to the second interaction terminal; the first interaction terminal receiving a BFD session deletion confirmation message sent by the second interaction terminal; and the first interaction terminal releasing the memory occupied by the second BFD session identifier and the corresponding BFD session.
[0016] In some embodiments, when the second BFD session identifier is different from the existing session identifier and the first interaction terminal is a forwarding plane device, the method further includes: when the second BFD session message is a BFD session creation message or a BFD session update message, the first interaction terminal creates a corresponding BFD session according to the second BFD session message and generates a BFD session creation confirmation message, wherein the BFD session creation confirmation message includes: a second BFD session identifier, a second sequence identifier, and a response identifier set to a value indicating a response; or, when the second BFD session message is a BFD session deletion message, the first interaction terminal generates a BFD session deletion confirmation message, wherein the BFD session deletion confirmation message includes: a second BFD session identifier, a second sequence identifier, and a response identifier set to a value indicating a response.
[0017] In some embodiments, the method further includes: if the second response identifier is set to a value indicating no response, the first interactive terminal determines whether the sending order represented by the second sequence identifier is the largest order among the sending orders represented by the sequence identifiers of all received valid messages; if not, the second BFD session message is discarded.
[0018] According to some other embodiments of this disclosure, an interactive terminal is provided, wherein the interactive terminal is a first interactive terminal, comprising: an adding module, configured to add a first sequence identifier and a first response identifier to a first BFD session message, wherein the first sequence identifier is a unique identifier for this message interaction, and the first response identifier is set to a value indicating no response; a sending module, configured to send the first BFD session message to a second interactive terminal; a receiving module, configured to receive a second BFD session message sent by the second interactive terminal, wherein the second BFD session message includes: a second sequence identifier and a second response identifier; and a determining module, configured to determine that the second BFD session message is a response message to the first BFD session message when the second sequence identifier is the same as the first sequence identifier and the second response identifier is set to a value indicating a response.
[0019] According to some other embodiments of this disclosure, an interactive terminal is provided, including: a processor; and a memory coupled to the processor for storing instructions, which, when executed by the processor, cause the processor to perform a control method for a BFD session as described in any of the foregoing embodiments.
[0020] According to further embodiments of the present disclosure, a non-transitory computer-readable storage medium is provided, on which a computer program is stored, wherein, when executed by a processor, the program implements the steps of the control method for a BFD session of any of the foregoing embodiments.
[0021] According to some embodiments of this disclosure, a control system for BFD sessions is provided, comprising: a first interactive terminal and a second interactive terminal, configured to receive a first BFD session message, generate a second BFD session message based on the first BFD session message, and send it to the first interactive terminal.
[0022] In the embodiments of this disclosure, the first and second interactive terminals carry a sequence identifier and a response identifier in their respective first and second BFD session messages. Specifically, the first BFD session message carries a first sequence identifier and a first response identifier, and the second BFD session message carries a second sequence identifier and a second response identifier. The first interactive terminal determines that the second BFD session message is a response message to the first BFD session message by comparing the second sequence identifier with the first sequence identifier and identifying the second response identifier as a value indicating a response. The scheme of this disclosure is applicable to network devices with a separate forwarding plane and control plane architecture. For example, the first and second interactive terminals can be a control plane device and a forwarding plane device, respectively. Through the above method, the control plane device and the forwarding plane device can correlate BFD session messages sent and received at different times to determine whether a sent message has been received, thus improving the consistency and accuracy of BFD session messages between the forwarding plane and the control plane.
[0023] Other features and advantages of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 A flowchart illustrating a BFD session control method according to some embodiments of this disclosure is shown.
[0026] Figure 2 A flowchart illustrating a BFD session control method according to other embodiments of this disclosure is shown.
[0027] Figure 3 A flowchart illustrating a BFD session control method according to further embodiments of this disclosure is shown.
[0028] Figure 4 A schematic diagram of the structure of the interactive terminal of some embodiments of this disclosure is shown.
[0029] Figure 5 A schematic diagram of the structure of the interactive terminal of some other embodiments of this disclosure is shown.
[0030] Figure 6 A schematic diagram of the structure of the interactive terminal of some other embodiments of this disclosure is shown.
[0031] Figure 7 A schematic diagram of the structure of a control system for a BFD session, representing some embodiments of this disclosure, is shown. Detailed Implementation
[0032] The technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit this disclosure or its application or use. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without creative effort are within the scope of protection of this disclosure.
[0033] This disclosure proposes a control method for BFD sessions, which is described below in conjunction with... Figures 1-3 Describe it.
[0034] Figure 1 Flowcharts are shown for some embodiments of the BFD session control method disclosed herein. Figure 1 As shown, the method of this embodiment includes steps S102 to S108.
[0035] In step S102, the first interactive terminal adds a first sequence identifier and a first response identifier to the first BFD session message.
[0036] The first interaction endpoint can be a control plane device or a forwarding plane device. The first BFD session message is a message initiated by the first interaction endpoint and is not a response message. For example, if the first interaction endpoint is a control plane device, the first BFD session message is a BFD session creation message; or, if the first interaction endpoint is a forwarding plane device, the first BFD session message is a BFD session state update message, etc. The first sequence identifier is a unique identifier for this message interaction, and the first response identifier is set to a value indicating no response.
[0037] In some embodiments, the first interactive terminal obtains a first sequence identifier from a local sequence identifier pool. The values of each sequence identifier in the sequence identifier pool increase sequentially within a preset range. Different BFD session messages correspond to different sequence identifiers according to the order of sending. Repeatedly sent identical BFD session messages use the same sequence identifier. When the sequence identifier corresponding to the maximum value within the preset range is obtained, the sequence identifier is regenerated starting from the minimum value within the preset range.
[0038] For example, the Seq & Ack mechanism: Seq (Sequence identifier) pool: Each BFD session message sender can set up a Seq pool; the value range of seq is seq_min to seq_max (preset range); if seq = n is used to send BFD session message N, then seq = n+1 is used to send BFD session message N+1 (messages N and N+1 are different messages, and the seq remains the same when a previously sent message is sent again); seq can be used cyclically. When seq reaches seq_max, the next seq will use seq_min. Ack (acknowledgment identifier) setting: When the message sender sends a message with ack = 0, the message receiver replies with ack = 1.
[0039] In step S104, the first interactive terminal sends the first BFD session message to the second interactive terminal, and correspondingly, the second interactive terminal receives the first BFD session message.
[0040] When the first interaction terminal is a control plane device, the second interaction terminal can be a forwarding plane device.
[0041] Message Confirmation Mechanism: After receiving the first BFD session message, the second interactive terminal can perform verification. In some embodiments, if the first acknowledgment flag is set to a value indicating no acknowledgment (e.g., ack = 0), the second interactive terminal determines the maximum value among the sequence flags of all valid messages received before the first sequence flag; determines the sum of the maximum value among all received sequence flags and a preset value as a calibration value; determines whether the calibration value is greater than the maximum value within a preset range; if it is, the difference between the calibration value and the maximum value within the preset range is used as a reference value; otherwise, the calibration value is used as the reference value; determines whether the reference value is greater than the maximum value among the sequence flags of all received valid messages; if the reference value is greater than the maximum value among the sequence flags of all received valid messages, determines whether the first sequence flag is greater than the maximum value among the sequence flags of all received valid messages and less than the reference value; if so, the verification passes; otherwise, the verification fails. If the reference value is less than or equal to the maximum value among the sequence flags of all received valid messages, determines whether the first sequence flag is greater than the maximum value among the sequence flags of all received valid messages and less than the maximum value within a preset range, or whether the first sequence flag is greater than the minimum value within a preset range and less than the reference value; if so, the verification passes; otherwise, the verification fails.
[0042] For example, verifying a message with ack=0:
[0043] recv_seq: The sequence number (seq) of the received message (e.g., the first sequence identifier mentioned above);
[0044] recv_seq_max is used to record the maximum value in the seq of a valid message where ack=0 is received;
[0045] seq_valid_range, a preset value, within a preset range, represents the maximum range of values based on recv_seq_max;
[0046] seq_valid_max, a reference value, represents the maximum valid seq value carried in a received message;
[0047] seq_min: Minimum value within the preset range
[0048] seq_max: The maximum value within the preset range.
[0049] The calculation method for seq_valid_max (reference value) is as follows:
[0050] i = recv_seq_max + seq_vaild_range, (i is the calibration value);
[0051] if (i ≤ seq_max)
[0052] seq_vaild_max = i;
[0053] else
[0054] seq_vaild_max = i - seq_max;
[0055] Furthermore, if seq_vaild_max > recv_seq_max, it is judged whether recv_seq_max < recv_seq < seq_vaild_max is true. If it is true, the verification passes; otherwise, the verification fails. If seq_vaild_max ≤ recv_seq_max, it is judged whether recv_seq_max < recv_seq < seq_max, or seq_max < recv_seq < seq_vaild_max is true. If it is true, the verification passes; otherwise, the verification fails.
[0056] Through the above method, it can be ensured that the second interaction end processes the latest message and can avoid reducing resource waste.
[0057] In step S106, the first interaction end receives the second BFD session message sent by the second interaction end.
[0058] The second BFD session message includes: a second sequence identifier and a second acknowledgment identifier. The second BFD session can be generated by the second interaction end according to the first BFD session message. At this time, the second sequence identifier is the same as the first sequence identifier (seq = n), and the second acknowledgment identifier is set to a value representing an acknowledgment (ack = 1). If the second BFD session message is not an acknowledgment of the first BFD session message, other processing flows will be generated, which will be described in subsequent embodiments. If the second interaction end performs the verification process on the first BFD session, the second BFD session message is generated when the verification passes.
[0059] In step S108, when the second sequence identifier is the same as the first sequence identifier and the second acknowledgment identifier is set to a value representing an acknowledgment, the first interaction end determines that the second BFD session message is an acknowledgment message of the first BFD session message.
[0060] Message acknowledgment mechanism: After receiving the second BFD session message, the first interacting end can perform verification. The first interacting end first determines that the second acknowledgment flag is set to a value indicating acknowledgment (ack = 1). It further determines whether the sequence flag of the most recently sent BFD session message is the same as the second sequence flag (seq = n), and whether the acknowledgment flag is set to a value indicating no acknowledgment (ack = 0). If so, the verification passes, and the second BFD session message is determined to be an acknowledgment message of the first BFD session message. Otherwise, the verification fails, and the second BFD session message is discarded.
[0061] Both the first and second interacting ends can verify the message upon receiving it. If the verification of a message with ack=0 passes, an acknowledgment message with the same seq and ack=1 must be replied. If the verification of a message with ack=1 passes, the recipient is certain that an acknowledgment message has been received. If the verification fails, the message is discarded.
[0062] The application example corresponding to the method in the above embodiment is as follows: the control plane device triggers the creation of a BFD session and sends BFD session creation information (seq=n, ack=0) to the forwarding plane device; after the forwarding plane device completes the creation of the BFD session, it replies with an acknowledgment message (seq=n, ack=1) (it is also possible to reply first and then create the BFD session, which is not required).
[0063] In the above embodiments, the first and second interactive terminals carry a sequence identifier and a response identifier in their respective first and second BFD session messages. Specifically, the first BFD session message carries a first sequence identifier and a first response identifier, and the second BFD session message carries a second sequence identifier and a second response identifier. The first interactive terminal compares the second sequence identifier with the first sequence identifier and identifies the second response identifier as a value indicating a response, thus determining that the second BFD session message is a response message to the first BFD session message. The scheme disclosed herein is applicable to network devices with a separate forwarding plane and control plane architecture. For example, the first and second interactive terminals can be a control plane device and a forwarding plane device, respectively. Through the above method, the control plane device and the forwarding plane device can correlate BFD session messages sent and received at different times to determine whether a sent message has been received, improving the consistency and accuracy of BFD session messages between the forwarding plane and the control plane.
[0064] The following is combined with Figure 2 Describe how the first interacting end should handle the situation if it does not receive a response message for the first BFD session message.
[0065] Figure 2 Flowcharts are shown for some other embodiments of the BFD session control method disclosed herein. For example... Figure 2 As shown, the method of this embodiment includes steps S202 to S212.
[0066] In step S202, the first interactive terminal sends a first BFD session message to the second interactive terminal and starts a communication timer.
[0067] Communication timing mechanism: For a single BFD session, the message sender runs only one communication timer. Two message senders can coexist (both sending ack=0 messages are message senders; for example, when the control plane device sends BFD session update information and the forwarding plane device sends BFD session state update information, both the control plane device and the forwarding plane device are message senders).
[0068] For example, set the following parameters for the communication timer:
[0069] time: Current timing of the communication timer;
[0070] time_init: Initial timing of the communication timer;
[0071] time_add: The increment of the timer after the communication timer expires;
[0072] time_max: The upper limit of the communication timer;
[0073] n: Number of communication timer timeouts;
[0074] n_max: The maximum number of times the communication timer increments.
[0075] For example, when the first interactive end sends the first BFD session message for the first time (seq=n, ack=0), a timer is started, the timer duration is time, and the number of times the message is resent is set to n=0.
[0076] In step S204, the first interactive terminal determines whether the communication timer has ended and whether it has received a response message for the first session message. If so, step S206 is executed. If a response message for the first session message is received, the process stops.
[0077] Upon receiving a response message to the first session message, the first interactive terminal stops the communication timer and resets the communication timer.
[0078] In step S206, the first interactive terminal resends the first BFD session message, extends the duration of the communication timer by a preset increment, starts the communication timer, and increments the resend count by 1.
[0079] The first BFD session message includes a first sequence identifier (seq=n) and a first acknowledgment identifier (ack=0). For example, if no acknowledgment message (seq=n, ack=1) is received after the timeout period time, the first BFD session message is sent again, the timeout period time = time + time_add is incremented, and the number of retransmissions n = n + 1 is set.
[0080] In step S208, the first interactive terminal determines whether the communication timer has ended and whether it has received a response message for the first session message. If so, step S210 is executed. If a response message for the first session message is received, the process stops.
[0081] In step S210, the first interactive terminal determines whether the number of retransmissions has reached the threshold. If so, step S212 is executed; otherwise, step S206 is returned to start execution again.
[0082] In step S212, the first interactive terminal sets the communication timer to the maximum value, starts the communication timer, resends the first BFD session message, and then returns to step S208 to restart execution.
[0083] For example, if the number of message retransmissions exceeds the upper limit (n>=n_max), the fixed timer is set to the maximum value time=time_max; when an acknowledgment message (seq=n, ack=1) is received, the communication timer is stopped.
[0084] The method described above improves the probability of successful message transmission and enhances the consistency of messages between the control plane and the forwarding plane through communication timing and message retransmission mechanisms.
[0085] In some embodiments, the message update mechanism is as follows: if the first interactive terminal does not receive an acknowledgment message for the first BFD session message and generates a third BFD session message, it sends a third BFD session message, wherein the third BFD session message includes a third sequence identifier and a third acknowledgment identifier, the sending order represented by the third sequence identifier is 1 greater than the sending order represented by the first sequence identifier, and the third acknowledgment identifier is set to a value indicating no acknowledgment; the first interactive terminal stops sending the first BFD session message, resets the communication timer to its initial value, and starts the communication timer.
[0086] For example, when the first interacting end sends a first BFD session message (seq = n, ack = 0) and has not yet received an acknowledgment message (seq = n, ack = 1), a new third BFD session message (seq = n+1, ack = 0) is generated. At this time, the third BFD session message is sent, and the communication timer is reset. Since seq is used cyclically, it is possible that seq = seq_max in the first BFD session message and seq = seq_min in the third BFD session message. Therefore, the sending order represented by the third sequence identifier is one greater than the sending order represented by the first sequence identifier. The third BFD session message can be retransmitted according to the communication timing mechanism and message retransmission mechanism of the above embodiment to improve the reception success rate.
[0087] In some embodiments, if the second sequence identifier is different from the first sequence identifier and the second response identifier is set to a value indicating a response, the first interactive terminal discards the second BFD session message.
[0088] For example, if the second BFD session message contains seq=n-1, ack=1 or seq=n+1, ack=1, and the first BFD session message being sent by the first interacting end has seq=n, then the second BFD session message will be discarded.
[0089] In some embodiments, the message confirmation mechanism is as follows: When the second response flag is set to a value indicating no response, the first interactive terminal determines the maximum value among the sequence flags of all valid messages received before the second sequence flag; determines the sum of the maximum value among all received sequence flags and a preset value as a calibration value; determines whether the calibration value is greater than the maximum value within a preset range; if it is greater, the difference between the calibration value and the maximum value within the preset range is used as a reference value; otherwise, the calibration value is used as a reference value; determines whether the reference value is greater than the maximum value among the sequence flags of all received valid messages; if the reference value is greater than the maximum value among the sequence flags of all received valid messages, then determines whether the second sequence flag is greater than the maximum value among the sequence flags of all received valid messages and less than the reference value; if so, then the second BFD session message is determined to be a valid message, and a response message for the second BFD session message is generated.
[0090] If the reference value is less than or equal to the maximum value among the sequence identifiers of all received valid messages, determine whether the second sequence identifier is greater than the maximum value among the sequence identifiers of all received valid messages and less than the maximum value within a preset range, or whether the second sequence identifier is greater than the minimum value within a preset range and less than the reference value. If so, determine that the second BFD session message is a valid message and generate a response message for the second BFD session message; send the response message for the second BFD session message to the second interactive end.
[0091] The second response flag is set to indicate a no-response value, meaning the second BFD session message was initiated by the second interacting end and requires a response from the first interacting end. In this case, the first interacting end can first perform a verification, referring to the verification method for the second interacting end in step S104. If the verification passes, a response message for the second BFD session message is generated and sent to the second interacting end.
[0092] In some embodiments, if the second response flag is set to a value indicating no response, the first interactive terminal determines whether the sending order represented by the second sequence flag is the largest order among the sending orders represented by the sequence flags of all received valid messages. If not, the second BFD session message is discarded.
[0093] To further improve the consistency of BFD sessions between the two interacting ends, this disclosure also proposes a scheme to add a BFD session identifier to the BFD session message.
[0094] In some embodiments, the first BFD session message further includes: a first BFD session identifier, wherein the first BFD session identifier is assigned when the BFD session is created, and all messages during the process from the creation to the deletion of the BFD session carry the first BFD session identifier; when the first BFD session message is a BFD session deletion message, the first interaction terminal is a control plane device, the second interaction terminal is a forwarding plane device, and the second BFD session message is a BFD session deletion confirmation message, the first interaction terminal releases the memory occupied by the BFD session and the first BFD session identifier.
[0095] For example, the BFD session ID mechanism: A BFD session ID pool is set up with a range of (bfd_id_min, bfd_id_max); the BFD session ID is used to uniquely identify a BFD session when messages are carried between control plane and forwarding plane devices; each existing BFD session (including BFD sessions in a normal deletion state) holds a globally unique BFD session ID; the BFD session ID is assigned when the BFD session is created and released when the BFD session is completely deleted. Figure 3 As shown, a BFD session includes two states: normal deletion and complete deletion. Normal deletion: When a BFD session needs to be deleted, it first enters the normal deletion state; the session in this state is regarded as deleted in the BFD protocol, no longer runs, and releases the occupation of information such as My_Discriminator; the control plane device sends the BFD session deletion information to the forwarding plane device and starts the communication timer; Complete deletion: The control plane device only completely releases the session after receiving confirmation from the forwarding plane device that the BFD session has been deleted.
[0096] In some embodiments, the message confirmation mechanism is as follows: After receiving a BFD session message, the first or second interactive terminal first verifies the BFD session identifier. For example, after receiving a second BFD session message sent by the second interactive terminal, the first interactive terminal determines whether the second BFD session identifier is the same as an existing session identifier; if the second BFD session identifier is the same as the first BFD session identifier, it then determines whether the second acknowledgment identifier is set to a value indicating an acknowledgment, and whether the second sequence identifier is the same as the first sequence identifier.
[0097] When the client receives a message, it can map the message to a BFD session using the BFD session ID carried in the message, and then further verify the message using the method described in the previous embodiment. When the corresponding BFD session cannot be found using the BFD session ID carried in the message, the following scenarios need to be handled.
[0098] In some embodiments, the message confirmation mechanism is as follows: when the second BFD session identifier is different from the existing session identifier, and the first interaction terminal is a control plane device, the first interaction terminal generates a BFD session deletion message based on the second BFD session message, wherein the BFD session deletion message includes: the second BFD session identifier, the second sequence identifier, and the acknowledgment identifier set to a value indicating no acknowledgment; the BFD session deletion message is sent to the second interaction terminal; the BFD session deletion confirmation message sent by the second interaction terminal is received; and the memory occupied by the second BFD session identifier and the corresponding BFD session is released.
[0099] When the control plane device receives a message from the forwarding plane device, if it cannot find a corresponding BFD session, it uses the data from the received message to assemble BFD session deletion information (seq = recv_seq, ack = 0) and sends it to the forwarding plane device. The forwarding plane device then performs the deletion.
[0100] In other embodiments, the message confirmation mechanism is as follows: when the second BFD session identifier is different from the existing session identifier and the first interaction end is a forwarding plane device, if the second BFD session message is a BFD session creation message or a BFD session update message, the first interaction end creates a corresponding BFD session according to the second BFD session message and generates a BFD session creation confirmation message. The BFD session creation confirmation message includes: a second BFD session identifier, a second sequence identifier, and a response identifier set to a value indicating a response.
[0101] Alternatively, if the first interactive terminal generates a BFD session deletion confirmation message when the second BFD session message is a BFD session deletion message, the BFD session deletion confirmation message includes: a second BFD session identifier, a second sequence identifier, and a response identifier set to a value indicating a response.
[0102] If a forwarding plane device receives a message from a control plane device and cannot find a corresponding BFD session, it will do so in one of two ways: if the message is BFD session creation / update information, it will create the corresponding BFD session and reply with ack=1; if the message is BFD session deletion information, it will assemble an acknowledgment message with ack=1 based on the received information and restore the session.
[0103] The methods described in the various embodiments above can be combined and applied in any way.
[0104] The scheme disclosed herein adds a Seq&Ack mechanism, a communication timing mechanism, a message update mechanism, a BFD session ID pool mechanism, and a message acknowledgment mechanism to handle communication problems that may occur when control plane devices and forwarding plane devices exchange BFD session information, such as large delays, information loss, and no communication response, and provides eventual consistency guarantees.
[0105] This disclosure also provides an interactive interface, which is described below in conjunction with... Figure 4 Describe it.
[0106] Figure 4 This is a structural diagram of some embodiments of the interactive terminal disclosed herein. For example... Figure 4 As shown, the interactive terminal 40 in this embodiment includes: an adding module 410, a sending module 420, a receiving module 430, and a determining module 440. This interactive terminal 40 can be the first interactive terminal in the aforementioned embodiment.
[0107] Add module 410 to add a first sequence identifier and a first response identifier to the first BFD session message, wherein the first sequence identifier is a unique identifier for this message interaction, and the first response identifier is set to a value indicating no response.
[0108] In some embodiments, the adding module 410 is used to obtain a first sequence identifier from a local sequence identifier pool. The values of each sequence identifier in the sequence identifier pool increase sequentially within a preset range. Different BFD session messages correspond to different sequence identifiers according to the sending order. Repeatedly sent identical BFD session messages use the same sequence identifier. When the sequence identifier corresponding to the maximum value within the preset range is obtained, the sequence identifier is regenerated starting from the minimum value within the preset range.
[0109] The sending module 420 is used to send the first BFD session message to the second interactive terminal.
[0110] In some embodiments, the sending module 420 is further configured to start a communication timer after sending the first BFD session message; and resend the first BFD session message if the communication timer expires and no acknowledgment message for the first session message is received, wherein the first BFD session message includes a first sequence identifier and a first acknowledgment identifier.
[0111] In some embodiments, the sending module 420 is further configured to: after retransmitting the first BFD session message, extend the duration of the communication timer by a preset increment and start the communication timer; if the communication timer expires and no response message for the first session message is received, retransmit the first BFD session message and increment the retransmission count by 1, wherein the first BFD session message includes a first sequence identifier and a first response identifier; determine whether the retransmission count has reached a threshold, and if it has not reached the threshold, repeat the above steps; if it has reached the threshold, set the communication timer to the maximum value and start the communication timer, and repeat the step of the first interactive terminal retransmitting the first BFD session message if the communication timer expires and no response message for the first session message is received.
[0112] In some embodiments, the sending module 420 is further configured to send a third BFD session message when no acknowledgment message is received for the first BFD session message and a third BFD session message is generated, wherein the third BFD session message includes: a third sequence identifier and a third acknowledgment identifier, wherein the sending order represented by the third sequence identifier is 1 greater than the sending order represented by the first sequence identifier, and the third acknowledgment identifier is set to a value indicating no acknowledgment; stop sending the first BFD session message, reset the communication timer to its initial value, and start the communication timer.
[0113] The receiving module 430 is used to receive a second BFD session message sent by the second interactive terminal, wherein the second BFD session message includes: a second sequence identifier and a second response identifier.
[0114] The determination module 440 is used to determine that the second BFD session message is a response message to the first BFD session message when the second sequence identifier is the same as the first sequence identifier and the second response identifier is set to a value indicating a response.
[0115] In some embodiments, the determining module 440 is further configured to discard the second BFD session message if the second sequence identifier is different from the first sequence identifier and the second response identifier is set to a value indicating a response.
[0116] In some embodiments, the determining module 440 is further configured to, when the second response identifier is set to a value indicating no response, determine the maximum value among the sequence identifiers of all valid messages received before the second sequence identifier; determine the sum of the maximum value among all received sequence identifiers and a preset value as a calibration value; determine whether the calibration value is greater than the maximum value within a preset range; if it is greater, use the difference between the calibration value and the maximum value within the preset range as a reference value; otherwise, use the calibration value as a reference value; determine whether the reference value is greater than the maximum value among the sequence identifiers of all received valid messages; if the reference value is greater than the maximum value among the sequence identifiers of all received valid messages, then determine whether the second sequence identifier is greater than the maximum value among all received valid messages. If the maximum value in the sequence identifier of a valid message is less than the reference value, then the second BFD session message is determined to be a valid message, and a response message for the second BFD session message is generated. If the reference value is less than or equal to the maximum value in the sequence identifier of all received valid messages, then it is determined whether the second sequence identifier is greater than the maximum value in the sequence identifier of all received valid messages and less than the maximum value within a preset range, or whether the second sequence identifier is greater than the minimum value within a preset range and less than the reference value. If so, the second BFD session message is determined to be a valid message, and a response message for the second BFD session message is generated. The sending module 420 is also used to send the response message for the second BFD session message to the second interactive terminal.
[0117] In some embodiments, the determining module 440 is further configured to determine whether the sending order represented by the second sequence identifier is the largest order among the sending orders represented by the sequence identifiers of all received valid messages when the second response identifier is set to a value indicating no response; if not, the second BFD session message is discarded.
[0118] In some embodiments, the first BFD session message further includes a first BFD session identifier, wherein the first BFD session identifier is assigned when the BFD session is created, and all messages during the process from the creation to the deletion of the BFD session carry the first BFD session identifier; when the first BFD session message is a BFD session deletion message, the first interaction terminal is a control plane device, the second interaction terminal is a forwarding plane device, and the second BFD session message is a BFD session deletion confirmation message, the determining module 440 is further used to release the memory occupied by the BFD session and the first BFD session identifier.
[0119] In some embodiments, the first BFD session message further includes a first BFD session identifier, and the second BFD session message further includes a second BFD session identifier; the determining module 440 is further configured to, after receiving the second BFD session message sent by the second interactive terminal, determine whether the second BFD session identifier is the same as an existing session identifier; if the second BFD session identifier is the same as the first BFD session identifier, determine whether the second response identifier is set to a value indicating a response, and whether the second sequence identifier is the same as the first sequence identifier.
[0120] In some embodiments, when the second BFD session identifier is different from the existing session identifier and the first interaction terminal is a control plane device, the adding module 410 is further configured to generate a BFD session deletion message based on the second BFD session message, wherein the BFD session deletion message includes: the second BFD session identifier, the second sequence identifier, and the acknowledgment identifier set to a value indicating no acknowledgment; the sending module 420 is further configured to send the BFD session deletion message to the second interaction terminal; the receiving module 430 is further configured to receive the BFD session deletion confirmation message sent by the second interaction terminal; and the determining module 440 is further configured to release the memory occupied by the second BFD session identifier and the corresponding BFD session.
[0121] In some embodiments, when the second BFD session identifier is different from the existing session identifier and the first interaction terminal is a forwarding plane device, the adding module 410 is further configured to, when the second BFD session message is a BFD session creation message or a BFD session update message, create a corresponding BFD session according to the second BFD session message and generate a BFD session creation confirmation message, wherein the BFD session creation confirmation message includes: a second BFD session identifier, a second sequence identifier, and a response identifier set to a value indicating a response; or, when the second BFD session message is a BFD session deletion message, generate a BFD session deletion confirmation message, wherein the BFD session deletion confirmation message includes: a second BFD session identifier, a second sequence identifier, and a response identifier set to a value indicating a response.
[0122] The interactive terminals in the embodiments of this disclosure can be implemented by various computing devices or computer systems, as described below. Figure 5 as well as Figure 6 Describe it.
[0123] Figure 5 This is a structural diagram of some embodiments of the interactive terminal disclosed herein. For example... Figure 5 As shown, the interactive terminal 50 of this embodiment includes a memory 510 and a processor 520 coupled to the memory 510. The processor 520 is configured to execute the control method of the BFD session in any of the embodiments of this disclosure based on instructions stored in the memory 510.
[0124] The memory 510 may include, for example, system memory, fixed non-volatile storage media, etc. The system memory may store, for example, an operating system, application programs, a boot loader, a database, and other programs.
[0125] Figure 6 This is a structural diagram of some other embodiments of the interactive terminal disclosed herein. For example... Figure 6 As shown, the interactive terminal 60 in this embodiment includes a memory 610 and a processor 620, which are similar to the memory 510 and processor 520, respectively. It may also include an input / output interface 630, a network interface 640, a storage interface 650, etc. These interfaces 630, 640, 650, and the memory 610 and processor 620 can be connected, for example, via a bus 660. The input / output interface 630 provides a connection interface for input / output devices such as a display, mouse, keyboard, and touchscreen. The network interface 640 provides a connection interface for various networked devices, such as connecting to a database server or cloud storage server. The storage interface 650 provides a connection interface for external storage devices such as SD cards and USB flash drives.
[0126] This disclosure also provides a control system for BFD sessions, which is described below in conjunction with... Figure 7 Describe it.
[0127] Figure 7 This is a structural diagram of some embodiments of the control system for BFD sessions disclosed herein. For example... Figure 7 As shown, the system 7 in this embodiment includes: a first interaction terminal 40 / 50 / 60 of any of the foregoing embodiments; and a second interaction terminal 72, used to receive a first BFD session message, generate a second BFD session message based on the first BFD session message, and send it to the first interaction terminal 40 / 50 / 60.
[0128] The second interaction terminal can have the same structure as the first interaction terminal. For example, the first interaction terminal is a control plane device and the second interaction terminal is a forwarding plane device, or the first interaction terminal is a forwarding plane device and the second interaction terminal is a control plane device.
[0129] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, systems, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure can take the form of a computer program product embodied on one or more computer-usable non-transitory storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0130] This disclosure is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0131] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0132] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0133] The above description is only a preferred embodiment of this disclosure and is not intended to limit this disclosure. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the protection scope of this disclosure.
Claims
1. A control method for bidirectional forwarding detection (BFD) sessions, comprising: The first interactive end adds a first sequence identifier and a first response identifier to the first BFD session message, wherein the first sequence identifier is a unique identifier for this message interaction, and the first response identifier is set to a value indicating no response; The first interactive terminal sends the first BFD session message to the second interactive terminal; The first interactive terminal receives a second BFD session message sent by the second interactive terminal, wherein the second BFD session message includes: a second sequence identifier and a second response identifier; If the second sequence identifier is the same as the first sequence identifier and the second response identifier is set to a value indicating a response, the first interactive terminal determines that the second BFD session message is a response message to the first BFD session message.
2. The control method according to claim 1 further includes: After the first interactive terminal sends the first BFD session message, it starts a communication timer; If the communication timer expires and no response message is received for the first BFD session message, the first interactive terminal retransmits the first BFD session message, wherein the first BFD session message includes the first sequence identifier and the first response identifier.
3. The control method according to claim 2 further includes: After the first interactive terminal resends the first BFD session message, it extends the duration of the communication timer by a preset increment and starts the communication timer. If the communication timer expires and no response message is received for the first BFD session message, the first interactive terminal retransmits the first BFD session message and increments the retransmission count by 1. The first BFD session message includes the first sequence identifier and the first response identifier. The first interactive terminal determines whether the number of retransmissions has reached the threshold. If the threshold has not been reached, the above steps are repeated. If the threshold has been reached, the communication timer is set to the maximum value and the communication timer is started. The first interactive terminal then retransmits the first BFD session message when the communication timer has expired and no response message for the first BFD session message has been received.
4. The control method according to claim 3 further includes: If the first interactive terminal does not receive a response message to the first BFD session message and generates a third BFD session message, it sends the third BFD session message, wherein the third BFD session message includes: a third sequence identifier and a third response identifier, wherein the sending order represented by the third sequence identifier is 1 greater than the sending order represented by the first sequence identifier, and the third response identifier is set to a value indicating no response. The first interactive terminal stops sending the first BFD session message, resets the communication timer to its initial value, and starts the communication timer again.
5. The control method according to claim 1, wherein, The first interactive terminal obtains the first sequence identifier from the local sequence identifier pool. The values of each sequence identifier in the sequence identifier pool increase sequentially within a preset range. Different BFD session messages correspond to different sequence identifiers according to the sending order. Repeatedly sent identical BFD session messages use the same sequence identifier. When the sequence identifier corresponding to the maximum value within the preset range is obtained, the sequence identifier is regenerated starting from the minimum value within the preset range.
6. The control method according to claim 1, further comprising: If the second sequence identifier is different from the first sequence identifier and the second response identifier is set to a value indicating a response, the first interactive terminal will discard the second BFD session message.
7. The control method according to claim 1, further comprising: When the second response identifier is set to a value indicating no response, the first interactive terminal determines the maximum value among the sequence identifiers of all valid messages received before the second sequence identifier; The first interactive terminal determines the sum of the maximum value among all received sequence identifiers and a preset value, and uses it as a calibration value; The first interactive terminal determines whether the calibration value is greater than the maximum value within a preset range. If it is greater, the difference between the calibration value and the maximum value within the preset range is used as a reference value; otherwise, the calibration value is used as a reference value. The first interactive terminal determines whether the reference value is greater than the maximum value among the sequence identifiers of all received valid messages. If the reference value is greater than the maximum value among the sequence identifiers of all received valid messages, it determines whether the second sequence identifier is greater than the maximum value among the sequence identifiers of all received valid messages and less than the reference value. If so, it determines that the second BFD session message is a valid message and generates a response message for the second BFD session message. If the reference value is less than or equal to the maximum value among the sequence identifiers of all received valid messages, determine whether the second sequence identifier is greater than the maximum value among the sequence identifiers of all received valid messages and less than the maximum value within the preset range, or whether the second sequence identifier is greater than the minimum value within the preset range and less than the reference value. If so, determine that the second BFD session message is a valid message and generate a response message for the second BFD session message. The first interactive terminal sends the response message of the second BFD session message to the second interactive terminal.
8. The control method according to claim 1, wherein, The first BFD session message also includes: a first BFD session identifier, wherein the first BFD session identifier is assigned when the BFD session is created, and all messages in the process from the creation to the deletion of the BFD session carry the first BFD session identifier; When the first BFD session message is a BFD session deletion message, the first interaction terminal is a control plane device, the second interaction terminal is a forwarding plane device, and the second BFD session message is a BFD session deletion confirmation message, the method further includes: The first interactive terminal releases the memory occupied by the BFD session and the first BFD session identifier.
9. The control method according to claim 1, wherein, The first BFD session message further includes: a first BFD session identifier; the second BFD session message further includes: a second BFD session identifier; the first interactive terminal receiving the second BFD session message sent by the second interactive terminal includes: After receiving the second BFD session message sent by the second interactive terminal, the first interactive terminal determines whether the second BFD session identifier is the same as an existing session identifier; If the second BFD session identifier is the same as the first BFD session identifier, the first interactive terminal determines whether the second response identifier is set to a value indicating a response, and whether the second sequence identifier is the same as the first sequence identifier.
10. The control method according to claim 9, wherein, When the second BFD session identifier is different from the existing session identifier, and the first interactive terminal is a control plane device, the method further includes: The first interactive terminal generates a BFD session deletion message based on the second BFD session message, wherein the BFD session deletion message includes: a second BFD session identifier, a second sequence identifier, and an acknowledgment identifier set to a value indicating no acknowledgment; The first interactive terminal sends the BFD session deletion message to the second interactive terminal; The first interactive terminal receives a BFD session deletion confirmation message sent by the second interactive terminal; The first interactive terminal releases the second BFD session identifier and the memory occupied by the corresponding BFD session.
11. The control method according to claim 9, wherein, When the second BFD session identifier is different from the existing session identifier, and the first interaction terminal is a forwarding plane device, the method further includes: When the second BFD session message is a BFD session creation message or a BFD session update message, the first interactive terminal creates a corresponding BFD session based on the second BFD session message and generates a BFD session creation confirmation message. The BFD session creation confirmation message includes: a second BFD session identifier, a second sequence identifier, and a response identifier set to a value indicating a response; or, When the second BFD session message is a BFD session deletion message, the first interactive terminal generates a BFD session deletion confirmation message, wherein the BFD session deletion confirmation message includes: a second BFD session identifier, a second sequence identifier, and a response identifier set to a value indicating a response.
12. The control method according to claim 1, further comprising: If the second response flag is set to a value indicating no response, the first interactive terminal determines whether the sending order represented by the second sequence flag is the highest order among the sending orders represented by the sequence flags of all received valid messages. If not, the second BFD session message is discarded.
13. An interactive terminal, wherein, The interaction terminal is the first interaction terminal, including: An add module is used to add a first sequence identifier and a first response identifier to the first BFD session message, wherein the first sequence identifier is a unique identifier for this message interaction, and the first response identifier is set to a value indicating no response; The sending module is used to send the first BFD session message to the second interactive terminal; The receiving module is configured to receive a second BFD session message sent by the second interactive terminal, wherein the second BFD session message includes: a second sequence identifier and a second response identifier; The determination module is configured to determine that the second BFD session message is a response message to the first BFD session message when the second sequence identifier is the same as the first sequence identifier and the second response identifier is set to a value indicating a response.
14. An interactive terminal, comprising: processor; as well as A memory coupled to the processor is used to store instructions that, when executed by the processor, cause the processor to perform the control method for a BFD session as described in any one of claims 1-12.
15. A non-transitory computer-readable storage medium having a computer program stored thereon, wherein, When executed by a processor, the program implements the steps of the method according to any one of claims 1-12.
16. A control system for bidirectional forwarding detection (BFD) sessions, comprising: The interactive terminal as described in claim 13 or 14 serves as the first interactive terminal; as well as The second interaction terminal is used to receive the first BFD session message, generate a second BFD session message based on the first BFD session message, and send it to the first interaction terminal.