From 0f0444fbd8b873ce487dc080737cd266d9508339 Mon Sep 17 00:00:00 2001 From: bisdhdh Date: Sat, 26 Oct 2019 01:28:45 +0530 Subject: [PATCH] bgpd: Adding helper caller hooks for BGPD-ZEBRA integration for GR. *Adding helper caller hooks function for signalling from BGPD to ZEBRA to enable or disable GR feature in ZEBRA depending on bgp per peer gr configuration. Signed-off-by: Biswajit Sadhu --- bgpd/bgp_network.c | 4 ++++ bgpd/bgp_open.c | 6 ++++++ bgpd/bgp_packet.c | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index 4487684de5..d7989af553 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -489,6 +489,10 @@ static int bgp_accept(struct thread *thread) peer_xfer_config(peer, peer1); 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); diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index 57df4d0967..4b6c8218aa 100644 --- a/bgpd/bgp_open.c +++ b/bgpd/bgp_open.c @@ -1342,7 +1342,13 @@ static void bgp_peer_send_gr_capability(struct stream *s, struct peer *peer, if (peer->bgp->t_startup) { SET_FLAG(restart_time, RESTART_R_BIT); SET_FLAG(peer->cap, PEER_CAP_RESTART_BIT_ADV); + + if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART)) + zlog_debug( + "BGP_GR:: Sending R-Bit for Peer :%s :", + peer->host); } + stream_putw(s, restart_time); /* Send address-family specific graceful-restart capability diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index d6510dfaf2..a6e723ce21 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -773,6 +773,9 @@ void bgp_notify_send_with_data(struct peer *peer, uint8_t code, stream_fifo_push(peer->obuf, s); bgp_peer_gr_flags_update(peer); + BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA( + peer->bgp, + peer->bgp->peer); bgp_write_notify(peer); } @@ -1813,6 +1816,9 @@ static int bgp_notify_receive(struct peer *peer, bgp_size_t size) UNSET_FLAG(peer->sflags, PEER_STATUS_CAPABILITY_OPEN); bgp_peer_gr_flags_update(peer); + BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA( + peer->bgp, + peer->bgp->peer); return Receive_NOTIFICATION_message; }