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 86 sw_if_index, &ip->ip6, mac, flags);
92 ethernet_arp_ip4_over_ethernet_address_t
a = {
104 if (0 == rv && stats_index)
105 *stats_index =
adj_nbr_find (fproto, linkt, ip, sw_if_index);
118 sw_if_index, &ip->ip6);
122 ethernet_arp_ip4_over_ethernet_address_t
a = {
159 u8 is_ip6,
u8 delete_stale,
u8 * update_count)
167 u32 curr_idx = start_idx;
169 f64 delta, update_time;
182 while (curr_idx != ~0)
186 (((loop_count % 100) == 0) &&
205 delta = start_time - update_time;
212 ethernet_arp_ip4_over_ethernet_address_t delme = {
257 uword *event_data = 0;
258 u8 purge4 = 0, purge6 = 0;
274 if ((ip4_nidx == 0) && (ip6_nidx == 0))
291 if ((ip4_nidx == ~0) && (ip6_nidx == ~0))
294 ip4_nidx = ip6_nidx = 0;
303 else if (timeout < cfg->scan_int_delay)
314 .name =
"ip-neighbor-scan-process",
324 u32 interval = 0, time = 0, update = 0, delay = 0, stale = 0;
342 else if (
unformat (line_input,
"ip6"))
345 else if (
unformat (line_input,
"both"))
348 else if (
unformat (line_input,
"disable"))
351 else if (
unformat (line_input,
"interval %d", &interval))
354 else if (
unformat (line_input,
"max-time %d", &time))
357 else if (
unformat (line_input,
"max-update %d", &update))
360 else if (
unformat (line_input,
"delay %d", &delay))
363 else if (
unformat (line_input,
"stale %d", &stale))
422 .path =
"ip scan-neighbor",
424 .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>]",
436 return format (s,
"IPv4");
438 return format (s,
"IPv6");
440 return format (s,
"IPv4 and IPv6");
442 return format (s,
"unknown");
453 "IP neighbor scan disabled - current time is %.4f sec",
457 "current time is %.4f sec\n " 458 "Full_scan_interval: %f min " 459 "Stale_purge_threshod: %f min\n " 460 "Max_process_time: %f usec Max_updates %d " 461 "Delay_to_resume_after_max_limit: %f msec",
479 .path =
"show ip scan-neighbor",
481 .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)
static f64 vlib_time_now(vlib_main_t *vm)
#define IP_SCAN_V6_NEIGHBORS
clib_memset(h->entries, 0, sizeof(h->entries[0])*entries)
#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
vl_api_interface_index_t sw_if_index
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
vl_api_fib_path_type_t type
#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)
u8 * format_ip_neighbor_flags(u8 *s, va_list *args)
#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.