aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ethernet
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2018-04-28 01:19:24 -0400
committerFlorin Coras <florin.coras@gmail.com>2018-05-11 22:35:30 +0000
commit7f358b30b04aabe9a35680997cc1eeefb080a869 (patch)
tree25b82c278355adf4a49289b31e3e3ca008bbc743 /src/vnet/ethernet
parent84c6204969898453aacfa900876e7b7eecd8be0e (diff)
Periodic scan and probe of IP neighbors to maintain neighbor pools
Scan IPv4 and IPv6 neigbor pool entries once a minute to keep them up to date. The neighbor of an entry is probed if its time-stamp is older than 1 minute. If the neighbor respond, its time-stamp will be updated. If there is no response from a neighbor, its entry will be deleted when the time-stamp of the entry become more than 4 minutes old. Static neighbor entries are not probed nor deleted. Implemented CLI and API to enable and disable priodic scan of IPv4, IPv6 or both types of IP neighbors. CLI is "ip scan-neighbor" and API is "ip_scan_neighbor_enable_disable". Other IP neighbor scan parameters can also be changed from their defaults via the CLI/API. Change-Id: Id1a0a934ace15d03db845aa698bcbb9cdabebfcd Signed-off-by: John Lo <loj@cisco.com>
Diffstat (limited to 'src/vnet/ethernet')
-rw-r--r--src/vnet/ethernet/arp.c16
-rw-r--r--src/vnet/ethernet/arp_packet.h3
2 files changed, 15 insertions, 4 deletions
diff --git a/src/vnet/ethernet/arp.c b/src/vnet/ethernet/arp.c
index 0d692cc1070..8df96f6a0f1 100644
--- a/src/vnet/ethernet/arp.c
+++ b/src/vnet/ethernet/arp.c
@@ -269,7 +269,7 @@ format_ethernet_arp_ip4_entry (u8 * s, va_list * va)
flags = format (flags, "N");
s = format (s, "%=12U%=16U%=6s%=20U%U",
- format_vlib_cpu_time, vnm->vlib_main, e->cpu_time_last_updated,
+ format_vlib_time, vnm->vlib_main, e->time_last_updated,
format_ip4_address, &e->ip4_address,
flags ? (char *) flags : "",
format_ethernet_address, e->ethernet_address,
@@ -616,14 +616,17 @@ vnet_arp_set_ip4_over_ethernet_internal (vnet_main_t * vnm,
*/
if (0 == memcmp (e->ethernet_address,
a->ethernet, sizeof (e->ethernet_address)))
- goto check_customers;
+ {
+ e->time_last_updated = vlib_time_now (vm);
+ goto check_customers;
+ }
/* Update time stamp and ethernet address. */
clib_memcpy (e->ethernet_address, a->ethernet,
sizeof (e->ethernet_address));
}
- e->cpu_time_last_updated = clib_cpu_time_now ();
+ e->time_last_updated = vlib_time_now (vm);
if (is_static)
e->flags |= ETHERNET_ARP_IP4_ENTRY_FLAG_STATIC;
else
@@ -1300,6 +1303,13 @@ ip4_arp_entry_sort (void *a1, void *a2)
}
ethernet_arp_ip4_entry_t *
+ip4_neighbors_pool (void)
+{
+ ethernet_arp_main_t *am = &ethernet_arp_main;
+ return am->ip4_entry_pool;
+}
+
+ethernet_arp_ip4_entry_t *
ip4_neighbor_entries (u32 sw_if_index)
{
ethernet_arp_main_t *am = &ethernet_arp_main;
diff --git a/src/vnet/ethernet/arp_packet.h b/src/vnet/ethernet/arp_packet.h
index 4b7b0482fb7..d2a23a5949f 100644
--- a/src/vnet/ethernet/arp_packet.h
+++ b/src/vnet/ethernet/arp_packet.h
@@ -156,7 +156,7 @@ typedef struct
ethernet_arp_entry_flags_t flags;
- u64 cpu_time_last_updated;
+ f64 time_last_updated;
/**
* The index of the adj-fib entry created
@@ -164,6 +164,7 @@ typedef struct
fib_node_index_t fib_entry_index;
} ethernet_arp_ip4_entry_t;
+ethernet_arp_ip4_entry_t *ip4_neighbors_pool (void);
ethernet_arp_ip4_entry_t *ip4_neighbor_entries (u32 sw_if_index);
u8 *format_ethernet_arp_ip4_entry (u8 * s, va_list * va);