summaryrefslogtreecommitdiff
path: root/proto/bgp/bgp.c
diff options
context:
space:
mode:
Diffstat (limited to 'proto/bgp/bgp.c')
-rw-r--r--proto/bgp/bgp.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index 2a64958a..83105a68 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -545,6 +545,8 @@ bgp_conn_enter_established_state(struct bgp_conn *conn)
struct bgp_channel *c;
BGP_TRACE(D_EVENTS, "BGP session established");
+ p->last_established = current_time();
+ p->stats.fsm_established_transitions++;
/* For multi-hop BGP sessions */
if (ipa_zero(p->local_ip))
@@ -685,6 +687,7 @@ static void
bgp_conn_leave_established_state(struct bgp_proto *p)
{
BGP_TRACE(D_EVENTS, "BGP session closed");
+ p->last_established = current_time();
p->conn = NULL;
if (p->p.proto_state == PS_UP)
@@ -1520,6 +1523,12 @@ bgp_start(struct proto *P)
p->gr_ready = 0;
p->gr_active_num = 0;
+ /* Reset some stats */
+ p->stats.rx_messages = p->stats.tx_messages = 0;
+ p->stats.rx_updates = p->stats.tx_updates = 0;
+ p->stats.rx_bytes = p->stats.tx_bytes = 0;
+ p->last_rx_update = 0;
+
p->event = ev_new_init(p->p.pool, bgp_decision, p);
p->startup_timer = tm_new_init(p->p.pool, bgp_startup_timeout, p, 0, 0);
p->gr_timer = tm_new_init(p->p.pool, bgp_graceful_restart_timeout, p, 0, 0);
@@ -2448,6 +2457,16 @@ bgp_show_proto_info(struct proto *P)
tm_remains(p->conn->keepalive_timer), p->conn->keepalive_time);
}
+ struct bgp_stats *s = &p->stats;
+ cli_msg(-1006, " FSM established transitions: %u",
+ s->fsm_established_transitions);
+ cli_msg(-1006, " Rcvd messages: %u total / %u updates / %lu bytes",
+ s->rx_messages, s->rx_updates, s->rx_bytes);
+ cli_msg(-1006, " Sent messages: %u total / %u updates / %lu bytes",
+ s->tx_messages, s->tx_updates, s->tx_bytes);
+ cli_msg(-1006, " Last rcvd update elapsed time: %t s",
+ p->last_rx_update ? (current_time() - p->last_rx_update) : 0);
+
if ((p->last_error_class != BE_NONE) &&
(p->last_error_class != BE_MAN_DOWN))
{