summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zebra/zebra_evpn_mac.c15
-rw-r--r--zebra/zebra_evpn_mac.h2
-rw-r--r--zebra/zebra_evpn_neigh.c12
-rw-r--r--zebra/zebra_evpn_neigh.h2
4 files changed, 29 insertions, 2 deletions
diff --git a/zebra/zebra_evpn_mac.c b/zebra/zebra_evpn_mac.c
index 8e9a1a4e8e..4a2d8db422 100644
--- a/zebra/zebra_evpn_mac.c
+++ b/zebra/zebra_evpn_mac.c
@@ -490,6 +490,8 @@ void zebra_evpn_print_mac(zebra_mac_t *mac, void *ctxt, json_object *json)
struct timeval detect_start_time = {0, 0};
char timebuf[MONOTIME_STRLEN];
char thread_buf[THREAD_TIMER_STRLEN];
+ time_t uptime;
+ char up_str[MONOTIME_STRLEN];
zvrf = zebra_vrf_get_evpn();
if (!zvrf)
@@ -498,6 +500,11 @@ void zebra_evpn_print_mac(zebra_mac_t *mac, void *ctxt, json_object *json)
vty = (struct vty *)ctxt;
prefix_mac2str(&mac->macaddr, buf1, sizeof(buf1));
+ uptime = monotime(NULL);
+ uptime -= mac->uptime;
+
+ frrtime_to_interval(uptime, up_str, sizeof(up_str));
+
if (json) {
json_object *json_mac = json_object_new_object();
@@ -535,6 +542,7 @@ void zebra_evpn_print_mac(zebra_mac_t *mac, void *ctxt, json_object *json)
json_object_boolean_true_add(json_mac,
"remoteGatewayMac");
+ json_object_string_add(json_mac, "uptime", up_str);
json_object_int_add(json_mac, "localSequence", mac->loc_seq);
json_object_int_add(json_mac, "remoteSequence", mac->rem_seq);
@@ -648,9 +656,9 @@ void zebra_evpn_print_mac(zebra_mac_t *mac, void *ctxt, json_object *json)
sizeof(thread_buf),
mac->hold_timer));
vty_out(vty, "\n");
- vty_out(vty, " Local Seq: %u Remote Seq: %u", mac->loc_seq,
+ vty_out(vty, " Local Seq: %u Remote Seq: %u\n", mac->loc_seq,
mac->rem_seq);
- vty_out(vty, "\n");
+ vty_out(vty, " Uptime: %s\n", up_str);
if (CHECK_FLAG(mac->flags, ZEBRA_MAC_DUPLICATE)) {
vty_out(vty, " Duplicate, detected at %s",
@@ -972,6 +980,7 @@ zebra_mac_t *zebra_evpn_mac_add(zebra_evpn_t *zevpn, struct ethaddr *macaddr)
mac->neigh_list = list_new();
mac->neigh_list->cmp = neigh_list_cmp;
+ mac->uptime = monotime(NULL);
if (IS_ZEBRA_DEBUG_VXLAN || IS_ZEBRA_DEBUG_EVPN_MH_MAC) {
char buf[ETHER_ADDR_STRLEN];
@@ -1459,6 +1468,8 @@ zebra_evpn_proc_sync_mac_update(zebra_evpn_t *zevpn, struct ethaddr *macaddr,
bool sticky;
bool remote_gw;
+ mac->uptime = monotime(NULL);
+
old_flags = mac->flags;
sticky = !!CHECK_FLAG(old_flags, ZEBRA_MAC_STICKY);
remote_gw = !!CHECK_FLAG(old_flags, ZEBRA_MAC_REMOTE_DEF_GW);
diff --git a/zebra/zebra_evpn_mac.h b/zebra/zebra_evpn_mac.h
index f9ca81445f..596fd0faad 100644
--- a/zebra/zebra_evpn_mac.h
+++ b/zebra/zebra_evpn_mac.h
@@ -129,6 +129,8 @@ struct zebra_mac_t_ {
* ZEBRA_MAC_ES_PEER_ACTIVE or ZEBRA_NEIGH_ES_PEER_PROXY
*/
uint32_t sync_neigh_cnt;
+
+ time_t uptime;
};
/*
diff --git a/zebra/zebra_evpn_neigh.c b/zebra/zebra_evpn_neigh.c
index bb848255d0..e4f38008ac 100644
--- a/zebra/zebra_evpn_neigh.c
+++ b/zebra/zebra_evpn_neigh.c
@@ -592,6 +592,7 @@ static zebra_neigh_t *zebra_evpn_neigh_add(zebra_evpn_t *zevpn,
n->zevpn = zevpn;
n->dad_ip_auto_recovery_timer = NULL;
n->flags = n_flags;
+ n->uptime = monotime(NULL);
if (!zmac)
zmac = zebra_evpn_mac_lookup(zevpn, mac);
@@ -802,6 +803,8 @@ zebra_evpn_proc_sync_neigh_update(zebra_evpn_t *zevpn, zebra_neigh_t *n,
n->ifindex = ifindex;
inform_dataplane = true;
}
+
+ n->uptime = monotime(NULL);
}
/* update the neigh seq. we don't bother with the mac seq as
@@ -1798,11 +1801,18 @@ void zebra_evpn_print_neigh(zebra_neigh_t *n, void *ctxt, json_object *json)
struct timeval detect_start_time = {0, 0};
char timebuf[MONOTIME_STRLEN];
char thread_buf[THREAD_TIMER_STRLEN];
+ time_t uptime;
+ char up_str[MONOTIME_STRLEN];
zvrf = zebra_vrf_get_evpn();
if (!zvrf)
return;
+ uptime = monotime(NULL);
+ uptime -= n->uptime;
+
+ frrtime_to_interval(uptime, up_str, sizeof(up_str));
+
ipaddr2str(&n->ip, buf2, sizeof(buf2));
prefix_mac2str(&n->emac, buf1, sizeof(buf1));
type_str = CHECK_FLAG(n->flags, ZEBRA_NEIGH_LOCAL) ? "local" : "remote";
@@ -1815,6 +1825,7 @@ void zebra_evpn_print_neigh(zebra_neigh_t *n, void *ctxt, json_object *json)
ipaddr2str(&n->ip, buf2, sizeof(buf2)));
vty_out(vty, " Type: %s\n", type_str);
vty_out(vty, " State: %s\n", state_str);
+ vty_out(vty, " Uptime: %s\n", up_str);
vty_out(vty, " MAC: %s\n",
prefix_mac2str(&n->emac, buf1, sizeof(buf1)));
vty_out(vty, " Sync-info:");
@@ -1841,6 +1852,7 @@ void zebra_evpn_print_neigh(zebra_neigh_t *n, void *ctxt, json_object *json)
vty_out(vty, " -");
vty_out(vty, "\n");
} else {
+ json_object_string_add(json, "uptime", up_str);
json_object_string_add(json, "ip", buf2);
json_object_string_add(json, "type", type_str);
json_object_string_add(json, "state", state_str);
diff --git a/zebra/zebra_evpn_neigh.h b/zebra/zebra_evpn_neigh.h
index 4b98266c86..50efdc0e0d 100644
--- a/zebra/zebra_evpn_neigh.h
+++ b/zebra/zebra_evpn_neigh.h
@@ -113,6 +113,8 @@ struct zebra_neigh_t_ {
time_t dad_dup_detect_time;
+ time_t uptime;
+
/* used for ageing out the PEER_ACTIVE flag */
struct thread *hold_timer;
};