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, flags);
75 ethernet_arp_ip4_over_ethernet_address_t
a = {
87 if (0 == rv && stats_index)
88 *stats_index =
adj_nbr_find (fproto, linkt, ip, sw_if_index);
101 sw_if_index, &ip->ip6);
105 ethernet_arp_ip4_over_ethernet_address_t
a = {
142 u8 is_ip6,
u8 delete_stale,
u8 * update_count)
150 u32 curr_idx = start_idx;
152 f64 delta, update_time;
165 while (curr_idx != ~0)
169 (((loop_count % 100) == 0) &&
188 delta = start_time - update_time;
195 ethernet_arp_ip4_over_ethernet_address_t delme = {
240 uword *event_data = 0;
241 u8 purge4 = 0, purge6 = 0;
257 if ((ip4_nidx == 0) && (ip6_nidx == 0))
274 if ((ip4_nidx == ~0) && (ip6_nidx == ~0))
277 ip4_nidx = ip6_nidx = 0;
286 else if (timeout < cfg->scan_int_delay)
297 .name =
"ip-neighbor-scan-process",
307 u32 interval = 0, time = 0, update = 0, delay = 0, stale = 0;
325 else if (
unformat (line_input,
"ip6"))
328 else if (
unformat (line_input,
"both"))
331 else if (
unformat (line_input,
"disable"))
334 else if (
unformat (line_input,
"interval %d", &interval))
337 else if (
unformat (line_input,
"max-time %d", &time))
340 else if (
unformat (line_input,
"max-update %d", &update))
343 else if (
unformat (line_input,
"delay %d", &delay))
346 else if (
unformat (line_input,
"stale %d", &stale))
405 .path =
"ip scan-neighbor",
407 .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>]",
419 return format (s,
"IPv4");
421 return format (s,
"IPv6");
423 return format (s,
"IPv4 and IPv6");
425 return format (s,
"unknown");
436 "IP neighbor scan disabled - current time is %.4f sec",
440 "current time is %.4f sec\n " 441 "Full_scan_interval: %f min " 442 "Stale_purge_threshod: %f min\n " 443 "Max_process_time: %f usec Max_updates %d " 444 "Delay_to_resume_after_max_limit: %f msec",
462 .path =
"show ip scan-neighbor",
464 .short_help =
"show ip scan-neighbor",
ip_neighbor_flags_t flags
int vnet_arp_set_ip4_over_ethernet(vnet_main_t *vnm, u32 sw_if_index, const ethernet_arp_ip4_over_ethernet_address_t *a, ip_neighbor_flags_t flags)
#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)
int ip_neighbor_add(const ip46_address_t *ip, ip46_type_t type, const mac_address_t *mac, u32 sw_if_index, ip_neighbor_flags_t flags, u32 *stats_index)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
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
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
int ip_neighbor_del(const ip46_address_t *ip, ip46_type_t type, u32 sw_if_index)
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...
enum ip_neighbor_flags_t_ ip_neighbor_flags_t
#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
#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 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)
vl_api_vxlan_gbp_api_tunnel_mode_t mode
#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.
int vnet_set_ip6_ethernet_neighbor(vlib_main_t *vm, u32 sw_if_index, const ip6_address_t *a, const mac_address_t *mac, ip_neighbor_flags_t flags)
static uword neighbor_scan_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
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)
ip_neighbor_flags_t flags
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.