2727#include "bgpd/bgp_vty.h"
2828#include "bgpd/bgp_packet.h"
2929#include "bgpd/bgp_network.h"
30+ #ifndef VTYSH_EXTRACT_PL
31+ #include "bgpd/bgp_bfd_clippy.c"
32+ #endif
3033
3134DEFINE_MTYPE_STATIC (BGPD , BFD_CONFIG , "BFD configuration data" );
3235
@@ -420,8 +423,7 @@ void bgp_peer_remove_bfd_config(struct peer *p)
420423/*
421424 * bgp_bfd_peer_config_write - Write the peer BFD configuration.
422425 */
423- void bgp_bfd_peer_config_write (struct vty * vty , const struct peer * peer ,
424- const char * addr )
426+ void bgp_bfd_peer_config_write (struct vty * vty , struct peer * peer , const char * addr )
425427{
426428 /*
427429 * Always show group BFD configuration, but peer only when explicitly
@@ -446,13 +448,15 @@ void bgp_bfd_peer_config_write(struct vty *vty, const struct peer *peer,
446448 if (peer -> bfd_config -> cbit )
447449 vty_out (vty , " neighbor %s bfd check-control-plane-failure\n" ,
448450 addr );
451+
452+ if (peergroup_flag_check (peer , PEER_FLAG_BFD_STRICT ))
453+ vty_out (vty , " neighbor %s bfd strict\n" , addr );
449454}
450455
451456/*
452457 * bgp_bfd_show_info - Show the peer BFD information.
453458 */
454- void bgp_bfd_show_info (struct vty * vty , const struct peer * peer ,
455- json_object * json_neigh )
459+ void bgp_bfd_show_info (struct vty * vty , struct peer * peer , json_object * json_neigh )
456460{
457461 bfd_sess_show (vty , json_neigh , peer -> bfd_config -> session );
458462}
@@ -481,11 +485,49 @@ DEFUN (neighbor_bfd,
481485 return CMD_SUCCESS ;
482486}
483487
488+ #if HAVE_BFDD == 0
489+ DEFUN (
490+ neighbor_bfd_param ,
491+ neighbor_bfd_param_cmd ,
492+ "neighbor <A.B.C.D|X:X::X:X|WORD> bfd (2-255) (50-60000) (50-60000)" ,
493+ NEIGHBOR_STR
494+ NEIGHBOR_ADDR_STR2
495+ "Enables BFD support\n"
496+ "Detect Multiplier\n"
497+ "Required min receive interval\n"
498+ "Desired min transmit interval\n" )
499+ {
500+ int idx_peer = 1 ;
501+ int idx_number_1 = 3 ;
502+ int idx_number_2 = 4 ;
503+ int idx_number_3 = 5 ;
504+ long detection_multiplier , min_rx , min_tx ;
505+ struct peer * peer ;
506+
507+ peer = peer_and_group_lookup_vty (vty , argv [idx_peer ]-> arg );
508+ if (!peer )
509+ return CMD_WARNING_CONFIG_FAILED ;
510+
511+ detection_multiplier = strtol (argv [idx_number_1 ]-> arg , NULL , 10 );
512+ min_rx = strtol (argv [idx_number_2 ]-> arg , NULL , 10 );
513+ min_tx = strtol (argv [idx_number_3 ]-> arg , NULL , 10 );
514+
515+ if (CHECK_FLAG (peer -> sflags , PEER_STATUS_GROUP ))
516+ bgp_group_configure_bfd (peer );
517+ else
518+ bgp_peer_configure_bfd (peer , true);
519+
520+ peer -> bfd_config -> detection_multiplier = detection_multiplier ;
521+ peer -> bfd_config -> min_rx = min_rx ;
522+ peer -> bfd_config -> min_tx = min_tx ;
523+ bgp_peer_config_apply (peer , peer -> group );
524+
525+ return CMD_SUCCESS ;
526+ }
527+ #endif
528+
484529#if HAVE_BFDD > 0
485530DEFUN_HIDDEN (
486- #else
487- DEFUN (
488- #endif /* HAVE_BFDD */
489531 neighbor_bfd_param ,
490532 neighbor_bfd_param_cmd ,
491533 "neighbor <A.B.C.D|X:X::X:X|WORD> bfd (2-255) (50-60000) (50-60000)" ,
@@ -523,6 +565,28 @@ DEFUN(
523565
524566 return CMD_SUCCESS ;
525567}
568+ #endif
569+
570+ DEFPY (neighbor_bfd_strict ,
571+ neighbor_bfd_strict_cmd ,
572+ "[no$no] neighbor <A.B.C.D|X:X::X:X|WORD>$neighbor bfd strict" ,
573+ NO_STR
574+ NEIGHBOR_STR
575+ NEIGHBOR_ADDR_STR2
576+ "BFD support\n"
577+ "Strict mode\n" )
578+ {
579+ struct peer * peer ;
580+
581+ peer = peer_and_group_lookup_vty (vty , neighbor );
582+ if (!peer )
583+ return CMD_WARNING_CONFIG_FAILED ;
584+
585+ if (no )
586+ return peer_flag_unset (peer , PEER_FLAG_BFD_STRICT );
587+
588+ return peer_flag_set (peer , PEER_FLAG_BFD_STRICT );
589+ }
526590
527591DEFUN (neighbor_bfd_check_controlplane_failure ,
528592 neighbor_bfd_check_controlplane_failure_cmd ,
@@ -556,38 +620,58 @@ DEFUN (neighbor_bfd_check_controlplane_failure,
556620 return CMD_SUCCESS ;
557621 }
558622
623+ #if HAVE_BFDD > 0
559624DEFUN (no_neighbor_bfd ,
560625 no_neighbor_bfd_cmd ,
561- #if HAVE_BFDD > 0
562626 "no neighbor <A.B.C.D|X:X::X:X|WORD> bfd" ,
563- #else
627+ NO_STR
628+ NEIGHBOR_STR
629+ NEIGHBOR_ADDR_STR2
630+ "Disables BFD support\n" )
631+ {
632+ int idx_peer = 2 ;
633+ struct peer * peer ;
634+
635+ peer = peer_and_group_lookup_vty (vty , argv [idx_peer ]-> arg );
636+ if (!peer )
637+ return CMD_WARNING_CONFIG_FAILED ;
638+
639+ if (CHECK_FLAG (peer -> sflags , PEER_STATUS_GROUP ))
640+ bgp_group_remove_bfd (peer );
641+ else
642+ bgp_peer_remove_bfd (peer );
643+
644+ return CMD_SUCCESS ;
645+ }
646+ #endif
647+
648+ #if HAVE_BFDD == 0
649+ DEFUN (no_neighbor_bfd ,
650+ no_neighbor_bfd_cmd ,
564651 "no neighbor <A.B.C.D|X:X::X:X|WORD> bfd [(2-255) (50-60000) (50-60000)]" ,
565- #endif /* HAVE_BFDD */
566652 NO_STR
567653 NEIGHBOR_STR
568654 NEIGHBOR_ADDR_STR2
569655 "Disables BFD support\n"
570- #if HAVE_BFDD == 0
571656 "Detect Multiplier\n"
572657 "Required min receive interval\n"
573- "Desired min transmit interval\n"
574- #endif /* !HAVE_BFDD */
575- )
576- {
577- int idx_peer = 2 ;
578- struct peer * peer ;
658+ "Desired min transmit interval\n" )
659+ {
660+ int idx_peer = 2 ;
661+ struct peer * peer ;
579662
580- peer = peer_and_group_lookup_vty (vty , argv [idx_peer ]-> arg );
581- if (!peer )
582- return CMD_WARNING_CONFIG_FAILED ;
663+ peer = peer_and_group_lookup_vty (vty , argv [idx_peer ]-> arg );
664+ if (!peer )
665+ return CMD_WARNING_CONFIG_FAILED ;
583666
584- if (CHECK_FLAG (peer -> sflags , PEER_STATUS_GROUP ))
585- bgp_group_remove_bfd (peer );
586- else
587- bgp_peer_remove_bfd (peer );
667+ if (CHECK_FLAG (peer -> sflags , PEER_STATUS_GROUP ))
668+ bgp_group_remove_bfd (peer );
669+ else
670+ bgp_peer_remove_bfd (peer );
588671
589- return CMD_SUCCESS ;
672+ return CMD_SUCCESS ;
590673}
674+ #endif
591675
592676#if HAVE_BFDD > 0
593677DEFUN (neighbor_bfd_profile , neighbor_bfd_profile_cmd ,
@@ -657,6 +741,7 @@ void bgp_bfd_init(struct event_loop *tm)
657741 install_element (BGP_NODE , & neighbor_bfd_cmd );
658742 install_element (BGP_NODE , & neighbor_bfd_param_cmd );
659743 install_element (BGP_NODE , & neighbor_bfd_check_controlplane_failure_cmd );
744+ install_element (BGP_NODE , & neighbor_bfd_strict_cmd );
660745 install_element (BGP_NODE , & no_neighbor_bfd_cmd );
661746
662747#if HAVE_BFDD > 0
0 commit comments