32 #define IP_NEIGHBOR_DEF_SCAN_INTERVAL (60.0) 33 #define IP_NEIGHBOR_DEF_MAX_PROC_TIME (20e-6) 34 #define IP_NEIGHBOR_DEF_SCAN_INT_DELAY (1e-3) 35 #define IP_NEIGHBOR_DEF_STALE (4*IP_NEIGHBOR_DEF_SCAN_INTERVAL) 36 #define IP_NEIGHBOR_DEF_MAX_UPDATE 10 76 u8 is_ip6,
u8 delete_stale,
u8 * update_count)
84 u32 curr_idx = start_idx;
86 f64 delta, update_time;
99 while (curr_idx != ~0)
103 (((loop_count % 100) == 0) &&
122 delta = start_time - update_time;
129 ethernet_arp_ip4_over_ethernet_address_t delme;
173 uword *event_data = 0;
174 u8 purge4 = 0, purge6 = 0;
190 if ((ip4_nidx == 0) && (ip6_nidx == 0))
207 if ((ip4_nidx == ~0) && (ip6_nidx == ~0))
210 ip4_nidx = ip6_nidx = 0;
219 else if (timeout < cfg->scan_int_delay)
230 .name =
"ip-neighbor-scan-process",
240 u32 interval = 0, time = 0, update = 0, delay = 0, stale = 0;
243 memset (&arg, 0,
sizeof (arg));
258 else if (
unformat (line_input,
"ip6"))
261 else if (
unformat (line_input,
"both"))
264 else if (
unformat (line_input,
"disable"))
267 else if (
unformat (line_input,
"interval %d", &interval))
270 else if (
unformat (line_input,
"max-time %d", &time))
273 else if (
unformat (line_input,
"max-update %d", &update))
276 else if (
unformat (line_input,
"delay %d", &delay))
279 else if (
unformat (line_input,
"stale %d", &stale))
338 .path =
"ip scan-neighbor",
340 .short_help =
"ip scan-neighbor [ip4|ip6|both|disable] [interval <n-min>] [max-time <n-usec>] [max-update <n>] [delay <n-msec>] [stale <n-min>]",
348 u8 mode = va_arg (*args,
u32);
352 return format (s,
"IPv4");
354 return format (s,
"IPv6");
356 return format (s,
"IPv4 and IPv6");
358 return format (s,
"unknown");
369 "IP neighbor scan disabled - current time is %.4f sec",
373 "current time is %.4f sec\n " 374 "Full_scan_interval: %f min " 375 "Stale_purge_threshod: %f min\n " 376 "Max_process_time: %f usec Max_updates %d " 377 "Delay_to_resume_after_max_limit: %f msec",
395 .path =
"show ip scan-neighbor",
397 .short_help =
"show ip scan-neighbor",
#define pool_next_index(P, I)
Return next occupied pool index after i, useful for safe iteration.
#define IP_NEIGHBOR_DEF_MAX_UPDATE
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
vnet_main_t * vnet_get_main(void)
static f64 vlib_time_now(vlib_main_t *vm)
#define IP_SCAN_V6_NEIGHBORS
#define IP_SCAN_V46_NEIGHBORS
static ip_neighbor_scan_config_t ip_neighbor_scan_conf
#define IP_NEIGHBOR_DEF_SCAN_INTERVAL
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
ip6_neighbor_flags_t flags
ip6_neighbor_t * ip6_neighbors_pool(void)
#define static_always_inline
void ip_neighbor_scan_enable_disable(ip_neighbor_scan_arg_t *arg)
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type...
#define clib_error_return(e, args...)
#define IP_SCAN_V4_NEIGHBORS
clib_error_t * ip6_probe_neighbor(vlib_main_t *vm, ip6_address_t *dst, u32 sw_if_index, u8 refresh)
int vnet_arp_unset_ip4_over_ethernet(vnet_main_t *vnm, u32 sw_if_index, void *a_arg)
Control Plane hook to remove an ARP entry.
#define IP_NEIGHBOR_DEF_MAX_PROC_TIME
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static clib_error_t * show_ip_neighbor_scan(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
ip4_address_t ip4_address
int vnet_unset_ip6_ethernet_neighbor(vlib_main_t *vm, u32 sw_if_index, ip6_address_t *a, u8 *link_layer_address, uword n_bytes_link_layer_address)
ethernet_arp_ip4_entry_t * ip4_neighbors_pool(void)
clib_error_t * ip4_probe_neighbor(vlib_main_t *vm, ip4_address_t *dst, u32 sw_if_index, u8 refresh)
#define VLIB_REGISTER_NODE(x,...)
static vlib_node_registration_t neighbor_scan_process_node
(constructor) VLIB_REGISTER_NODE (neighbor_scan_process_node)
#define clib_memcpy(a, b, c)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
static_always_inline u32 ip_neighbor_scan(vlib_main_t *vm, f64 start_time, u32 start_idx, u8 is_ip6, u8 delete_stale, u8 *update_count)
#define VLIB_CLI_COMMAND(x,...)
ip6_address_t ip6_address
static uword neighbor_scan_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
ethernet_arp_entry_flags_t flags
static u8 * format_ip_scan_mode(u8 *s, va_list *args)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static clib_error_t * ip_neighbor_scan_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define IP_NEIGHBOR_DEF_SCAN_INT_DELAY