










技术领域technical field
本发明涉及通讯领域,尤其涉及的是一种处理双向转发检测协议的会话中断消息的方法及存储介质。The invention relates to the field of communications, and in particular, to a method and a storage medium for processing a session interruption message of a bidirectional forwarding detection protocol.
背景技术Background technique
双向转发检测协议(BFD协议)是一种双向转发检测机制,可以提供毫秒级的检测,实现端到端的快速检测。现有技术中,BFD邻居故障后一般与上层协议联动导致切换,上层协议感知邻居正常则发生回切。因此BFD检测的两端之间的网络出现短时间内的频繁的抖动、丢包现象,容易引发上层网络协议频繁切换,由于上层网络协议也需要一定的收敛时间,频繁切换会进一步扩大网络抖动、丢包影响,导致网络的不稳定。The Bidirectional Forwarding Detection Protocol (BFD protocol) is a bidirectional forwarding detection mechanism that can provide millisecond-level detection and achieve end-to-end fast detection. In the prior art, after a BFD neighbor fails, it generally associates with the upper-layer protocol to cause a switchover, and the upper-layer protocol detects that the neighbor is normal and then switches back. Therefore, the network between the two ends detected by BFD has frequent jitter and packet loss in a short period of time, which is easy to cause frequent switching of upper-layer network protocols. Since upper-layer network protocols also require a certain convergence time, frequent switching will further expand network jitter, Packet loss affects the network instability.
因此,现有技术还有待改进和发展。Therefore, the existing technology still needs to be improved and developed.
发明内容SUMMARY OF THE INVENTION
本发明要解决的技术问题在于,针对现有技术的上述缺陷,提供一种处理BFD会话中断消息的方法及存储介质,旨在解决现有技术中当建立BFD会话的两端之间的链路发生频繁性链路中断的情况时,上层协议发生流量的频繁切换,导致网络不稳定的问题。The technical problem to be solved by the present invention is to provide a method and storage medium for processing a BFD session interruption message in view of the above-mentioned defects of the prior art, aiming to solve the problem of establishing a link between two ends of a BFD session in the prior art When frequent link interruptions occur, the upper-layer protocols frequently switch traffic, resulting in network instability.
本发明解决问题所采用的技术方案如下:The technical scheme adopted by the present invention to solve the problem is as follows:
第一方面,本发明实施例提供一种处理双向转发检测协议的会话中断消息的方法,其中,所述方法包括:In a first aspect, an embodiment of the present invention provides a method for processing a session interruption message of a bidirectional forwarding detection protocol, wherein the method includes:
获取双向转发检测协议(BFD)的会话中断消息,得到BFD会话中断总次数;Obtain the session interruption message of the Bidirectional Forwarding Detection Protocol (BFD), and obtain the total number of BFD session interruptions;
根据所述BFD会话中断总次数和中断阈值,增加BFD会话的惩罚值,得到惩罚总值;According to the total number of interruptions of the BFD session and the interruption threshold, the penalty value of the BFD session is increased to obtain the total penalty value;
根据所述惩罚总值和监控阈值,将系统状态设置为监控状态并执行将所述惩罚总值进行递减的操作,得到衰减值;According to the penalty total value and the monitoring threshold, the system state is set to the monitoring state and the operation of decrementing the penalty total value is performed to obtain the attenuation value;
根据所述衰减值和解除阈值,调节系统状态并通过原端口进行流量转发。According to the attenuation value and the release threshold, the system state is adjusted and traffic is forwarded through the original port.
在一种实施方式中,所述获取双向转发检测协议(BFD)的会话中断消息,得到BFD会话中断总次数包括:In an implementation manner, the obtaining the session interruption message of the Bidirectional Forwarding Detection Protocol (BFD), and obtaining the total number of times of BFD session interruption include:
发送BFD检测报文,基于所述BFD检测报文的反馈结果,获取BFD的会话中断消息;sending a BFD detection packet, and obtaining a BFD session interruption message based on the feedback result of the BFD detection packet;
根据所述BFD会话中断消息,累加BFD会话中断次数,得到BFD会话中断总次数。According to the BFD session interruption message, the number of times of BFD session interruption is accumulated to obtain the total number of times of BFD session interruption.
在一种实施方式中,所述根据所述BFD会话中断总次数和中断阈值,增加BFD会话的惩罚值,得到惩罚总值包括:In an implementation manner, according to the total number of interruptions of the BFD session and the interruption threshold, the penalty value of the BFD session is increased, and the total penalty value obtained includes:
根据所述BFD会话中断总次数和中断阈值,计算本次获取BFD会话中断消息的时间与前一次获取BFD会话中断消息的时间的间隔时长;According to the total number of times of interruption of the BFD session and the interruption threshold, calculate the interval length between the time when the BFD session interruption message is obtained this time and the time when the BFD session interruption message is obtained last time;
根据所述间隔时长与预设时长,增加BFD会话的惩罚值,得到惩罚总值。According to the interval duration and the preset duration, the penalty value of the BFD session is increased to obtain the total penalty value.
在一种实施方式中,所述根据所述BFD会话中断总次数和中断阈值,计算本次获取BFD会话中断消息的时间与前一次获取BFD会话中断消息的时间的间隔时长包括:In one embodiment, according to the total number of times of interruption of the BFD session and the interruption threshold, calculating the interval length between the time when the BFD session interruption message is obtained this time and the time when the BFD session interruption message is obtained last time includes:
将所述BFD会话中断总次数和中断阈值进行比较;comparing the total number of interruptions of the BFD session with the interruption threshold;
当所述BFD会话中断总次数大于所述中断阈值时,计算本次获取BFD会话中断消息的时间与前一次获取BFD会话中断消息的时间的间隔时长。When the total number of times of interruption of the BFD session is greater than the interruption threshold, calculate the interval time between the time when the BFD session interruption message is acquired this time and the time when the BFD session interruption message is acquired last time.
在一种实施方式中,所述根据所述间隔时长与预设时长,增加BFD会话的惩罚值,得到惩罚总值包括:In one embodiment, according to the interval duration and the preset duration, the penalty value of the BFD session is increased, and the total penalty value obtained includes:
将所述间隔时长与预设时长进行比较;comparing the interval duration with a preset duration;
当所述间隔时长小于或等于所述预设时长时,按预设数值增加BFD会话的惩罚值,得到惩罚总值。When the interval duration is less than or equal to the preset duration, the penalty value of the BFD session is increased by a preset value to obtain a total penalty value.
在一种实施方式中,所述根据所述惩罚总值和监控阈值,将系统状态设置为监控状态并执行将所述惩罚总值进行递减的操作,得到衰减值包括:In one embodiment, according to the penalty total value and the monitoring threshold, setting the system state to the monitoring state and performing the operation of decreasing the penalty total value, and obtaining the attenuation value includes:
将所述惩罚总值与监控阈值进行比较;comparing the total penalty value to a monitoring threshold;
当所述惩罚总值大于或等于所述监控阈值时,将系统状态设置为监控状态,并按预设频率递减所述惩罚总值,得到衰减值。When the penalty total value is greater than or equal to the monitoring threshold, the system state is set to a monitoring state, and the penalty total value is decremented at a preset frequency to obtain an attenuation value.
在一种实施方式中,所述根据所述衰减值和解除阈值,调节系统状态并通过原端口进行流量转发包括:In an embodiment, the adjusting the system state and forwarding traffic through the original port according to the attenuation value and the release threshold includes:
将所述衰减值与解除阈值进行比较;comparing the decay value to a release threshold;
当所述衰减值大于或等于所述解除阈值时,维持系统状态为监控状态并通过原端口进行流量转发;When the attenuation value is greater than or equal to the release threshold, maintaining the system state as a monitoring state and forwarding traffic through the original port;
当所述衰减值小于所述解除阈值时,将所述中断总次数以及所述惩罚总值清零,并系统状态从监控状态恢复成正常状态,通过原端口进行流量转发。When the attenuation value is less than the release threshold, the total number of interruptions and the total penalty value are cleared, and the system state is restored from the monitoring state to the normal state, and traffic is forwarded through the original port.
在一种实施方式中,所述将所述BFD会话中断总次数和中断阈值进行比较之后还包括:In one embodiment, after comparing the total number of times of interruption of the BFD session with the interruption threshold, the method further includes:
当所述BFD会话中断总次数小于或等于所述中断阈值时,生成故障信息并发送给上层协议,基于所述故障信息控制上层协议通过备用端口进行流量转发。When the total number of interruptions of the BFD session is less than or equal to the interruption threshold, fault information is generated and sent to the upper-layer protocol, and based on the fault information, the upper-layer protocol is controlled to forward traffic through the standby port.
在一种实施方式中,所述将所述间隔时长与预设时长进行比较之后还包括:In one embodiment, after comparing the interval duration with a preset duration, the step further includes:
当所述间隔时长大于所述预设时长时,将所述中断总次数清零,生成故障信息并发送给上层协议,基于所述故障信息控制上层协议通过备用端口进行流量转发。When the interval duration is greater than the preset duration, the total number of interruptions is cleared, fault information is generated and sent to the upper-layer protocol, and based on the fault information, the upper-layer protocol is controlled to forward traffic through the standby port.
第二方面,本发明实施例提供一种存储介质,其上存储有多条指令,其特征在于,所述指令适用于由处理器加载并执行,以实现上述任一项所述的处理双向转发检测协议的会话中断消息的方法的步骤。In a second aspect, an embodiment of the present invention provides a storage medium on which a plurality of instructions are stored, characterized in that the instructions are suitable for being loaded and executed by a processor, so as to realize the bidirectional forwarding of processing described in any one of the above Steps of a method of detecting a session break message for a protocol.
本发明的有益效果:本发明通过获取双向转发检测协议(BFD)的会话中断消息,得到BFD会话中断总次数;根据所述BFD会话中断总次数和中断阈值,增加BFD会话的惩罚值,得到惩罚总值;根据所述惩罚总值和监控阈值,将系统状态设置为监控状态并执行将所述惩罚总值进行递减的操作,得到衰减值;根据所述衰减值和解除阈值,调节系统状态并通过原端口进行流量转发。从而有效地避免当建立BFD会话的两端之间的链路发生频繁性链路中断的情况时,上层协议发生流量的频繁切换,导致网络不稳定的情况发生。Beneficial effects of the present invention: the present invention obtains the total number of BFD session interruption times by acquiring the session interruption message of the Bidirectional Forwarding Detection Protocol (BFD); according to the total number of BFD session interruption times and the interruption threshold, the penalty value of the BFD session is increased, and the penalty value is obtained. total value; according to the penalty total value and the monitoring threshold, set the system state to the monitoring state and perform the operation of decrementing the penalty total value to obtain the attenuation value; according to the attenuation value and the release threshold, adjust the system state and Traffic is forwarded through the original port. Therefore, when frequent link interruptions occur on the link between the two ends of the established BFD session, frequent traffic switching of upper-layer protocols occurs, resulting in network instability.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments described in the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.
图1是本发明实施例提供的处理双向转发检测协议的会话中断消息的方法的流程示意图。FIG. 1 is a schematic flowchart of a method for processing a session interruption message of a bidirectional forwarding detection protocol provided by an embodiment of the present invention.
图2是本发明实施例提供的获取BFD会话中断总次数的流程示意图。FIG. 2 is a schematic flowchart of obtaining the total number of times of interruption of a BFD session according to an embodiment of the present invention.
图3是本发明实施例提供的获取惩罚总值的流程示意图。FIG. 3 is a schematic flowchart of obtaining a total penalty value according to an embodiment of the present invention.
图4是本发明实施例提供的获取本次获取BFD会话中断消息的时间与前一次获取BFD会话中断消息的时间的间隔时长的流程示意图。FIG. 4 is a schematic flowchart of obtaining the interval length between the time of obtaining the BFD session interruption message this time and the time of obtaining the BFD session interruption message last time according to an embodiment of the present invention.
图5是本发明实施例提供的获取惩罚总值的具体流程示意图。FIG. 5 is a schematic schematic diagram of a specific flow of obtaining a penalty total value according to an embodiment of the present invention.
图6是本发明实施例提供的获取衰减值的流程示意图。FIG. 6 is a schematic flowchart of obtaining an attenuation value according to an embodiment of the present invention.
图7是本发明实施例提供的将系统从监控状态恢复至正常状态的流程示意图。FIG. 7 is a schematic flowchart of restoring a system from a monitoring state to a normal state according to an embodiment of the present invention.
图8是本发明实施例提供的当BFD会话中断总次数小于或等于中断阈值时,处理双向转发检测协议的会话中断消息的方法的步骤图。8 is a step diagram of a method for processing a session interruption message of a bidirectional forwarding detection protocol when the total number of BFD session interruptions is less than or equal to the interruption threshold provided by an embodiment of the present invention.
图9是本发明实施例提供的当间隔时长大于预设时长时,处理双向转发检测协议的会话中断消息的方法的步骤图。9 is a step diagram of a method for processing a session interruption message of a bidirectional forwarding detection protocol when the interval duration is greater than a preset duration provided by an embodiment of the present invention.
图10是本发明实施例提供的终端的原理框图。FIG. 10 is a functional block diagram of a terminal provided by an embodiment of the present invention.
图11是本发明实施例提供的处理双向转发检测协议的会话中断消息的装置的内部结构示意图。FIG. 11 is a schematic diagram of an internal structure of an apparatus for processing a session interruption message of a bidirectional forwarding detection protocol according to an embodiment of the present invention.
具体实施方式Detailed ways
为使本发明的目的、技术方案及优点更加清楚、明确,以下参照附图并举实施例对本发明进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the objectives, technical solutions and advantages of the present invention clearer and clearer, the present invention will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention.
需要说明,若本发明实施例中有涉及方向性指示(诸如上、下、左、右、前、后……),则该方向性指示仅用于解释在某一特定姿态(如附图所示)下各部件之间的相对位置关系、运动情况等,如果该特定姿态发生改变时,则该方向性指示也相应地随之改变。It should be noted that if there are directional indications (such as up, down, left, right, front, back, etc.) involved in the embodiments of the present invention, the directional indications are only used to explain a certain posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication also changes accordingly.
BFD协议(Bidirectional Forwarding Detection协议)是一种双向转发检测机制,可以提供毫秒级的检测,实现端到端的快速检测。BFD协议的主要原理是通过与上层路由协议联动,实现路由的快速收敛,确保业务的永续性。具体地,在实际端到端BFD会话的检测场景中,当检测到建立BFD会话的两端之间的链路中断就立刻通知上层协议,则上层协议会立刻将原来进行流量转发的原端口切换至备用端口进行流量转发。当上层协议感知原端口正常接收数据包后则发生流量回切。因此,如果建立BFD会话的两端之间的链路出现短时间内的频繁抖动、丢包现象,则很容易引发上层协议频繁切换,由于上层协议也需要一定的收敛时间,频繁切换会进一步扩大链路抖动、丢包影响,导致网络的不稳定。The BFD protocol (Bidirectional Forwarding Detection protocol) is a bidirectional forwarding detection mechanism, which can provide millisecond-level detection and realize fast end-to-end detection. The main principle of the BFD protocol is to achieve rapid routing convergence and ensure service continuity through linkage with upper-layer routing protocols. Specifically, in the actual end-to-end BFD session detection scenario, when it detects that the link between the two ends of the BFD session is interrupted, the upper-layer protocol is immediately notified, and the upper-layer protocol will immediately switch the original port for traffic forwarding. Traffic forwarding to an alternate port. When the upper-layer protocol senses that the original port receives packets normally, traffic switchback occurs. Therefore, if the link between the two ends of the BFD session is frequently jittered and lost within a short period of time, it is easy to cause frequent switching of upper-layer protocols. Since upper-layer protocols also require a certain convergence time, frequent switching will further expand Link jitter and packet loss affect the network instability.
为了解决现有技术的上述问题,本发明提供一种处理BFD会话中断消息的方法。简单来说,本发明主要是通过在BFD协议与上层协议之间设计一个独立的功能模块,所述功能模块用于接收以及记录建立BFD会话的两端之间的链路检测结果,当链路检测结果为中断时,根据特定的逻辑算法对中断结果进行分析,最终决策是否联动上层协议进行流量切换。因此可以有效地解决BFD会话的检测可能引发的流量频繁切换问题。In order to solve the above problems of the prior art, the present invention provides a method for processing a BFD session interruption message. In short, the present invention mainly designs an independent function module between the BFD protocol and the upper layer protocol, the function module is used to receive and record the link detection result between the two ends of the BFD session. When the detection result is an interruption, the interruption result is analyzed according to a specific logic algorithm, and the final decision is made whether to link the upper-layer protocol for traffic switching. Therefore, the problem of frequent traffic switching that may be caused by BFD session detection can be effectively solved.
如图1所示,本实施例提供一种处理BFD会话中断消息的方法,所述方法包括如下:As shown in FIG. 1 , this embodiment provides a method for processing a BFD session interruption message, and the method includes the following:
步骤S100、获取双向转发检测协议(BFD)的会话中断消息,得到BFD会话中断总次数。Step S100: Obtain the session interruption message of the Bidirectional Forwarding Detection Protocol (BFD), and obtain the total number of times of BFD session interruption.
本实施例通过建立BFD会话实现在本机设备与目标设备两端之间的链路状态的快速检测。本实施例预设有一个BFD模块,当所述BFD模块检测到两端之间的链路故障后,即生成BFD会话中断消息并上报至功能模块,功能模块根据获取到的BFD会话中断消息的次数得到BFD会话中断总次数。In this embodiment, fast detection of the link state between the local device and the target device is implemented by establishing a BFD session. A BFD module is preset in this embodiment. When the BFD module detects a link failure between the two ends, it generates a BFD session interruption message and reports it to the function module. The function module obtains the BFD session interruption message according to the times to get the total number of BFD session interruptions.
如图2所示,在一种实现方式中,所述步骤S100具体包括如下步骤:As shown in FIG. 2, in an implementation manner, the step S100 specifically includes the following steps:
步骤S110、发送BFD检测报文,基于所述BFD检测报文的反馈结果,获取BFD的会话中断消息;Step S110, sending a BFD detection packet, and obtaining a BFD session interruption message based on the feedback result of the BFD detection packet;
步骤S120、根据所述BFD会话中断消息,累加BFD会话中断次数,得到BFD会话中断总次数。Step S120: Accumulate the number of times of interruption of the BFD session according to the BFD session interruption message to obtain the total number of times of interruption of the BFD session.
具体地,BFD会话建立以后,两端之间会周期性地发送BFD检测报文,以检测两端设之间的链路状态。如果BFD模块发送BFD检测报文连续预设次数后,在预设时间内均没有检测到目标设备回发的响应报文,则认为是建立BFD会话的两端之间的链路发生故障(例如本机设备连续发送3个BFD检测报文均没有检测到目标设备回发的响应报文,则认为是两端之间的链路发生故障),则BFD模块生成BFD会话中断消息并上报功能模块,功能模块中设置有用于累计获取BFD会话中断消息次数的中断计数器,所述中断计数器中的数值即为BFD会话中断总次数。Specifically, after the BFD session is established, the two ends periodically send BFD detection packets to detect the link status between the two devices. If the BFD module does not detect the response packet sent back by the target device within the preset time after sending BFD detection packets for a preset number of consecutive times, it is considered that the link between the two ends of the BFD session is faulty (for example, The local device continuously sends 3 BFD detection packets and fails to detect the response packet sent back by the target device, it is considered that the link between the two ends is faulty), then the BFD module generates a BFD session interruption message and reports it to the function module , the function module is provided with an interruption counter for accumulatively acquiring the number of BFD session interruption messages, and the value in the interruption counter is the total number of BFD session interruptions.
当获取到BFD会话中断总次数之后,为了判断网络故障的具体原因,在一种实现方式中,如图1所示,所述方法还包括:After obtaining the total number of BFD session interruptions, in order to determine the specific cause of the network failure, in an implementation manner, as shown in FIG. 1 , the method further includes:
步骤S200、根据所述BFD会话中断总次数和中断阈值,增加BFD会话的惩罚值,得到惩罚总值。Step S200: Increase the penalty value of the BFD session according to the total number of times of interruption of the BFD session and the interruption threshold to obtain a total penalty value.
BFD会话链路出现中断的原因有很多,然而并非所有的链路中断都需要切换流量转发端口,例如有些因网络不稳定导致的链路频繁中断,因此均采用单一的切换流量转发端口的方式无法区别对待不同的链路中断情况。本实施例引入了中断阈值与惩罚值,以区分不同链路中断情况。所述中断阈值用于区分当前链路中断的情况是否属于一般性链路中断的情况,所谓一般性链路中断的情况即指的是难以恢复的链路中断情况,例如线路中断。所述BFD会话的惩罚值用于区分当前链路中断的情况是否属于频繁性链路中断的情况,所述惩罚总值由BFD会话的惩罚值累计得到。There are many reasons for the interruption of BFD session links. However, not all link interruptions require switching of traffic forwarding ports. For example, some links are frequently interrupted due to network instability. Therefore, a single method of switching traffic forwarding ports cannot be used. Treat different link interruption situations differently. In this embodiment, an interruption threshold and a penalty value are introduced to distinguish different link interruption situations. The interruption threshold is used to distinguish whether the current link interruption is a general link interruption, and the so-called general link interruption refers to a link interruption that is difficult to recover, such as line interruption. The penalty value of the BFD session is used to distinguish whether the current link interruption is a frequent link interruption condition, and the penalty total value is accumulated from the penalty value of the BFD session.
如图3所示,在一种实现方式中,所述步骤S200具体包括如下步骤:As shown in FIG. 3, in an implementation manner, the step S200 specifically includes the following steps:
步骤S210、根据所述BFD会话中断总次数和中断阈值,计算本次获取BFD会话中断消息的时间与前一次获取BFD会话中断消息的时间的间隔时长;Step S210, according to the total number of times of interruption of the BFD session and the interruption threshold, calculate the time interval between the time when the BFD session interruption message is obtained this time and the time when the BFD session interruption message is obtained last time;
步骤S220、根据所述间隔时长与预设时长,增加BFD会话的惩罚值,得到惩罚总值。Step S220: Increase the penalty value of the BFD session according to the interval duration and the preset duration to obtain a total penalty value.
本实施例为了区分当前链路中断的情况是否属于一般性链路中断的情况,因此设置了中断阈值和预设时长。BFD会话中断总次数可以反映建立BFD会话的两端之间的链路中断的情况,而中断阈值可以用于评价BFD会话中断总次数的多少,从而初步判定当前链路中断的情况是否属于一般性链路中断的情况。此外还需要计算本次获取BFD会话中断消息的时间与前一次获取BFD会话中断消息的时间的间隔时长,并通过预设时长评估所述间隔时长的长短,从而精确判定当前链路中断的情况是否属于一般性链路中断情况。In this embodiment, in order to distinguish whether the current link interruption is a general link interruption, an interruption threshold and a preset duration are set. The total number of BFD session interruptions can reflect the interruption of the link between the two ends of the established BFD session, and the interruption threshold can be used to evaluate the total number of BFD session interruptions, so as to preliminarily determine whether the current link interruption is general. Link down condition. In addition, it is also necessary to calculate the interval between the time when the BFD session interruption message is obtained this time and the time when the BFD session interruption message was obtained last time, and evaluate the length of the interval by the preset time period, so as to accurately determine whether the current link is interrupted. It belongs to the general link interruption situation.
如图4所示,在一种实现方式中,所述步骤S210具体包括如下步骤:As shown in FIG. 4 , in an implementation manner, the step S210 specifically includes the following steps:
步骤S211、将所述BFD会话中断总次数和中断阈值进行比较;Step S211, comparing the total number of interruptions of the BFD session with the interruption threshold;
步骤S212、当所述BFD会话中断总次数大于所述中断阈值时,计算本次获取BFD会话中断消息的时间与前一次获取BFD会话中断消息的时间的间隔时长。Step S212 , when the total number of times of interruption of the BFD session is greater than the interruption threshold, calculate the interval length between the time when the BFD session interruption message is acquired this time and the time when the BFD session interruption message is acquired last time.
具体地,获取到所述BFD会话中断总次数以后,将所述BFD会话中断总次数和中断阈值进行比较,比较方式可以采用最基本的做差法。当所述BFD会话中断总次数大于所述中断阈值时,说明当前链路中断次数较多,但是还需要获取本次获取BFD会话中断消息的时间与前一次获取BFD会话中断消息的时间,并计算着两个时间点之间的间隔时长,根据所述间隔时长进一步判断当前链路中断的原因。Specifically, after the total number of interruptions of the BFD session is obtained, the total number of interruptions of the BFD session is compared with the interruption threshold, and the comparison method may adopt the most basic difference method. When the total number of BFD session interruptions is greater than the interruption threshold, it indicates that the current link is interrupted many times, but it is necessary to obtain the time when the BFD session interruption message is obtained this time and the time when the BFD session interruption message is obtained last time, and calculate According to the interval duration between the two time points, the cause of the current link interruption is further determined according to the interval duration.
当所述BFD会话中断总次数小于或等于所述中断阈值时,说明当前链路中断次数较少,有可能是一般性链路中断情况导致的。为了避免影响流量的正常转发,如图8所示,在一种实现方式中,步骤S211之后还包括如下步骤:When the total number of interruptions of the BFD session is less than or equal to the interruption threshold, it indicates that the number of current link interruptions is relatively small, which may be caused by a general link interruption condition. In order to avoid affecting the normal forwarding of traffic, as shown in FIG. 8, in an implementation manner, the following steps are further included after step S211:
步骤S1、当所述BFD会话中断总次数小于或等于所述中断阈值时,生成故障信息并发送给上层协议,基于所述故障信息控制上层协议通过备用端口进行流量转发。Step S1: When the total number of interruptions of the BFD session is less than or equal to the interruption threshold, generate fault information and send it to the upper-layer protocol, and control the upper-layer protocol to forward traffic through the standby port based on the fault information.
具体地,当所述BFD会话中断总次数小于或等于所述中断阈值时,则系统进入故障状态,触发故障事件并生成故障消息,然后将故障消息发送至上层协议。上层协议获取到故障消息以后,立即触发流量的主用、备用路径倒换,通过备用路径进行流量转发,因此可以保障建立BFD会话的两端的网络在发生一般故障(如线路中断)时不会影响流量的正常转发。Specifically, when the total number of interruptions of the BFD session is less than or equal to the interruption threshold, the system enters a fault state, triggers a fault event, generates a fault message, and then sends the fault message to the upper-layer protocol. After the upper-layer protocol obtains the fault message, it immediately triggers the switching of the active and standby paths for traffic, and forwards the traffic through the standby path. Therefore, it can ensure that the networks at both ends of the BFD session will not affect the traffic when a general fault (such as line interruption) occurs. normal forwarding.
由于首次获取到BFD会话中断消息时,难以区分其为一般性链路中断情况还是频繁性链路中断的情况,因此在一种实现方式中,可以将中断阈值的数值设置为1,即每当首次获取到BFD会话中断消息时,均使系统进入故障状态,触发故障事件并生成故障消息,然后将故障消息发送至上层协议。上层协议获取到故障消息以后,立即触发流量的主用、备用路径倒换,从而保障流量的正常转发。Because when the BFD session interruption message is acquired for the first time, it is difficult to distinguish whether it is a general link interruption situation or a frequent link interruption situation. Therefore, in an implementation manner, the value of the interruption threshold can be set to 1, that is, whenever When the BFD session interruption message is obtained for the first time, the system enters a fault state, triggers a fault event and generates a fault message, and then sends the fault message to the upper-layer protocol. After the upper-layer protocol obtains the fault message, it immediately triggers the switching of the active and standby paths of traffic to ensure normal traffic forwarding.
如图5所示,在一种实现方式中,所述步骤S220具体包括如下步骤:As shown in FIG. 5, in an implementation manner, the step S220 specifically includes the following steps:
步骤S221、将所述间隔时长与预设时长进行比较;Step S221, comparing the interval duration with a preset duration;
步骤S222、当所述间隔时长小于或等于所述预设时长时,按预设数值增加BFD会话的惩罚值,得到惩罚总值。Step S222: When the interval duration is less than or equal to the preset duration, increase the penalty value of the BFD session by a preset value to obtain a total penalty value.
由于频繁性链路中断在标准BFD会话中会导致上层协议不停切换流量端口,导致网络不稳定,因此本实施例中采用惩罚机制来减少频繁性链路中断给上层协议造成的影响。具体地,计算出最近两次获取BFD会话中断消息的间隔时长以后,将所述间隔时长与预设时长进行比较,当所述间隔时长小于或等于所述预设时长时,表示最近两次获取BFD会话中断消息的时间点很接近,有可能属于频繁性链路中断的情况,则按预设数值增加BFD会话的惩罚值,一个惩罚值代表一次在间隔时间较短的情况下获取到的BFD链路中断消息的事件。本实施例预先设置了一个惩罚计数器,通过所述惩罚计数器累计BFD会话的惩罚值。因此获取惩罚计数器中的数值即可得到所述惩罚总值,所述惩罚总值代表在间隔时间较短的情况下获取到的BFD链路中断消息的总次数。Since frequent link interruptions in a standard BFD session will cause upper-layer protocols to constantly switch traffic ports, resulting in network instability, a penalty mechanism is adopted in this embodiment to reduce the impact of frequent link interruptions on upper-layer protocols. Specifically, after calculating the interval duration between the last two acquisitions of the BFD session interruption message, the interval duration is compared with a preset duration, and when the interval duration is less than or equal to the preset duration, it indicates that the last two acquisitions The time point of the BFD session interruption message is very close, and it may be the case of frequent link interruption, then increase the penalty value of the BFD session according to the preset value. One penalty value represents the BFD obtained at a short interval. Event for link down message. In this embodiment, a penalty counter is preset, and the penalty value of the BFD session is accumulated by the penalty counter. Therefore, the penalty total value can be obtained by acquiring the value in the penalty counter, and the penalty total value represents the total number of BFD link interruption messages acquired when the interval time is short.
如图9所示,在一种实现方式中,所述步骤S221之后还包括如下步骤:As shown in FIG. 9 , in an implementation manner, the step S221 further includes the following steps:
步骤S2、当所述间隔时长大于所述预设时长时,将所述中断总次数清零,生成故障信息并发送给上层协议,基于所述故障信息控制上层协议通过备用端口进行流量转发。Step S2: When the interval duration is greater than the preset duration, clear the total number of interruptions to zero, generate fault information and send it to the upper-layer protocol, and control the upper-layer protocol to forward traffic through the standby port based on the fault information.
具体地,当所述间隔时长大于所述预设时长时,则表示本次获取BFD会话中断消息的时间点与前一次获取BFD会话中断消息的时间点相隔较远。为了保障流量的正常转发,在一种实现方式中,当所述间隔时长大于所述预设时长时,将其视为一般性链路中断的情况处理,则将中断计数器清零,系统进入故障状态,触发故障事件并生成故障消息,然后将故障消息发送至上层协议。上层协议获取到故障消息以后,立即触发流量的主用、备用路径倒换,通过备用路径进行流量转发,因此可以保障建立BFD会话的两端的网络在发生一般故障(如线路中断)时不会影响流量的正常转发。Specifically, when the interval duration is greater than the preset duration, it means that the time point at which the BFD session interruption message is acquired this time is far away from the time point at which the BFD session interruption message was acquired last time. In order to ensure the normal forwarding of traffic, in an implementation manner, when the interval duration is greater than the preset duration, it is treated as a general link interruption, the interruption counter is cleared, and the system enters a fault state, trigger a fault event and generate a fault message, which is then sent to the upper-layer protocol. After the upper-layer protocol obtains the fault message, it immediately triggers the switching of the active and standby paths for traffic, and forwards the traffic through the standby path. Therefore, it can ensure that the networks at both ends of the BFD session will not affect the traffic when a general fault (such as line interruption) occurs. normal forwarding.
为了准确判断当前链路中断情况是否属于频繁性链路中断的情况,本实施例中还设置了监控阈值,从而将最近两次获取BFD会话中断消息的时间点相隔较近的偶然性事件与频繁性链路中断的情况区分开来。因此,如图1所示,所述方法还包括:In order to accurately determine whether the current link interruption is a frequent link interruption, a monitoring threshold is also set in this embodiment, so as to compare the occasional events and the frequent occurrences when the time points when the BFD session interruption messages are obtained in the last two times are relatively close. The case of link interruption is distinguished. Therefore, as shown in Figure 1, the method further includes:
步骤S300、根据所述惩罚总值和监控阈值,将系统状态设置为监控状态并执行将所述惩罚总值进行递减的操作,得到衰减值。Step S300: According to the penalty total value and the monitoring threshold, set the system state to a monitoring state and perform an operation of decreasing the penalty total value to obtain an attenuation value.
具体地,所述监控阈值代表判定为频繁性链路中断的情况所达到的最少中断次数,从而避免将最近两次获取BFD会话中断消息的时间点相隔较近的偶然性事件误判为频繁性链路中断的情况。此外,本实施例还设置了监控状态,所述监控状态用于指示当前系统存在频繁性链路中断的情况。并且当系统处于监控状态时,执行将所述惩罚总值进行递减的操作,得到衰减值。由于所述惩罚总值用于累计系统检测到相邻两次获取BFD中断消息的间隔时长较短的次数,因此其数值的上升速度在一定程度上可以反映系统检测到链路中断的速度。所述衰减值是由所述惩罚总值进行递减得到的,因此其数值的下降速度在一定程度上可以反映所述惩罚总值减小的速度。通过所述衰减值可以更加准确的确定当前链路中断情况是否属于频繁性链路中断的情况。Specifically, the monitoring threshold represents the minimum number of interruptions reached when it is determined that the frequent link is interrupted, so as to avoid misjudging an accidental event with a close time interval between the two most recent acquisitions of the BFD session interruption message as the frequent link road interruption. In addition, this embodiment also sets a monitoring state, where the monitoring state is used to indicate that the current system has frequent link interruptions. And when the system is in the monitoring state, the operation of decrementing the total penalty value is performed to obtain the attenuation value. Since the penalty total value is used to accumulate the number of times that the system detects that the interval between two consecutive acquisitions of BFD interruption messages is short, the rate of increase of the value can reflect the speed at which the system detects the link interruption to a certain extent. The decay value is obtained by decreasing the total penalty value, so the decreasing speed of the value can reflect the decreasing speed of the total penalty value to a certain extent. Through the attenuation value, it can be more accurately determined whether the current link interruption situation belongs to the frequent link interruption situation.
如图6所示,在一种实现方式中,所述步骤S300具体包括如下步骤:As shown in FIG. 6, in an implementation manner, the step S300 specifically includes the following steps:
步骤S310、将所述惩罚总值与监控阈值进行比较;Step S310, comparing the penalty total value with the monitoring threshold;
步骤S320、当所述惩罚总值大于或等于所述监控阈值时,将系统状态设置为监控状态,并按预设频率递减所述惩罚总值,得到衰减值。Step S320: When the total penalty value is greater than or equal to the monitoring threshold, set the system state to a monitoring state, and decrement the total penalty value at a preset frequency to obtain an attenuation value.
具体地,获取到所述惩罚总值以后,将所述惩罚总值与监控阈值进行比较,比较方式可以采用典型的作差法,当所述惩罚总值大于或等于所述监控阈值时,表示链路中断次数已经达到频繁性链路中断情况的最低次数,因此将系统状态设置为监控状态,并按预设频率递减所述惩罚总值,得到衰减值。Specifically, after the total penalty value is obtained, the total penalty value is compared with the monitoring threshold. The comparison method can be a typical difference method. When the total penalty value is greater than or equal to the monitoring threshold, it means that The number of link interruptions has reached the minimum number of frequent link interruptions, so the system state is set to the monitoring state, and the penalty value is decremented at a preset frequency to obtain the attenuation value.
当所述惩罚总值小于所述监控阈值时,表示链路中断次数已经未达到频繁性链路中断情况的最低次数,则判定为不属于频繁性链路中断的情况。并且由于系统在间隔时长较短的两个时间点均获取到BFD会话中断消息,因此排除当前链路中断情况属于线路中断的情况。在一种实现方式中,当所述惩罚总值小于所述监控阈值时,则将系统状态重置为正常状态。系统在正常状态下由原端口进行流量转发,并按标准BFD会话标准周期性的发送和接收BFD检测报文。When the total penalty value is less than the monitoring threshold, it means that the number of link interruptions has not reached the minimum number of frequent link interruptions, and it is determined that the frequent link interruptions are not. In addition, since the system obtains the BFD session interruption message at two time points with a shorter interval, it is excluded that the current link interruption situation belongs to the line interruption situation. In an implementation manner, when the total penalty value is less than the monitoring threshold, the system state is reset to a normal state. In normal state, the system forwards traffic through the original port, and periodically sends and receives BFD detection packets according to the standard BFD session standard.
当获取到所述衰减值以后,如图1所示,所述方法还包括如下步骤:After the attenuation value is obtained, as shown in FIG. 1 , the method further includes the following steps:
步骤S400、根据所述衰减值和解除阈值,调节系统状态并通过原端口进行流量转发。Step S400: According to the attenuation value and the release threshold, adjust the system state and forward traffic through the original port.
解除阈值表示系统恢复正常状态需要低于的最小衰减值。具体地,根据所述衰减值和解除阈值,确定当前系统状态,并将当前系统状态信息上报至上层协议,并控制系统仍通过原端口进行流量转发。The release threshold represents the minimum attenuation value below which the system needs to return to a normal state. Specifically, the current system state is determined according to the attenuation value and the release threshold, and the current system state information is reported to the upper-layer protocol, and the control system still forwards traffic through the original port.
如图7所示,在一种实现方式中,所述步骤S400具体包括如下步骤:As shown in FIG. 7, in an implementation manner, the step S400 specifically includes the following steps:
步骤S410、将所述衰减值与解除阈值进行比较;Step S410, comparing the attenuation value with the release threshold;
步骤S420、当所述衰减值大于或等于所述解除阈值时,维持系统状态为监控状态并通过原端口进行流量转发;Step S420, when the attenuation value is greater than or equal to the release threshold, maintaining the system state as a monitoring state and forwarding traffic through the original port;
步骤S430、当所述衰减值小于所述解除阈值时,将所述中断总次数以及所述惩罚总值清零,并将系统状态从监控状态恢复成正常状态,通过原端口进行流量转发。Step S430: When the attenuation value is less than the release threshold, clear the total number of interruptions and the total penalty value, restore the system state from the monitoring state to the normal state, and forward traffic through the original port.
具体地,获取到所述衰减值以后,将所述衰减值与解除阈值进行比较,当所述衰减值大于或等于所述接触阈值时,说明系统当前的衰减值并未低于系统恢复正常状态需要低于的最小衰减值,表示当前系统获取到BFD会话中断次数(相邻两次中断间隔时长较短的情况)速度大于BFD会话中断次数(相邻两次中断间隔时长较短的情况)衰减的速度,基本可以肯定当前链路中断情况为频繁性链路中断情况,因此继续维持系统状态为监控状态,并将系统的监控状态信息上报至上层协议,当上层协议接收到系统的监控状态信息以后,即可获知当前系统发生了频繁性链路中断情况,则不采取流量切换的措施,而是继续保持通过原端口进行流量转发,以避免加剧网络的不稳定性。Specifically, after the attenuation value is obtained, the attenuation value is compared with the release threshold. When the attenuation value is greater than or equal to the contact threshold, it means that the current attenuation value of the system is not lower than the system returning to normal state. The minimum attenuation value that needs to be less than It can be basically confirmed that the current link interruption is a frequent link interruption, so continue to maintain the system status as monitoring status, and report the monitoring status information of the system to the upper-layer protocol. When the upper-layer protocol receives the monitoring status information of the system In the future, it can be known that frequent link interruptions occur in the current system, and instead of taking traffic switching measures, traffic forwarding continues through the original port to avoid aggravating network instability.
当所述衰减值小于所述解除阈值时,说明系统当前的衰减值已经低于系统恢复正常状态需要低于的最小衰减值,则表示当前系统获取到BFD会话中断次数(相邻两次中断间隔时长较短的情况)速度小于BFD会话中断次数(相邻两次中断间隔时长较短的情况)衰减的速度,则有可能是当前频繁性链路中断的情况已经消失,因此将所述中断计数器和惩罚计数器中的数值都清零,并将系统的监控状态恢复成正常状态,依然由原端口进行流量转发。When the attenuation value is less than the release threshold, it means that the current attenuation value of the system is already lower than the minimum attenuation value that needs to be lower than the system needs to return to the normal state, it means that the current system obtains the number of BFD session interruptions (interval between two consecutive interruptions). In the case of short duration), the speed is less than the rate of attenuation of the number of BFD session interruptions (in the case of a short interval between two consecutive interruptions), it is possible that the current frequent link interruption has disappeared, so the interruption counter is set to The values in the counters and penalty counters are cleared, and the monitoring state of the system is restored to the normal state, and traffic is still forwarded by the original port.
基于上述实施例,本发明提供一种处理BFD会话中断消息的方法的最佳实施例,将所述中断阈值设置为1,所述预设时长设置为5,所述监控阈值设置为5,所述解除阈值设置为1,最佳实施例的完整流程如下:Based on the above embodiment, the present invention provides a preferred embodiment of a method for processing a BFD session interruption message. The interruption threshold is set to 1, the preset duration is set to 5, and the monitoring threshold is set to 5, so The above-mentioned release threshold is set to 1, and the complete process of the preferred embodiment is as follows:
步骤1、触发5秒计时器倒数并判断是否有BFD会话中断消息传入,如果计时器倒数完成前有收到BFD会话中断消息,则进入步骤2;如果计时器倒数完成前没有收到BFD会话中断消息,则进入步骤3。Step 1. Trigger the 5-second timer to count down and determine whether there is a BFD session interruption message incoming. If a BFD session interruption message is received before the timer countdown is completed, go to step 2; if no BFD session is received before the timer countdown is completed If the message is interrupted, go to step 3.
步骤2、将中断计数器加1,并判断中断计数器中累计的中断总次数是否小于或者等于中断阈值,所述中断阈值设置为1,当所述中断总次数小于或者等于1时,进入步骤4;当所述中断总次数大于1时,进入步骤5。Step 2, add 1 to the interrupt counter, and judge whether the total number of interrupts accumulated in the interrupt counter is less than or equal to the interrupt threshold, the interrupt threshold is set to 1, and when the total number of interrupts is less than or equal to 1, enter step 4; When the total number of interruptions is greater than 1, step 5 is entered.
步骤3、重新进入步骤1。Step 3. Re-enter step 1.
步骤4、生成故障信息并发送给上层协议,基于所述故障信息控制上层协议通过备用端口进行流量转发,然后重新进入步骤1。Step 4: Generate fault information and send it to the upper-layer protocol, control the upper-layer protocol to forward traffic through the standby port based on the fault information, and then re-enter step 1.
步骤5、计算本次获取BFD会话中断消息的时间与前一次获取BFD会话中断消息的时间的间隔时长,并判断所述间隔时长是否小于或等于预设时长,所述预设时长设置为5s,当所述间隔时长小于或等于5s时,进入步骤6;当所述间隔时长大于5s时,进入步骤7。Step 5: Calculate the interval length between the time when the BFD session interruption message is obtained this time and the time when the BFD session interruption message was obtained last time, and determine whether the interval time length is less than or equal to a preset time length, and the preset time length is set to 5s, When the interval duration is less than or equal to 5s, go to step 6; when the interval duration is greater than 5s, go to step 7.
步骤6、将BFD会话的惩罚值增加1并获取惩罚总值,判断所述惩罚总值是否大于或等于监控阈值,所述监控阈值设置为5;当所述惩罚总值大于或等于5时,进入步骤8;当所述惩罚总值小于5时,进入步骤9。Step 6. Increase the penalty value of the BFD session by 1 and obtain the total penalty value, determine whether the total penalty value is greater than or equal to the monitoring threshold, and the monitoring threshold is set to 5; when the total penalty value is greater than or equal to 5, Go to step 8; when the total penalty value is less than 5, go to step 9.
步骤7、将所述中断总次数清零,生成故障信息并发送给上层协议,基于所述故障信息控制上层协议通过备用端口进行流量转发,然后重新进入步骤1。Step 7: Clear the total number of interruptions to zero, generate fault information and send it to the upper-layer protocol, control the upper-layer protocol to forward traffic through the standby port based on the fault information, and then re-enter step 1.
步骤8、将系统状态设置为监控状态,然后触发计时器每5s执行所述惩罚总值减1的操作,得到衰减值,并判断所述衰减值是否大于或等于解除阈值,所述解除阈值设置为1,当所述衰减值大于或等于1时,进入步骤10;当所述衰减值小于1时,进入步骤S11。Step 8. Set the system state to the monitoring state, then trigger the timer to perform the operation of subtracting 1 from the total penalty value every 5s to obtain an attenuation value, and determine whether the attenuation value is greater than or equal to the release threshold, and the release threshold is set If it is 1, when the attenuation value is greater than or equal to 1, go to step 10; when the attenuation value is less than 1, go to step S11.
步骤9、将系统状态重置为正常状态,并重新进入步骤1。Step 9. Reset the system state to the normal state, and re-enter step 1.
步骤10、维持系统状态为监控状态,通过原端口进行流量转发,并重新进入步骤1。Step 10: Maintain the system state as the monitoring state, forward traffic through the original port, and re-enter step 1.
步骤11、将系统状态从监控状态恢复成正常状态,通过原端口进行流量转发,并重新进入步骤1。Step 11 , restore the system state from the monitoring state to the normal state, forward traffic through the original port, and re-enter step 1 .
基于上述实施例,本发明还提供了一种处理双向转发检测协议的中断消息的装置,如图11所示,所述装置包括:BFD模块以及功能模块;所述BFD模块、所述功能模块均与控制器连接;Based on the above embodiment, the present invention also provides a device for processing an interrupt message of a bidirectional forwarding detection protocol. As shown in FIG. 11 , the device includes: a BFD module and a function module; the BFD module and the function module are both connected to the controller;
所述BFD模块用于发送、接收BFD检测报文,以及生成BFD会话中断消息;The BFD module is used for sending and receiving BFD detection packets, and generating BFD session interruption messages;
所述功能模块包括中断计数器、惩罚计数器以及比较单元;The functional module includes an interrupt counter, a penalty counter and a comparison unit;
所述中断计数器用于累计获取BFD会话中断消息的次数;The interruption counter is used to accumulate the number of times that the BFD session interruption message is obtained;
所述惩罚计数器用于累计BFD会话的惩罚值;The penalty counter is used to accumulate the penalty value of the BFD session;
所述比较单元用于比较中断总次数与中断阈值的大小、惩罚总值与监控阈值的大小以及惩罚总值与解除阈值的大小,并将比较结果发送至控制器。The comparison unit is used to compare the total number of interruptions with the interruption threshold, the total penalty value with the monitoring threshold, and the total penalty with the release threshold, and send the comparison result to the controller.
基于上述实施例,本发明还提供了一种智能终端,其原理框图可以如图10所示。该智能终端包括通过系统总线连接的处理器、存储器、网络接口、显示屏。其中,该智能终端的处理器用于提供计算和控制能力。该智能终端的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该智能终端的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种处理双向转发检测协议的会话中断消息的方法。该智能终端的显示屏可以是液晶显示屏或者电子墨水显示屏。Based on the above embodiments, the present invention also provides an intelligent terminal, the principle block diagram of which may be shown in FIG. 10 . The intelligent terminal includes a processor, a memory, a network interface and a display screen connected through a system bus. Wherein, the processor of the intelligent terminal is used to provide computing and control capabilities. The memory of the intelligent terminal includes a non-volatile storage medium and an internal memory. The nonvolatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the execution of the operating system and computer programs in the non-volatile storage medium. The network interface of the intelligent terminal is used for communicating with external terminals through network connection. The computer program, when executed by a processor, implements a method of processing a session interruption message of a bidirectional forwarding detection protocol. The display screen of the smart terminal may be a liquid crystal display screen or an electronic ink display screen.
本领域技术人员可以理解,图10中示出的原理框图,仅仅是与本发明方案相关的部分结构的框图,并不构成对本发明方案所应用于其上的智能终端的限定,具体的智能终端可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the principle block diagram shown in FIG. 10 is only a block diagram of a partial structure related to the solution of the present invention, and does not constitute a limitation on the intelligent terminal to which the solution of the present invention is applied. More or fewer components than shown in the figures may be included, or some components may be combined, or have a different arrangement of components.
在一种实现方式中,所述智能终端的存储器中存储有一个或者一个以上的程序,且经配置以由一个或者一个以上处理器执行所述一个或者一个以上程序包含用于进行处理双向转发检测协议的会话中断消息的方法的指令。In one implementation, one or more programs are stored in the memory of the smart terminal and are configured to be executed by one or more processors including for processing bidirectional forwarding detection Instructions for the protocol's method of session interruption messages.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本发明所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage In the medium, when the computer program is executed, it may include the processes of the above-mentioned method embodiments. Wherein, any reference to memory, storage, database or other medium used in the various embodiments provided by the present invention may include non-volatile and/or volatile memory. Nonvolatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Road (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
综上所述,本发明公开了一种处理双向转发检测协议的会话中断消息的方法及存储介质,所述方法包括:获取双向转发检测协议(BFD)的会话中断消息,得到BFD会话中断总次数;根据所述BFD会话中断总次数和中断阈值,增加BFD会话的惩罚值,得到惩罚总值;根据所述惩罚总值和监控阈值,将系统状态设置为监控状态并执行将所述惩罚总值进行递减的操作,得到衰减值;根据所述衰减值和解除阈值,调节系统状态并通过原端口进行流量转发。从而有效地避免当建立BFD会话的两端之间的链路发生频繁性链路中断的情况时,上层协议发生流量的频繁切换,导致网络不稳定的情况发生。In summary, the present invention discloses a method and a storage medium for processing a session interruption message of a bidirectional forwarding detection protocol, the method comprising: acquiring a session interruption message of a bidirectional forwarding detection protocol (BFD), and obtaining the total number of BFD session interruptions ; According to the total number of interruptions of the BFD session and the interruption threshold, increase the penalty value of the BFD session to obtain the penalty value; According to the penalty total value and the monitoring threshold, the system state is set to the monitoring state and execute the penalty value. Perform a decrement operation to obtain an attenuation value; adjust the system state and forward traffic through the original port according to the attenuation value and the release threshold. Therefore, when frequent link interruptions occur on the link between the two ends of the established BFD session, frequent traffic switching of upper-layer protocols occurs, resulting in network instability.
应当理解的是,本发明的应用不限于上述的举例,对本领域普通技术人员来说,可以根据上述说明加以改进或变换,所有这些改进和变换都应属于本发明所附权利要求的保护范围。It should be understood that the application of the present invention is not limited to the above examples. For those of ordinary skill in the art, improvements or transformations can be made according to the above descriptions, and all these improvements and transformations should belong to the protection scope of the appended claims of the present invention.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202011131837.1ACN112422442B (en) | 2020-10-21 | 2020-10-21 | Method for processing session interrupt message of bidirectional forwarding detection protocol and storage medium |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202011131837.1ACN112422442B (en) | 2020-10-21 | 2020-10-21 | Method for processing session interrupt message of bidirectional forwarding detection protocol and storage medium |
| Publication Number | Publication Date |
|---|---|
| CN112422442A CN112422442A (en) | 2021-02-26 |
| CN112422442Btrue CN112422442B (en) | 2022-07-05 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202011131837.1AActiveCN112422442B (en) | 2020-10-21 | 2020-10-21 | Method for processing session interrupt message of bidirectional forwarding detection protocol and storage medium |
| Country | Link |
|---|---|
| CN (1) | CN112422442B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115499364A (en)* | 2021-06-18 | 2022-12-20 | 中兴通讯股份有限公司 | Link processing method, device, network equipment and storage medium |
| CN115208860B (en)* | 2022-07-06 | 2024-08-20 | 抖音视界(北京)有限公司 | Interrupt rate determining method, device, electronic equipment, processing equipment and medium |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101483592A (en)* | 2009-02-05 | 2009-07-15 | 中兴通讯股份有限公司 | Method and apparatus for inhibiting bidirectional forwarding detection link oscillation |
| CN101800673A (en)* | 2010-02-03 | 2010-08-11 | 中兴通讯股份有限公司 | Method and device of bidirectional forwarding detection (BFD) oscillation damping |
| CN101827010A (en)* | 2010-04-30 | 2010-09-08 | 华为技术有限公司 | Method and device for inhabiting VPN (Virtual Private Network) tunnel oscillation |
| CN101867502A (en)* | 2010-06-02 | 2010-10-20 | 中兴通讯股份有限公司 | Method and device for inhibiting port oscillation |
| CN106572008A (en)* | 2015-10-13 | 2017-04-19 | 中兴通讯股份有限公司 | Method and apparatus for suppressing neighbor oscillation |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102075390B (en)* | 2011-02-16 | 2012-08-22 | 华为技术有限公司 | Transmission state detection method and related device thereof |
| CN104980293B (en)* | 2014-04-02 | 2019-05-31 | 深圳市中兴微电子技术有限公司 | A kind of OAM message is quickly sent and the method and device of detection processing |
| CN109039746B (en)* | 2018-08-07 | 2022-02-25 | 新华三技术有限公司 | Method for detecting bidirectional forwarding path and detecting session state and processor |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101483592A (en)* | 2009-02-05 | 2009-07-15 | 中兴通讯股份有限公司 | Method and apparatus for inhibiting bidirectional forwarding detection link oscillation |
| CN101800673A (en)* | 2010-02-03 | 2010-08-11 | 中兴通讯股份有限公司 | Method and device of bidirectional forwarding detection (BFD) oscillation damping |
| CN101827010A (en)* | 2010-04-30 | 2010-09-08 | 华为技术有限公司 | Method and device for inhabiting VPN (Virtual Private Network) tunnel oscillation |
| CN101867502A (en)* | 2010-06-02 | 2010-10-20 | 中兴通讯股份有限公司 | Method and device for inhibiting port oscillation |
| CN106572008A (en)* | 2015-10-13 | 2017-04-19 | 中兴通讯股份有限公司 | Method and apparatus for suppressing neighbor oscillation |
| Publication number | Publication date |
|---|---|
| CN112422442A (en) | 2021-02-26 |
| Publication | Publication Date | Title |
|---|---|---|
| US20090046579A1 (en) | Lesser disruptive open shortest path first handling of bidirectional forwarding detection state changes | |
| CN112422442B (en) | Method for processing session interrupt message of bidirectional forwarding detection protocol and storage medium | |
| CN108880917A (en) | Switching method and device of control surface equipment and switching control separation system | |
| CN104506392B (en) | A kind of delay machine detection method and equipment | |
| US10541904B2 (en) | Establishing a network fault detection session | |
| WO2016095344A1 (en) | Link switching method and device, and line card | |
| WO2013127164A1 (en) | Method for triggering bypass equipment switching, and bypass equipment switching method and device | |
| CN101437175A (en) | Method, apparatus and system for processing disaster-tolerating switch | |
| CN102970167A (en) | Method for detecting faults of network nodes in cluster system, network node and system | |
| CN113364618B (en) | Power grid monitoring system master-slave equipment anti-error switching method based on penalty coefficient rule | |
| US8775869B2 (en) | Device and method for coordinating automatic protection switching operation and recovery operation | |
| US20030014516A1 (en) | Recovery support for reliable messaging | |
| CN110417761B (en) | Communication method and device based on dual-computer redundancy | |
| CN115396308B (en) | System, method and device for maintaining network stability of data center | |
| CN106330699B (en) | Multicast link switching method and device and routing equipment | |
| CN105281927A (en) | Method and device for multilink protection switching | |
| CN114095341A (en) | Network recovery method and device, computer equipment and storage medium | |
| CN119232519A (en) | A method, device, equipment and medium for data transmission in a CAN network | |
| WO2016154921A1 (en) | Data transmission method and device for data service | |
| CN111934909A (en) | Method and device for switching IP (Internet protocol) resources of host and standby machine, computer equipment and storage medium | |
| CN115842751B (en) | Link detection method, device, system, equipment and readable storage medium | |
| CN113872860B (en) | Path switching method and device | |
| CN113726650B (en) | SBFD detection method and network equipment | |
| CN112714060B (en) | Link detection method and device | |
| CN109818870B (en) | Multicast routing method, device, service board and machine readable storage medium |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |