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 69 sw_if_index, &ip->ip6, mac, 6,
78 ethernet_arp_ip4_over_ethernet_address_t
a = {
94 if (0 == rv && stats_index)
95 *stats_index =
adj_nbr_find (fproto, linkt, ip, sw_if_index);
108 sw_if_index, &ip->ip6);
112 ethernet_arp_ip4_over_ethernet_address_t
a = {
149 u8 is_ip6,
u8 delete_stale,
u8 * update_count)
157 u32 curr_idx = start_idx;
159 f64 delta, update_time;
172 while (curr_idx != ~0)
176 (((loop_count % 100) == 0) &&
195 delta = start_time - update_time;
202 ethernet_arp_ip4_over_ethernet_address_t delme;
245 uword *event_data = 0;
246 u8 purge4 = 0, purge6 = 0;
262 if ((ip4_nidx == 0) && (ip6_nidx == 0))
279 if ((ip4_nidx == ~0) && (ip6_nidx == ~0))
282 ip4_nidx = ip6_nidx = 0;
291 else if (timeout < cfg->scan_int_delay)
302 .name =
"ip-neighbor-scan-process",
312 u32 interval = 0, time = 0, update = 0, delay = 0, stale = 0;
315 memset (&arg, 0,
sizeof (arg));
330 else if (
unformat (line_input,
"ip6"))
333 else if (
unformat (line_input,
"both"))
336 else if (
unformat (line_input,
"disable"))
339 else if (
unformat (line_input,
"interval %d", &interval))
342 else if (
unformat (line_input,
"max-time %d", &time))
345 else if (
unformat (line_input,
"max-update %d", &update))
348 else if (
unformat (line_input,
"delay %d", &delay))
351 else if (
unformat (line_input,
"stale %d", &stale))
410 .path =
"ip scan-neighbor",
412 .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>]",
420 u8 mode = va_arg (*args,
u32);
424 return format (s,
"IPv4");
426 return format (s,
"IPv6");
428 return format (s,
"IPv4 and IPv6");
430 return format (s,
"unknown");
441 "IP neighbor scan disabled - current time is %.4f sec",
445 "current time is %.4f sec\n " 446 "Full_scan_interval: %f min " 447 "Stale_purge_threshod: %f min\n " 448 "Max_process_time: %f usec Max_updates %d " 449 "Delay_to_resume_after_max_limit: %f msec",
467 .path =
"show ip scan-neighbor",
469 .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...
int vnet_arp_unset_ip4_over_ethernet(vnet_main_t *vnm, u32 sw_if_index, const ethernet_arp_ip4_over_ethernet_address_t *a)
Control Plane hook to remove an ARP entry.
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
int ip_neighbor_del(const ip46_address_t *ip, u8 is_ip6, u32 sw_if_index)
#define IP_NEIGHBOR_DEF_SCAN_INTERVAL
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
ip6_neighbor_flags_t flags
memset(h->entries, 0, sizeof(h->entries[0])*entries)
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...
int vnet_set_ip6_ethernet_neighbor(vlib_main_t *vm, u32 sw_if_index, const ip6_address_t *a, const u8 *link_layer_address, uword n_bytes_link_layer_address, int is_static, int is_no_fib_entry)
#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)
#define IP_NEIGHBOR_DEF_MAX_PROC_TIME
int vnet_arp_set_ip4_over_ethernet(vnet_main_t *vnm, u32 sw_if_index, const ethernet_arp_ip4_over_ethernet_address_t *a, int is_static, int is_no_fib_entry)
#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
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.
enum ip_neighbor_flags_t_ ip_neighbor_flags_t
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
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
static uword neighbor_scan_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
int ip_neighbor_add(const ip46_address_t *ip, u8 is_ip6, const u8 *mac, u32 sw_if_index, ip_neighbor_flags_t flags, u32 *stats_index)
ethernet_arp_entry_flags_t flags
static vlib_main_t * vlib_get_main(void)
static u8 * format_ip_scan_mode(u8 *s, va_list *args)
int vnet_unset_ip6_ethernet_neighbor(vlib_main_t *vm, u32 sw_if_index, const ip6_address_t *a)
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
adj_index_t adj_nbr_find(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index)
Lookup neighbor adjancency.