1
0
mirror of https://github.com/rtbrick/bngblaster.git synced 2024-05-06 15:54:57 +00:00

add update time/duration to BGP session command

This commit is contained in:
Christian Giese
2024-04-23 12:24:01 +00:00
parent 364ce33e93
commit d5da268e15
3 changed files with 7 additions and 4 deletions

View File

@@ -55,7 +55,7 @@ bgp_ctrl_session_json(bgp_session_s *session)
return NULL;
}
root = json_pack("{ss ss ss si si ss ss si si ss ss* ss* so*}",
root = json_pack("{ss ss ss si si ss ss si si ss ss* ss* si si si so*}",
"interface", session->interface->name,
"local-address", session->local_address_str,
"local-id", format_ipv4_address(&session->config->id),
@@ -68,6 +68,9 @@ bgp_ctrl_session_json(bgp_session_s *session)
"state", bgp_session_state_string(session->state),
"raw-update-state", raw_update_state(session),
"raw-update-file", raw_update_file,
"raw-update-start-epoch", session->update_start_timestamp.tv_sec,
"raw-update-stop-epoch", session->update_stop_timestamp.tv_sec,
"raw-update-duration", session->update_duration.tv_sec,
"stats", stats);
if(!root) {

View File

@@ -152,6 +152,7 @@ typedef struct bgp_session_ {
struct timespec established_timestamp;
struct timespec update_start_timestamp;
struct timespec update_stop_timestamp;
struct timespec update_duration;
bool teardown;
uint8_t error_code;

View File

@@ -92,12 +92,11 @@ void
bgp_raw_update_stop_cb(void *arg)
{
bgp_session_s *session = (bgp_session_s*)arg;
struct timespec time_diff;
session->tcpc->idle_cb = NULL;
clock_gettime(CLOCK_MONOTONIC, &session->update_stop_timestamp);
timespec_sub(&time_diff,
timespec_sub(&session->update_duration,
&session->update_stop_timestamp,
&session->update_start_timestamp);
@@ -109,7 +108,7 @@ bgp_raw_update_stop_cb(void *arg)
session->interface->name,
session->local_address_str,
session->peer_address_str,
time_diff.tv_sec);
session->update_duration.tv_sec);
if(session->config->start_traffic) {
LOG(BGP, "BGP (%s %s - %s) start traffic streams\n",