Skip to content

Commit

Permalink
Merge pull request FRRouting#17613 from donaldsharp/evpn_bgp_bestpath…
Browse files Browse the repository at this point in the history
…_failure

bgpd: Fix evpn bestpath calculation when path is not established
  • Loading branch information
riw777 authored Dec 17, 2024
2 parents acea7d5 + 9f88cb5 commit f4cdd5c
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -3006,7 +3006,10 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_dest *dest,

old_select = NULL;
pi = bgp_dest_get_bgp_path_info(dest);
while (pi && CHECK_FLAG(pi->flags, BGP_PATH_UNSORTED)) {
while (pi && (CHECK_FLAG(pi->flags, BGP_PATH_UNSORTED) ||
(pi->peer != bgp->peer_self &&
!CHECK_FLAG(pi->peer->sflags, PEER_STATUS_NSF_WAIT) &&
!peer_established(pi->peer->connection)))) {
struct bgp_path_info *next = pi->next;

if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED))
Expand Down Expand Up @@ -3100,6 +3103,30 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_dest *dest,
continue;
}

if (first->peer && first->peer != bgp->peer_self &&
!CHECK_FLAG(first->peer->sflags, PEER_STATUS_NSF_WAIT) &&
!peer_established(first->peer->connection)) {
if (debug)
zlog_debug("%s: %pBD(%s) pi %p from %s is not in established state",
__func__, dest, bgp->name_pretty, first,
first->peer->host);

/*
* Peer is not in established state we cannot sort this
* item yet. Let's wait, so hold this one to the side
*/
if (unsorted_holddown) {
first->next = unsorted_holddown;
unsorted_holddown->prev = first;
unsorted_holddown = first;
} else
unsorted_holddown = first;

UNSET_FLAG(first->flags, BGP_PATH_UNSORTED);

continue;
}

bgp_path_info_unset_flag(dest, first, BGP_PATH_DMED_CHECK);

worse = NULL;
Expand Down

0 comments on commit f4cdd5c

Please sign in to comment.