From 8c4f63817a1861adf8dba97849c4ef60b17432bc Mon Sep 17 00:00:00 2001 From: vivek Date: Thu, 8 Sep 2016 10:03:30 -0700 Subject: [PATCH] bgpd: Process directly connected IBGP peers upon interface down When we have a single-hop BFD session for any peering, it really means that the peering is directly connected (maybe over a L2 network), whether it is IBGP or EBGP. In such a case, upon link down, immediately process IBGP peers too (and bring them down), not just EBGP peers. This change eliminates some peculiar state transitions in specific IBGP topologies, thus getting rid of the problem of nexthops remaining inactive in the zebra RIB. Signed-off-by: Vivek Venkatraman Reviewed-by: Donald Sharp Reviewed-by: Daniel Walton Ticket: CM-12390 Reviewed By: CCR-5156 Testing Done: Manual, bgp-smoke --- bgpd/bgp_bfd.c | 2 +- bgpd/bgp_bfd.h | 3 +++ bgpd/bgp_zebra.c | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index b8b0053695..aeac93e7b3 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -71,7 +71,7 @@ bgp_bfd_peer_group2peer_copy(struct peer *conf, struct peer *peer) /* * bgp_bfd_is_peer_multihop - returns whether BFD peer is multi-hop or single hop. */ -static int +int bgp_bfd_is_peer_multihop(struct peer *peer) { struct bfd_info *bfd_info; diff --git a/bgpd/bgp_bfd.h b/bgpd/bgp_bfd.h index 4e554af696..e872637e3e 100644 --- a/bgpd/bgp_bfd.h +++ b/bgpd/bgp_bfd.h @@ -42,4 +42,7 @@ bgp_bfd_peer_config_write(struct vty *vty, struct peer *peer, char *addr); extern void bgp_bfd_show_info(struct vty *vty, struct peer *peer, u_char use_json, json_object *json_neigh); +extern int +bgp_bfd_is_peer_multihop(struct peer *peer); + #endif /* _QUAGGA_BGP_BFD_H */ diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index b4bac840e3..6e17d778ab 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -44,6 +44,7 @@ Boston, MA 02111-1307, USA. */ #include "bgpd/bgp_mpath.h" #include "bgpd/bgp_nexthop.h" #include "bgpd/bgp_nht.h" +#include "bgpd/bgp_bfd.h" /* All information about zebra. */ struct zclient *zclient = NULL; @@ -358,7 +359,16 @@ bgp_interface_down (int command, struct zclient *zclient, zebra_size_t length, for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) { +#if defined(HAVE_CUMULUS) + /* Take down directly connected EBGP peers as well as 1-hop BFD + * tracked (directly connected) IBGP peers. + */ + if ((peer->ttl != 1) && (peer->gtsm_hops != 1) && + (!peer->bfd_info || bgp_bfd_is_peer_multihop(peer))) +#else + /* Take down directly connected EBGP peers */ if ((peer->ttl != 1) && (peer->gtsm_hops != 1)) +#endif continue; if (ifp == peer->nexthop.ifp) -- 2.39.5