mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-28 19:10:16 +00:00
bgpd: Adding bgp peer route processing and EOR state Signalling from BGPD to Zebra.
* While the Deferral timer is running, signal route update pending (ZEBRA_CLIENT_ROUTE_UPDATE_PENDING) from BGPD to Zebra. * After expiry of the Deferral timer, the deferred routes are processed. When the deferred route_list becomes empty, End-of-Rib is send to the peer and route processing complete message (ZEBRA_CLIENT_ROUTE_UPDATE_COMPLETE) is sent to Zebra. So that Zebra would delete any stale routes still present in the rib. Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
This commit is contained in:
parent
dc95985fe8
commit
8c48b3b696
@ -35,7 +35,7 @@
|
||||
#include "filter.h"
|
||||
#include "command.h"
|
||||
#include "lib_errors.h"
|
||||
|
||||
#include "zclient.h"
|
||||
#include "lib/json.h"
|
||||
#include "bgpd/bgpd.h"
|
||||
#include "bgpd/bgp_attr.h"
|
||||
@ -255,6 +255,10 @@ static struct peer *peer_xfer_conn(struct peer *from_peer)
|
||||
peer->peer_gr_new_status_flag = from_peer->peer_gr_new_status_flag;
|
||||
bgp_peer_gr_flags_update(peer);
|
||||
|
||||
BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(
|
||||
peer->bgp,
|
||||
peer->bgp->peer);
|
||||
|
||||
if (bgp_peer_gr_mode_get(peer) == PEER_DISABLE) {
|
||||
|
||||
UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_MODE);
|
||||
@ -1616,6 +1620,10 @@ static int bgp_reconnect(struct peer *peer)
|
||||
if (bgp_stop(peer) < 0)
|
||||
return -1;
|
||||
|
||||
/* Send graceful restart capabilty */
|
||||
BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(
|
||||
peer->bgp, peer->bgp->peer);
|
||||
|
||||
bgp_start(peer);
|
||||
return 0;
|
||||
}
|
||||
@ -1690,8 +1698,14 @@ static int bgp_start_deferral_timer(struct bgp *bgp, afi_t afi, safi_t safi,
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
gr_info->eor_required++;
|
||||
/* Send message to RIB indicating route update pending */
|
||||
if (gr_info->af_enabled[afi][safi] == false) {
|
||||
gr_info->af_enabled[afi][safi] = true;
|
||||
/* Send message to RIB */
|
||||
bgp_zebra_update(afi, safi, bgp->vrf_id,
|
||||
ZEBRA_CLIENT_ROUTE_UPDATE_PENDING);
|
||||
}
|
||||
if (BGP_DEBUG(update, UPDATE_OUT))
|
||||
zlog_debug("Started the deferral timer for %s eor_required %d",
|
||||
get_afi_safi_str(afi, safi, false),
|
||||
@ -2264,7 +2278,7 @@ int bgp_gr_lookup_n_update_all_peer(struct bgp *bgp,
|
||||
|
||||
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
||||
zlog_debug(
|
||||
"BGP_GR:: %s ---> Peer: (%s) :",
|
||||
"BGP_GR:: %s Peer: (%s) :",
|
||||
__func__, peer->host);
|
||||
|
||||
peer_old_state = bgp_peer_gr_mode_get(peer);
|
||||
@ -2321,7 +2335,7 @@ int bgp_gr_update_all(struct bgp *bgp, int global_GR_Cmd)
|
||||
|
||||
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
||||
zlog_debug(
|
||||
"BGP_GR::%s:START ---> global_GR_Cmd :%d:",
|
||||
"BGP_GR::%s:START: global_GR_Cmd :%d:",
|
||||
__func__, global_GR_Cmd);
|
||||
|
||||
global_old_state = bgp_global_gr_mode_get(bgp);
|
||||
@ -2572,11 +2586,11 @@ inline void bgp_peer_move_to_gr_mode(struct peer *peer, int new_state)
|
||||
BGP_PEER_GR_DISABLE(peer);
|
||||
} else {
|
||||
zlog_debug(
|
||||
"BGP_GR:: Default switch inherit mode ::: SOMETHING IS WORONG !!!");
|
||||
"BGP_GR:: Default switch inherit mode ::: SOMETHING IS WRONG !!!");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
zlog_debug("BGP_GR:: Default switch mode ::: SOMETHING IS WORONG !!!");
|
||||
zlog_debug("BGP_GR:: Default switch mode ::: SOMETHING IS WRONG !!!");
|
||||
break;
|
||||
}
|
||||
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "memory.h"
|
||||
#include "lib/json.h"
|
||||
#include "lib_errors.h"
|
||||
|
||||
#include "zclient.h"
|
||||
#include "bgpd/bgpd.h"
|
||||
#include "bgpd/bgp_table.h"
|
||||
#include "bgpd/bgp_route.h"
|
||||
@ -2755,6 +2755,9 @@ int bgp_best_path_select_defer(struct bgp *bgp, afi_t afi, safi_t safi)
|
||||
/* Send EOR message when all routes are processed */
|
||||
if (list_isempty(bgp->gr_info[afi][safi].route_list)) {
|
||||
bgp_send_delayed_eor(bgp);
|
||||
/* Send route processing complete message to RIB */
|
||||
bgp_zebra_update(afi, safi, bgp->vrf_id,
|
||||
ZEBRA_CLIENT_ROUTE_UPDATE_COMPLETE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user