ip-neighbor: populate neighbor age via API 43/25543/8
authorVladimir Ratnikov <vratnikov@netgate.com>
Fri, 28 Feb 2020 13:48:21 +0000 (08:48 -0500)
committerPaul Vinciguerra <pvinci@vinciconsulting.com>
Fri, 6 Mar 2020 16:07:59 +0000 (16:07 +0000)
When we get ip-neigbor information using VPP API,
it's age can be very useful information.
This patch adds age entry to API and neighbor type

Type: feature

Signed-off-by: Vladimir Ratnikov <vratnikov@netgate.com>
Change-Id: I822e70ba7a2bdd85fec40930cfc9341ab71f7cb3

src/vnet/ip-neighbor/ip_neighbor.api
src/vnet/ip-neighbor/ip_neighbor_api.c

index a8fb24a..4d81a7c 100644 (file)
@@ -99,6 +99,7 @@ define ip_neighbor_dump
 */
 define ip_neighbor_details {
   u32 context;
+  f64 age;
   vl_api_ip_neighbor_t neighbor;
 };
 
index f626577..ec1e493 100644 (file)
@@ -133,6 +133,9 @@ send_ip_neighbor_details (index_t ipni, void *arg)
   clib_memset (mp, 0, sizeof (*mp));
   mp->_vl_msg_id = ntohs (VL_API_IP_NEIGHBOR_DETAILS + REPLY_MSG_ID_BASE);
   mp->context = ctx->context;
+  mp->age =
+    clib_host_to_net_f64 ((vlib_time_now (vlib_get_main ()) -
+                          ipn->ipn_time_last_updated));
   ip_neighbor_encode (&mp->neighbor, ipn);
 
   vl_api_send_msg (ctx->reg, (u8 *) mp);