patents.google.com

CN106301840B - Method and device for sending Bidirectional Forwarding Detection (BFD) message - Google Patents

  • ️Tue Sep 15 2020
双向转发检测BFD报文的发送方法及装置Method and device for sending bidirectional forwarding detection BFD message

技术领域technical field

本发明涉及通信领域,具体而言,涉及一种双向转发检测BFD报文的发送方法及装置。The present invention relates to the field of communications, and in particular, to a method and a device for sending BFD packets for bidirectional forwarding detection.

背景技术Background technique

双向转发检测(Bidirectional Forwarding Detection简称为BFD)协议提供了一个通用的标准化的介质无关和协议无关的快速故障检测机制。Bidirectional Forwarding Detection (BFD for short) protocol provides a general and standardized medium-independent and protocol-independent fast fault detection mechanism.

BFD在两台网络设备上建立会话,用来检测网络设备间的双向转发路径,为上层应用服务。BFD本身并没有邻居发现机制,而是靠被服务的上层应用通知其邻居信息以建立会话。会话建立后会周期性地快速发送检测报文,如果在检测时间内没有收到BFD报文,则认为该双向转发路径发生了故障,通知被服务的上层应用进行相应的处理。BFD establishes a session on two network devices to detect bidirectional forwarding paths between network devices and serve upper-layer applications. BFD itself does not have a neighbor discovery mechanism, but relies on the upper-layer application being served to notify its neighbor information to establish a session. After the session is established, detection packets are sent periodically and quickly. If no BFD packets are received within the detection time, it is considered that the bidirectional forwarding path is faulty, and the upper-layer application being served is notified to perform corresponding processing.

BFD正常工作时,会话的状态为UP,表示链路为稳定状态。BFD会话在UP状态时,会按照配置的间隔发送检测报文。每当双方设备收到BFD检测报文时,就会重置检测时间定时器,保持会话UP状态。如果在检测时间内没有收到BFD检测报文,则认为链路可能发生了故障,BFD会话会迁移到DOWN状态。When BFD works normally, the status of the session is Up, indicating that the link is in a stable state. When the BFD session is in the Up state, detection packets are sent at the configured interval. Whenever the two devices receive a BFD detection packet, they reset the detection time timer and keep the session Up state. If no BFD detection packet is received within the detection time, the link is considered to be faulty, and the BFD session transitions to the DOWN state.

BFD需要在两台设备上配置,假设两台设备分别为A和B,BFD当前正常保持UP状态。当用户在B设备上删除会话操作时,会同时发生如下两个事件:BFD needs to be configured on two devices. Assume that the two devices are A and B respectively. BFD is currently in the Up state normally. When the user deletes the session operation on the B device, the following two events will occur at the same time:

1、B设备立刻停止发送检测报文;1. Device B immediately stops sending detection packets;

2、B设备在删除会话时,会向A设备会发送一个状态值置为ADMINDOWN的BFD控制报文。此报文为协议报文,目的是通知A设备删除会话;A设备收到此报文后,会直接将BFD会话删除。2. When device B deletes the session, it will send a BFD control packet with the status value set to ADMINDOWN to device A. This packet is a protocol packet to notify device A to delete the session; device A will delete the BFD session directly after receiving this packet.

假设A和B设备BFD的检测时间为t1,由于删除时,B设备立刻停止发送检测报文,A设备在t1时间内若未收到B发来的检测报文,则A设备的BFD就会报检测DOWN。与此同时,B设备发送ADMINDOWN协议报文到达A,A设备收到该报文进行处理并且将该条BFD删除的时间为t2。若t1>t2,ADMINDOWN先处理完,则会话可以正常删除,没有问题;若t1<t2,则BFD会认为是检测DOWN,认为该链路发生故障,BFD关联到业务时,会将流量迅速切换到备份链路。因此,在删除远端会话时,如果不迅速处理ADMINDOWN这种报文,提高处理效率,在链路并无故障的情况下,会导致主备链路误切。Assuming that the BFD detection time of devices A and B is t1, since device B stops sending detection packets immediately when it is deleted, if device A does not receive the detection packet from device B within t1, the BFD of device A will Report detection DOWN. At the same time, device B sends an ADMINDOWN protocol packet to A, and device A receives the packet, processes it, and deletes the BFD at t2. If t1>t2, ADMINDOWN is processed first, then the session can be deleted normally without any problem; if t1<t2, BFD will consider it to detect DOWN, and consider that the link is faulty. When BFD is associated with a service, it will quickly switch the traffic to the backup link. Therefore, when the remote session is deleted, if the ADMINDOWN message is not processed quickly to improve the processing efficiency, the active and standby links will be switched by mistake when the link is not faulty.

在分布式架构中,设备分为主控和线卡,图1是相关技术中主控和线卡BFD会话的示意图,如图1所示,协议栈均建在主控上,主控还负责所有在线线卡的管理;而线卡负责接收和发送报文。线卡从端口收到报文,解析器解析为协议报文后,均需要送给主控处理,BFD保活报文则送给BFD定时器处理。在网络配置比较多的情况下,主控经常会遇到CPU比较忙的情况,往往在处理别的优先级更高的协议,或者其他线卡的管理,对BFD协议报文往往不能实时处理,不能及时通知线卡删除BFD会话。若不能及时响应BFD的ADMINDOWN报文而删除会话,超过检测周期后会产生BFD报检测DOWN,则会导致误切。这种情况往往会出现在网络可靠性要求很高的网络上,BFD检测周期配置一般都比较短,则更容易产生这种情况。In the distributed architecture, the device is divided into the main controller and the line card. Figure 1 is a schematic diagram of the BFD session between the main controller and the line card in the related art. As shown in Figure 1, the protocol stack is built on the main controller, and the main controller is also responsible for All online line cards are managed; the line cards are responsible for receiving and sending messages. After the line card receives the packet from the port, and the parser parses it into a protocol packet, it needs to be sent to the master for processing, and the BFD keep-alive packet is sent to the BFD timer for processing. In the case of many network configurations, the master controller often encounters a situation where the CPU is relatively busy, and is often processing other protocols with higher priority, or the management of other line cards, and often cannot process BFD protocol packets in real time. The line card cannot be notified in time to delete the BFD session. If the session cannot be deleted by responding to the ADMINDOWN message of BFD in time, a BFD detection DOWN message will be generated after the detection period expires, which will result in a false switch. This situation often occurs on networks that require high network reliability. Generally, the BFD detection period is configured to be relatively short, which is more likely to occur.

因此,相关技术中的上送主控处理这种方式处理BFD报文时,无法保证及时正确处理相应的BFD报文,容易发生误切。针对相关技术中上述问题,目前尚未提出有效的解决方案。Therefore, when the BFD packet is processed by the sending master in the related art, it cannot guarantee the timely and correct processing of the corresponding BFD packet, which is prone to miscutting. For the above-mentioned problems in the related art, no effective solution has yet been proposed.

发明内容SUMMARY OF THE INVENTION

本发明的主要目的在于提供一种双向转发检测BFD报文的发送方法及装置,以至少解决相关技术中对于BFD报文的处理容易发生误处理的问题。The main purpose of the present invention is to provide a method and a device for sending a BFD packet for bidirectional forwarding and detection, so as to at least solve the problem that the processing of the BFD packet is prone to error processing in the related art.

根据本发明的一个方面,提供了一种双向转发检测BFD报文的发送方法,包括:在双向转发检测BFD会话建立时,分布式系统中的线卡解析出接收到的BFD报文的类型;所述线卡激活与所述类型相对应的定时器;在所述定时器超时,所述线卡向分布式系统中的主控发送与所述定时器对应的BFD报文。According to one aspect of the present invention, a method for sending a bidirectional forwarding detection BFD packet is provided, comprising: when a bidirectional forwarding detection BFD session is established, a line card in a distributed system parses out the type of the received BFD packet; The line card activates a timer corresponding to the type; when the timer expires, the line card sends a BFD packet corresponding to the timer to the master in the distributed system.

进一步地,所述BFD报文类型包括:用于删除BFD会话的ADMINDOWN报文和除ADMINDOWN报文以外的其他报文。Further, the BFD message types include: ADMINDOWN messages for deleting BFD sessions and other messages except ADMINDOWN messages.

进一步地,在所述报文为所述ADMINDOWN报文时,所述线卡激活与所述类型中指定报文对应的定时器包括:所述线卡激活与所述ADMINDOWN报文对应的第一定时器,其中,所述第一定时器的定时时间小于与除ADMINDOWN报文以外的其他报文对应的第二定时器的定时时间。Further, when the message is the ADMINDOWN message, the line card activating the timer corresponding to the message specified in the type includes: the line card activating the first timer corresponding to the ADMINDOWN message A timer, wherein the timing time of the first timer is less than the timing time of the second timer corresponding to other messages except the ADMINDOWN message.

进一步地,在所述线卡向分布式系统中的主控发送与所述定时器对应的BFD报文之前,所述方法还包括:屏蔽所述第二定时器。Further, before the line card sends the BFD message corresponding to the timer to the master in the distributed system, the method further includes: shielding the second timer.

进一步地,在所述定时器超时,所述线卡向分布式系统中的主控发送与所述定时器对应的BFD报文包括:在所述第一定时器超时,所述线卡向所述分布式系统中的主控发送所述ADMINDOWN报文。Further, when the timer times out, the line card sending the BFD message corresponding to the timer to the master in the distributed system includes: when the first timer times out, the line card sends the BFD packet to the master controller in the distributed system. The master in the distributed system sends the ADMINDOWN message.

根据本发明的另一个方面,提供了一种双向转发检测BFD报文的发送装置,位于分布式系统中的线卡测,包括:解析模块,用于在双向转发检测BFD会话建立时,解析出接收到的BFD报文的类型;激活模块,用于激活与所述类型相对应的定时器;发送模块,用于在所述定时器超时,向分布式系统中的主控发送与所述定时器对应的BFD报文。According to another aspect of the present invention, a device for sending a bidirectional forwarding detection BFD packet is provided. The line card detector located in a distributed system includes: a parsing module, configured to parse out the bidirectional forwarding detection BFD session when the bidirectional forwarding detection BFD session is established. The type of the received BFD message; the activation module is used to activate the timer corresponding to the type; the sending module is used to send the timer corresponding to the timer to the master in the distributed system when the timer expires BFD packets corresponding to the router.

进一步地,所述BFD报文类型包括:用于删除BFD会话的ADMINDOWN报文和除ADMINDOWN报文以外的其他报文。Further, the BFD message types include: ADMINDOWN messages for deleting BFD sessions and other messages except ADMINDOWN messages.

进一步地,在所述报文为所述ADMINDOWN报文时;所述激活模块,还用于激活与所述ADMINDOWN报文对应的第一定时器,其中,所述第一定时器的定时时间小于与除ADMINDOWN报文以外的其他报文对应的第二定时器的定时时间。Further, when the message is the ADMINDOWN message; the activation module is further configured to activate a first timer corresponding to the ADMINDOWN message, wherein the timing time of the first timer is less than Timing time of the second timer corresponding to other packets except ADMINDOWN packets.

进一步地,在所述线卡向分布式系统中的主控发送与所述定时器对应的BFD报文之前,所述装置还包括:屏蔽模块,用于屏蔽所述第二定时器。Further, before the line card sends the BFD message corresponding to the timer to the master in the distributed system, the apparatus further includes: a shielding module configured to shield the second timer.

进一步地,所述发送模块,还用于在所述第一定时器超时,所述线卡向所述分布式系统中的主控发送所述ADMINDOWN报文。Further, the sending module is further configured to send the ADMINDOWN message to the master in the distributed system by the line card when the first timer expires.

在本发明中,采用在双向转发检测BFD会话建立时,根据分布式系统中的线卡解析出接收到的BFD报文的类型,激活与报文类型相对应的定时器,在相应的定时器超时时,线卡向分布式系统中的主控发送与定时器对应的BFD报文的方式,解决了相关技术中BFD报文的处理容易发生误处理的问题,填补了相关技术的空白。In the present invention, when the bidirectional forwarding detects the establishment of a BFD session, the type of the received BFD message is parsed according to the line card in the distributed system, and the timer corresponding to the message type is activated, and the corresponding timer When the timeout is exceeded, the line card sends the BFD packet corresponding to the timer to the master in the distributed system, which solves the problem that the processing of the BFD packet in the related art is prone to error processing, and fills the gap in the related art.

附图说明Description of drawings

此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:The accompanying drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the attached image:

图1是相关技术中主控和线卡BFD会话的示意图;1 is a schematic diagram of a master control and a line card BFD session in the related art;

图2是根据本发明实施例的双向转发检测BFD报文的发送方法的流程图;2 is a flowchart of a method for sending a bidirectional forwarding detection BFD packet according to an embodiment of the present invention;

图3是根据本发明实施例的双向转发检测BFD报文的发送装置的结构框图;3 is a structural block diagram of a device for sending a BFD packet for bidirectional forwarding and detection according to an embodiment of the present invention;

图4是根据本发明实施例的双向转发检测BFD报文的发送装置的可选结构框图一;4 is an optional structural block diagram 1 of a device for sending a BFD packet for bidirectional forwarding and detection according to an embodiment of the present invention;

图5是根据本发明可选实施例的改进BFD删除时误报DOWN而导致误切的系统框架图;5 is a system frame diagram of a false alarm of DOWN when an improved BFD is deleted according to an optional embodiment of the present invention;

图6是根据本发明实施例的改进BFD删除时误报DOWN而导致误切方法的流程图。FIG. 6 is a flowchart of an improved method for falsely reporting DOWN when BFD is deleted according to an embodiment of the present invention.

具体实施方式Detailed ways

需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本发明。It should be noted that the embodiments in the present application and the features of the embodiments may be combined with each other in the case of no conflict. The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.

本实施例提供了一种双向转发检测BFD报文的发送方法,图2是根据本发明实施例的双向转发检测BFD报文的发送方法的流程图,如图2所示,该方法的步骤包括:This embodiment provides a method for sending a bidirectional forwarding detection BFD packet. FIG. 2 is a flowchart of a method for sending a bidirectional forwarding detection BFD packet according to an embodiment of the present invention. As shown in FIG. 2 , the steps of the method include: :

步骤S202:在双向转发检测BFD会话建立时,分布式系统中的线卡解析出接收到的BFD报文的类型;Step S202: when the bidirectional forwarding detects the establishment of the BFD session, the line card in the distributed system parses out the type of the received BFD message;

步骤S204:线卡激活与类型相对应的定时器;Step S204: the line card activates the timer corresponding to the type;

步骤S206:在定时器超时,线卡向分布式系统中的主控发送与定时器对应的BFD报文。Step S206: When the timer expires, the line card sends a BFD packet corresponding to the timer to the master in the distributed system.

通过本实施例中的步骤S202至步骤S206,采用在双向转发检测BFD会话建立时,根据分布式系统中的线卡解析出接收到的BFD报文的类型,激活与报文类型相对应的定时器,在相应的定时器超时时,线卡向分布式系统中的主控发送与定时器对应的BFD报文的方式,解决了相关技术中BFD报文的处理容易发生误处理的问题,填补了相关技术的空白。Through steps S202 to S206 in this embodiment, when the two-way forwarding detects the establishment of a BFD session, the type of the received BFD packet is parsed according to the line card in the distributed system, and the timing corresponding to the packet type is activated When the corresponding timer expires, the line card sends the BFD packet corresponding to the timer to the master in the distributed system, which solves the problem that the processing of BFD packets in the related art is prone to error processing, and fills the gaps in related technologies.

对于本实施例中涉及到得BFD报文类型可以包括:用于删除BFD会话的ADMINDOWN报文和除ADMINDOWN报文以外的其他报文。The types of BFD packets involved in this embodiment may include: ADMINDOWN packets used to delete BFD sessions and other packets except ADMINDOWN packets.

而在报文为ADMINDOWN报文时,本实施例步骤S204中的线卡激活与类型中指定报文对应的定时器的方式,在本实施例的一个可选实施方式中可以通过如下方式来实现:线卡激活与ADMINDOWN报文对应的第一定时器,其中,第一定时器的定时时间小于与除ADMINDOWN报文以外的其他报文对应的第二定时器的定时时间。However, when the packet is an ADMINDOWN packet, the manner in which the line card activates the timer corresponding to the packet specified in the type in step S204 of this embodiment may be implemented in the following manner in an optional implementation manner of this embodiment. : The line card activates the first timer corresponding to the ADMINDOWN message, wherein the timing of the first timer is shorter than the timing of the second timer corresponding to other messages except the ADMINDOWN message.

也就是说,在BFD报文中有ADMINDOWN报文时,激活与该ADMINDOWN报文对应的第一定时器,由于该第一计时器的定时时间小于除ADMINDOWN报文以外的其他报文对应的第二计时器的定时时间,使得可以及时处理ADMINDOWN报文,及通知主控删除该BFD会话。That is to say, when there is an ADMINDOWN packet in the BFD packet, the first timer corresponding to the ADMINDOWN packet is activated, because the timing time of the first timer is shorter than the first timer corresponding to other packets except the ADMINDOWN packet. The timing of the second timer makes it possible to process the ADMINDOWN message in time and notify the master to delete the BFD session.

为了更好的及时处理ADMINDOWN报文,在本实施例的另一个可选实施方式中,在线卡向分布式系统中的主控发送与定时器对应的BFD报文之前,本实施例的方法还可以包括:屏蔽第二定时器。通过该方式,防止了第二定时器超时,更加确保了能够及时处理ADMINDOWN报文。In order to better timely process the ADMINDOWN message, in another optional implementation manner of this embodiment, before the line card sends the BFD message corresponding to the timer to the master in the distributed system, the method of this embodiment further It may include: shielding the second timer. In this way, the timeout of the second timer is prevented, and it is further ensured that the ADMINDOWN message can be processed in time.

可选地,对于本实施例的中步骤S206中的,在定时器超时,线卡向分布式系统中的主控发送与定时器对应的BFD报文的方式,可以通过如下方式来实现包括:在第一定时器超时,线卡向分布式系统中的主控发送ADMINDOWN报文。Optionally, in step S206 of this embodiment, when the timer times out, the line card sends the BFD message corresponding to the timer to the master in the distributed system, which can be implemented in the following ways: When the first timer expires, the line card sends an ADMINDOWN message to the master in the distributed system.

在本实施例中还提供了一种双向转发检测BFD报文的发送装置,该装置用于实现上述实施例及可选实施方式,已经进行过说明的不再赘述。如以下所使用的,术语“模块”可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。This embodiment also provides an apparatus for sending a BFD packet for bidirectional forwarding and detection. The apparatus is used to implement the foregoing embodiments and optional implementation manners, and what has been described will not be repeated. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, implementations in hardware, or a combination of software and hardware, are also possible and contemplated.

图3是根据本发明实施例的双向转发检测BFD报文的发送装置的结构框图,如图3所示,该装置位于分布式系统中的线卡测,该装置包括:解析模块32,用于解析出接收到的双向转发检测BFD报文的类型;激活模块34,与解析模块32耦合连接,用于激活与类型相对应的定时器;发送模块36,与激活模块34耦合连接,用于在定时器超时,向分布式系统中的主控发送与定时器对应的BFD报文。FIG. 3 is a structural block diagram of a device for sending BFD packets for bidirectional forwarding and detection according to an embodiment of the present invention. As shown in FIG. 3 , the device is located in a line card tester in a distributed system, and the device includes: a parsing module 32 for Parse out the type of the received bidirectional forwarding detection BFD message; the activation module 34 is coupled and connected with the parsing module 32 for activating the timer corresponding to the type; the sending module 36 is coupled and connected with the activation module 34 for in When the timer expires, a BFD packet corresponding to the timer is sent to the master in the distributed system.

可选地,BFD报文包括:用于删除BFD会话的ADMINDOWN报文和除ADMINDOWN报文以外的其他报文。Optionally, the BFD message includes: an ADMINDOWN message for deleting the BFD session and other messages except the ADMINDOWN message.

可选地,在报文为ADMINDOWN报文时,该激活模块34,还用于激活与ADMINDOWN报文对应的第一定时器,其中,第一定时器的定时时间小于与除ADMINDOWN报文以外的其他报文对应的第二定时器的定时时间。Optionally, when the message is an ADMINDOWN message, the activation module 34 is further configured to activate a first timer corresponding to the ADMINDOWN message, wherein the timing time of the first timer is shorter than that of the first timer except for the ADMINDOWN message. Timing time of the second timer corresponding to other packets.

可选地,该发送模块36,还用于在第一定时器超时,线卡向分布式系统中的主控发送ADMINDOWN报文。Optionally, the sending module 36 is further configured to send an ADMINDOWN message to the master in the distributed system when the first timer expires.

图4是根据本发明实施例的双向转发检测BFD报文的发送装置的可选结构框图一,如图4所示,在线卡向分布式系统中的主控发送与定时器对应的BFD报文之前,该装置还包括:屏蔽模块42,与发送模块36耦合连接,用于屏蔽第二定时器。FIG. 4 is an optional structural block diagram 1 of a device for sending a BFD packet for bidirectional forwarding and detection according to an embodiment of the present invention. As shown in FIG. 4 , the line card sends a BFD packet corresponding to a timer to the master in the distributed system. Before, the device further includes: a shielding module 42, which is coupled and connected to the sending module 36 and used to shield the second timer.

下面结合本发明实施例的可选实施例对本发明进行举例说明;The present invention is exemplified below in conjunction with optional embodiments of the embodiments of the present invention;

本可选实施例提供了一种改进BFD删除时误报DOWN而导致误切的方法及相应系统,图5是根据本发明可选实施例的改进BFD删除时误报DOWN而导致误切的系统框架图,如图5所示,该系统包括:This optional embodiment provides a method and a corresponding system for improving a false alarm of DOWN when BFD is deleted, resulting in a erroneous cut. The frame diagram, as shown in Figure 5, the system includes:

解析器501,用于报文到达线卡接口后,进入解析器中解析报文,并解析出报文的类型,对报文进行不同的处理。该解析器501能够解析出普通BFD检测报文和BFD ADMINDOWN报文。The parser 501 is used for entering the parser to parse the packet after the packet arrives at the line card interface, parses out the type of the packet, and performs different processing on the packet. The parser 501 can parse out ordinary BFD detection packets and BFD ADMINDOWN packets.

BFD定时器502,用于在BFD会话建立时创建,经过解析器501解析出的每个普通检测报文,都会送到BFD定时器502,进行复位等操作。The BFD timer 502 is used to create a BFD session when the BFD session is established, and each common detection packet parsed by the parser 501 will be sent to the BFD timer 502 for reset and other operations.

超短定时器503,用于在被解析器501解析出为ADMINDOWN的报文时激活该超短定时器503,此时超短定时器就会立刻开始计时,其中,超短定时器的时间远远低于BFD定时器的时间。由于时间远远短于BFD定时器,因此可以立即超时。激活该超短定时器503的同时会屏蔽BFD定时器502。The ultra-short timer 503 is used to activate the ultra-short timer 503 when the packet parsed by the parser 501 is ADMINDOWN. At this time, the ultra-short timer will start timing immediately. Much lower than the time of the BFD timer. Since the time is much shorter than the BFD timer, it can time out immediately. When the ultra-short timer 503 is activated, the BFD timer 502 is blocked.

主控协议栈504,用于在超短定时器503超时后,会通知主控协议栈,主控协议栈会下发线卡的删除操作。The main control protocol stack 504 is used to notify the main control protocol stack after the ultra-short timer 503 times out, and the main control protocol stack will issue a line card deletion operation.

图6是根据本发明实施例的改进BFD删除时误报DOWN而导致误切方法的流程图,如图6所示,该方法的步骤包括:FIG. 6 is a flowchart of an improved method for incorrectly reporting DOWN when deleting BFD according to an embodiment of the present invention. As shown in FIG. 6 , the steps of the method include:

步骤S602:报文解析;在解析出为ADMINDOWN报文时,执行步骤S604,在解析出为其他普通报文时,执行步骤S612;Step S602: packet parsing; when it is parsed as an ADMINDOWN packet, execute step S604, and when it is parsed as other ordinary packets, execute step S612;

其中,报文到达线卡接口后,解析出报文的类型,对报文进行不同的处理。该模块需要能够解析出普通BFD检测报文和BFD ADMINDOWN报文;Among them, after the packet arrives at the line card interface, the type of the packet is parsed, and different processing is performed on the packet. The module needs to be able to parse out ordinary BFD detection packets and BFD ADMINDOWN packets;

步骤S604:解析出为BFD ADMINDOWN报文激活超短定时器;Step S604: It is parsed that the ultra-short timer is activated for the BFD ADMINDOWN message;

步骤S606:屏蔽BFD定时器,以防止BFD定时器超时;Step S606: shielding the BFD timer to prevent the BFD timer from timing out;

步骤S608:被激活的超短定时器超时后,通知主控协议栈删除会话;Step S608: after the activated ultra-short timer times out, notify the main control protocol stack to delete the session;

步骤S610:超短定时器任务完成;Step S610: the ultra-short timer task is completed;

步骤S612:BFD正常检测报文;Step S612: BFD normally detects the message;

步骤S614:BFD定时器被屏蔽,超时后不做任何操作;Step S614: the BFD timer is shielded, and no operation is performed after the timeout;

步骤S616:普通流程完成。Step S616: the normal flow is completed.

相关技术中是将协议报文上送主控,由主控的BFD协议栈下发删除。本可选实施例不需要将报文上送主控协议栈处理,而是在线卡上直接处理这种特殊的协议报文。线卡上不需要建立协议栈,而是在会话创建时,除了本来应该创建的BFD会话定时器(对应于第二定时器)之外,再创建另一个较短周期的定时器(对应于第一定时器),此定时器的时间设置远远低于会话本身的检测周期。当线卡收到BFD报文后,经过解析器解析出ADMINDOWN报文后,激活该定时器,并且屏蔽本来会话的定时器,这样本来会话就不会误报DOWN,在该超短定时器的超时事件时,通知协议层面删除会话。In the related art, the protocol message is sent to the master, and the BFD protocol stack of the master sends and deletes it. This optional embodiment does not need to send the message to the main control protocol stack for processing, but directly processes this special protocol message on the line card. There is no need to establish a protocol stack on the line card, but when a session is created, in addition to the BFD session timer (corresponding to the second timer) that should be created, another timer with a shorter period (corresponding to the first timer) is created. A timer), the time setting of this timer is much lower than the detection period of the session itself. When the line card receives the BFD packet and parses the ADMINDOWN packet through the parser, it activates the timer and blocks the timer of the original session, so that the original session will not falsely report DOWN. When a timeout event occurs, the protocol layer is notified to delete the session.

在另外一个实施例中,还提供了一种软件,该软件用于执行上述实施例及优选实施方式中描述的技术方案。In another embodiment, a software is also provided, and the software is used to execute the technical solutions described in the foregoing embodiment and the preferred implementation manner.

在另外一个实施例中,还提供了一种存储介质,该存储介质中存储有上述软件,该存储介质包括但不限于:光盘、软盘、硬盘、可擦写存储器等。In another embodiment, a storage medium is also provided, in which the above-mentioned software is stored, and the storage medium includes but is not limited to: an optical disk, a floppy disk, a hard disk, a rewritable memory, and the like.

显然,本领域的技术人员应该明白,上述本发明的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件结合。Obviously, those skilled in the art should understand that each module or each step of the present invention can be implemented by a general-purpose computing device, and they can be centralized on a single computing device or distributed on a network composed of multiple computing devices , optionally, they can be implemented in program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, in an order different from that here The steps shown or described can be implemented either by fabricating them separately into individual integrated circuit modules, or by fabricating multiple modules or steps of them into a single integrated circuit module. As such, the present invention is not limited to any particular combination of hardware and software.

上述仅为本发明的可选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above are only optional embodiments of the present invention, and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.