From 9b1b96233d7204263d409ea6c504b316af9e533f Mon Sep 17 00:00:00 2001 From: Trey Aspelund Date: Mon, 27 Jun 2022 23:20:33 +0000 Subject: [PATCH] bgpd: always display keepalive/hold intervals `show bgp neighbors [json]` was only displaying the configured keepalive and holdtime intervals when they differed from the default values. Since default config is still config, let's make sure these values are always displayed. Signed-off-by: Trey Aspelund --- bgpd/bgp_vty.c | 43 ++++++++++++------------------------------- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 9d8328a794..04ec098e36 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -12718,6 +12718,14 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json, + (tm.tm_hour * 3600000)); /* Configured timer values. */ + json_object_int_add(json_neigh, + "bgpTimerConfiguredHoldTimeMsecs", + p->holdtime ? p->holdtime * 1000 + : bgp->default_holdtime * 1000); + json_object_int_add( + json_neigh, "bgpTimerConfiguredKeepAliveIntervalMsecs", + p->keepalive ? p->keepalive * 1000 + : bgp->default_keepalive * 1000); json_object_int_add(json_neigh, "bgpTimerHoldTimeMsecs", p->v_holdtime * 1000); json_object_int_add(json_neigh, @@ -12738,25 +12746,6 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json, sync_tcp_mss); } - if (CHECK_FLAG(p->flags, PEER_FLAG_TIMER)) { - json_object_int_add(json_neigh, - "bgpTimerConfiguredHoldTimeMsecs", - p->holdtime * 1000); - json_object_int_add( - json_neigh, - "bgpTimerConfiguredKeepAliveIntervalMsecs", - p->keepalive * 1000); - } else if ((bgp->default_holdtime != SAVE_BGP_HOLDTIME) - || (bgp->default_keepalive != SAVE_BGP_KEEPALIVE)) { - json_object_int_add(json_neigh, - "bgpTimerConfiguredHoldTimeMsecs", - bgp->default_holdtime); - json_object_int_add( - json_neigh, - "bgpTimerConfiguredKeepAliveIntervalMsecs", - bgp->default_keepalive); - } - /* Extended Optional Parameters Length for BGP OPEN Message */ if (BGP_OPEN_EXT_OPT_PARAMS_CAPABLE(p)) json_object_boolean_true_add( @@ -12825,18 +12814,10 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json, vty_out(vty, " Hold time is %d, keepalive interval is %d seconds\n", p->v_holdtime, p->v_keepalive); - if (CHECK_FLAG(p->flags, PEER_FLAG_TIMER)) { - vty_out(vty, " Configured hold time is %d", - p->holdtime); - vty_out(vty, ", keepalive interval is %d seconds\n", - p->keepalive); - } else if ((bgp->default_holdtime != SAVE_BGP_HOLDTIME) - || (bgp->default_keepalive != SAVE_BGP_KEEPALIVE)) { - vty_out(vty, " Configured hold time is %d", - bgp->default_holdtime); - vty_out(vty, ", keepalive interval is %d seconds\n", - bgp->default_keepalive); - } + vty_out(vty, " Configured hold time is %d", + p->holdtime ? p->holdtime : bgp->default_holdtime); + vty_out(vty, ", keepalive interval is %d seconds\n", + p->keepalive ? p->keepalive : bgp->default_keepalive); if (CHECK_FLAG(p->flags, PEER_FLAG_TIMER_DELAYOPEN)) vty_out(vty, " Configured DelayOpenTime is %d seconds\n", -- 2.39.5