summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip_api.c
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/ip/ip_api.c
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/ip/ip_api.c')
-rw-r--r--src/vnet/ip/ip_api.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index b4d942b6bef..3711c40343b 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -25,6 +25,7 @@
#include <vnet/api_errno.h>
#include <vnet/ethernet/ethernet.h>
#include <vnet/ip/ip.h>
+#include <vnet/ip/ip_neighbor.h>
#include <vnet/ip/ip6_neighbor.h>
#include <vnet/fib/fib_table.h>
#include <vnet/fib/fib_api.h>
@@ -77,6 +78,7 @@ _(IP_DUMP, ip_dump) \
_(IP_NEIGHBOR_ADD_DEL, ip_neighbor_add_del) \
_(SET_ARP_NEIGHBOR_LIMIT, set_arp_neighbor_limit) \
_(IP_PROBE_NEIGHBOR, ip_probe_neighbor) \
+_(IP_SCAN_NEIGHBOR_ENABLE_DISABLE, ip_scan_neighbor_enable_disable) \
_(WANT_IP4_ARP_EVENTS, want_ip4_arp_events) \
_(WANT_IP6_ND_EVENTS, want_ip6_nd_events) \
_(WANT_IP6_RA_EVENTS, want_ip6_ra_events) \
@@ -2722,6 +2724,25 @@ vl_api_ip_probe_neighbor_t_handler (vl_api_ip_probe_neighbor_t * mp)
REPLY_MACRO (VL_API_PROXY_ARP_INTFC_ENABLE_DISABLE_REPLY);
}
+static void
+ vl_api_ip_scan_neighbor_enable_disable_t_handler
+ (vl_api_ip_scan_neighbor_enable_disable_t * mp)
+{
+ int rv = 0;
+ vl_api_ip_scan_neighbor_enable_disable_reply_t *rmp;
+ ip_neighbor_scan_arg_t arg;
+
+ arg.mode = mp->mode;
+ arg.scan_interval = mp->scan_interval;
+ arg.max_proc_time = mp->max_proc_time;
+ arg.max_update = mp->max_update;
+ arg.scan_int_delay = mp->scan_int_delay;
+ arg.stale_threshold = mp->stale_threshold;
+ ip_neighbor_scan_enable_disable (&arg);
+
+ REPLY_MACRO (VL_API_IP_SCAN_NEIGHBOR_ENABLE_DISABLE_REPLY);
+}
+
static int
ip4_reset_fib_t_handler (vl_api_reset_fib_t * mp)
{