summaryrefslogtreecommitdiff
path: root/bgpd/bgp_zebra.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_zebra.c')
-rw-r--r--bgpd/bgp_zebra.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index afdd5123fb..d1912db01f 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -283,20 +283,9 @@ static int bgp_ifp_down(struct interface *ifp)
if (!CHECK_FLAG(bgp->flags, BGP_FLAG_NO_FAST_EXT_FAILOVER)) {
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 != BGP_DEFAULT_TTL)
- && (peer->gtsm_hops != BGP_GTSM_HOPS_CONNECTED)
- && (!peer->bfd_info
- || bgp_bfd_is_peer_multihop(peer)))
-#else
- /* Take down directly connected EBGP peers */
+ /* Take down directly connected peers. */
if ((peer->ttl != BGP_DEFAULT_TTL)
&& (peer->gtsm_hops != BGP_GTSM_HOPS_CONNECTED))
-#endif
continue;
if (ifp == peer->nexthop.ifp) {
@@ -1180,6 +1169,7 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
int nh_family;
unsigned int valid_nh_count = 0;
int has_valid_label = 0;
+ bool allow_recursion = false;
uint8_t distance;
struct peer *peer;
struct bgp_path_info *mpinfo;
@@ -1257,7 +1247,7 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
|| CHECK_FLAG(peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK)
|| CHECK_FLAG(bgp->flags, BGP_FLAG_DISABLE_NH_CONNECTED_CHK))
- SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION);
+ allow_recursion = true;
if (info->attr->rmap_table_id) {
SET_FLAG(api.message, ZAPI_MESSAGE_TABLEID);
@@ -1383,6 +1373,15 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
if (!nh_updated)
continue;
+ /* Allow recursion if it is a multipath group with both
+ * eBGP and iBGP paths.
+ */
+ if (!allow_recursion
+ && CHECK_FLAG(bgp->flags, BGP_FLAG_PEERTYPE_MULTIPATH_RELAX)
+ && (mpinfo->peer->sort == BGP_PEER_IBGP
+ || mpinfo->peer->sort == BGP_PEER_CONFED))
+ allow_recursion = true;
+
if (mpinfo->extra
&& bgp_is_valid_label(&mpinfo->extra->label[0])
&& !CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE)) {
@@ -1411,6 +1410,9 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
memcpy(api.opaque.data, aspath->str, api.opaque.length);
}
+ if (allow_recursion)
+ SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION);
+
/*
* When we create an aggregate route we must also
* install a Null0 route in the RIB, so overwrite