From 3e13b46598f7fe7106b2578e1b6e739bddabe8fe Mon Sep 17 00:00:00 2001 From: bisdhdh Date: Wed, 23 Oct 2019 01:38:56 +0530 Subject: [PATCH] =?UTF-8?q?bgpd:BGP=20GR=20Neighbor=20mode=20show,=20when?= =?UTF-8?q?=20local=20mode=20is=20=E2=80=9CDisable=E2=80=9D.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BGP GR Neighbor mode in show command would show as “NotApplicable”, when local mode is “Disable”. As the bgp gr neighbour capability was not processed, since the local mode is “Disable”. Signed-off-by: Biswajit Sadhu --- bgpd/bgp_vty.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 1896f8f14734..37de10a5b9d4 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -9220,12 +9220,10 @@ static void bgp_show_neighbor_graceful_restart_capability_per_afi_safi( for (afi = AFI_IP; afi < AFI_MAX; afi++) { for (safi = SAFI_UNICAST; safi <= SAFI_MPLS_VPN; safi++) { - - if (peer->afc_nego[afi][safi] + if (peer->afc[afi][safi] && CHECK_FLAG(peer->cap, PEER_CAP_RESTART_ADV) - && CHECK_FLAG(peer->af_cap[afi][safi], - PEER_CAP_RESTART_AF_RCV)) { - + && CHECK_FLAG(peer->cap, PEER_CAP_RESTART_RCV) + ) { if (use_json) { json_afi_safi = json_object_new_object(); @@ -9334,9 +9332,18 @@ static void bgp_show_neighbor_graceful_restart_capability_per_afi_safi( peer->t_gr_stale)); } - json_object_int_add(json_timer, + /* Display Configured Selection + * Deferral only when when + * Gr mode is enabled. + */ + if (bgp_peer_flag_check(peer, + PEER_FLAG_GRACEFUL_RESTART)) { + + json_object_int_add( + json_timer, "selectionDeferralTimer", peer->bgp->stalepath_time); + } if (peer->bgp ->gr_info[afi][safi] @@ -9357,8 +9364,8 @@ static void bgp_show_neighbor_graceful_restart_capability_per_afi_safi( vty_out(vty, "%*s", 6, ""); vty_out(vty, - "Stale Path Time(sec)%*s: %u\n", - 19, "", + "Configured Stale Path Time(sec)%*s: %u\n", + 8, "", peer->bgp->stalepath_time); if (peer->t_gr_stale != NULL) { @@ -9369,12 +9376,17 @@ static void bgp_show_neighbor_graceful_restart_capability_per_afi_safi( thread_timer_remain_second( peer->t_gr_stale)); } - - vty_out(vty, "%*s", 6, ""); - vty_out(vty, - "Selection Deferral Time(sec)%*s: %u\n", - 11, "", - peer->bgp->select_defer_time); + /* Display Configured Selection + * Deferral only when when + * Gr mode is enabled. + */ + if (bgp_peer_flag_check(peer, + PEER_FLAG_GRACEFUL_RESTART)) { + vty_out(vty, "%*s", 6, ""); + vty_out(vty, + "Configured Selection Deferral Time(sec): %u\n", + peer->bgp->select_defer_time); + } if (peer->bgp ->gr_info[afi][safi]