Skip to content

Commit

Permalink
bgpd:BGP GR Neighbor mode show, when local mode is “Disable”.
Browse files Browse the repository at this point in the history
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 <sadhub@vmware.com>
  • Loading branch information
bisdhdh committed Oct 22, 2019
1 parent c5d3317 commit 2bb9a10
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 18 deletions.
8 changes: 4 additions & 4 deletions bgpd/bgp_fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2223,7 +2223,7 @@ int bgp_gr_lookup_n_update_all_peer(struct bgp *bgp,
struct peer *peer = {0};
struct listnode *node = {0};
struct listnode *nnode = {0};
enum peer_mode peer_old_state = PEER_INVALID;
enum peer_mode peer_old_state;


for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
Expand Down Expand Up @@ -2340,9 +2340,9 @@ int bgp_neighbor_graceful_restart(struct peer *peer,
int peer_GR_Cmd)
{

enum peer_mode peer_new_state = PEER_INVALID;
enum peer_mode peer_old_state = PEER_INVALID;
struct bgp_peer_gr peer_state = {0};
enum peer_mode peer_new_state;
enum peer_mode peer_old_state;
struct bgp_peer_gr peer_state;
int result = BGP_GR_FAILURE;

/*
Expand Down
40 changes: 26 additions & 14 deletions bgpd/bgp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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]
Expand All @@ -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) {
Expand All @@ -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]
Expand Down

0 comments on commit 2bb9a10

Please sign in to comment.