Skip to content

Commit

Permalink
bgpd: Fix for BGP core when connected routes are redistriubuted and G…
Browse files Browse the repository at this point in the history
…R is

      enabled.

When GR with deferral is enabled and connected routes are
distributed then in one race condition route node gets added
in to both deferred queue and work queue. If deferred queue
gets processed first then it ends up delete only flag while
leaving the entry in the work queue as it is. When a new update
comes for the same rotue node next time from peer then it hits
assert. Assert check is added to ensure we dont add to work queue
again while it is already present.

So,Check before adding in to deferred queue if it is already present
in work queue and bail if so.
  • Loading branch information
bisdhdh committed Oct 22, 2019
1 parent f9e7db2 commit cdd8f17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion bgpd/bgp_fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2227,7 +2227,6 @@ int bgp_gr_lookup_n_update_all_peer(struct bgp *bgp,


for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
peer_old_state = PEER_INVALID;

if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
zlog_debug(
Expand Down
9 changes: 9 additions & 0 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,15 @@ static int bgp_node_set_defer_flag(struct bgp_node *rn, bool delete)
if (CHECK_FLAG(rn->flags, BGP_NODE_SELECT_DEFER) && (delete == false))
return 0;

if (CHECK_FLAG(rn->flags, BGP_NODE_PROCESS_SCHEDULED)) {
if (BGP_DEBUG(update, UPDATE_OUT)) {
prefix2str(&rn->p, buf, PREFIX2STR_BUFFER);
zlog_debug("Route %s is in workqueue and being processed, not deferred.",
buf);
}
return 0;
}

table = bgp_node_table(rn);
if (table) {
bgp = table->bgp;
Expand Down

0 comments on commit cdd8f17

Please sign in to comment.