27 .subclass_name =
"neighbor",
30 #define log_debug(fmt, ...) \ 31 vlib_log_debug (ip6_neighbor_log.class, fmt, __VA_ARGS__) 39 sw_if_index, &src, dst);
57 log_debug (
"Sending unsolicitated NA IP6 address %U on sw_if_idex %d",
63 icmp6_neighbor_solicitation_header_t *
h =
65 &ip6_neighbor_packet_template,
71 IP6_MULTICAST_SCOPE_link_local,
72 IP6_MULTICAST_GROUP_ID_all_hosts);
73 h->ip.src_address = addr[0];
74 h->neighbor.icmp.type = ICMP6_neighbor_advertisement;
75 h->neighbor.target_address = addr[0];
76 h->neighbor.advertisement_flags = clib_host_to_net_u32
78 h->link_layer_option.header.type =
79 ICMP6_NEIGHBOR_DISCOVERY_OPTION_target_link_layer_address;
82 h->neighbor.icmp.checksum =
84 ASSERT (bogus_length == 0);
89 IP6_MULTICAST_GROUP_ID_all_hosts);
92 rewrite_len =
vec_len (rewrite);
143 while (n_left_from > 0)
146 to_next_drop, n_left_to_next_drop);
148 while (n_left_from > 0 && n_left_to_next_drop > 0)
150 u32 pi0, adj_index0, sw_if_index0, drop0, r0;
175 sw_if_index0 = adj0->rewrite_header.sw_if_index;
185 to_next_drop[0] = pi0;
187 n_left_to_next_drop -= 1;
229 b0->
flags |= p0->
flags & VLIB_BUFFER_IS_TRACED;
272 .vector_size =
sizeof (
u32),
286 .name =
"ip6-discover-neighbor",
287 .vector_size =
sizeof (
u32),
306 icmp6_neighbor_solicitation_header_t p;
310 p.ip.ip_version_traffic_class_and_flow_label =
311 clib_host_to_net_u32 (0x6 << 28);
312 p.ip.payload_length =
313 clib_host_to_net_u16 (
sizeof (p) -
315 (icmp6_neighbor_solicitation_header_t, neighbor));
316 p.ip.protocol = IP_PROTOCOL_ICMP6;
317 p.ip.hop_limit = 255;
320 p.neighbor.icmp.type = ICMP6_neighbor_solicitation;
322 p.link_layer_option.header.type =
323 ICMP6_NEIGHBOR_DISCOVERY_OPTION_source_link_layer_address;
324 p.link_layer_option.header.n_data_u64s =
325 sizeof (p.link_layer_option) /
sizeof (
u64);
328 &ip6_neighbor_packet_template, &p,
sizeof (p),
330 "ip6 neighbor discovery");
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
static vlib_buffer_t * ip6_neighbor_probe(vlib_main_t *vm, vnet_main_t *vnm, u32 sw_if_index, const ip6_address_t *src, const ip6_address_t *dst)
ip6_discover_neighbor_next_t
static clib_error_t * ip6_neighbor_init(vlib_main_t *vm)
#define VLIB_MAIN_LOOP_ENTER_FUNCTION(x)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static f64 vlib_time_now(vlib_main_t *vm)
static uword ip6_discover_neighbor_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int is_glean)
This packet is to be rewritten and forwarded to the next processing node.
void throttle_init(throttle_t *t, u32 n_threads, f64 time)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
ip6_address_t * ip6_interface_first_address(ip6_main_t *im, u32 sw_if_index)
get first IPv6 interface address
#define STRUCT_OFFSET_OF(t, f)
vlib_packet_template_t ip6_neighbor_packet_template
vlib_error_t * errors
Vector of errors for this node.
#define clib_memcpy(d, s, n)
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
static u64 ip6_address_hash_to_u64(const ip6_address_t *a)
void * vlib_packet_template_get_packet(vlib_main_t *vm, vlib_packet_template_t *t, u32 *bi_result)
#define VLIB_INIT_FUNCTION(x)
static uword ip6_glean(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define ICMP6_NEIGHBOR_ADVERTISEMENT_FLAG_OVERRIDE
vnet_hw_interface_flags_t flags
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
bool fib_sas6_get(u32 sw_if_index, const ip6_address_t *dst, ip6_address_t *src)
Get an IPv6 Source address to use in a packet being sent out an interface.
vnet_main_t * vnet_get_main(void)
static clib_error_t * ip6_nd_main_loop_enter(vlib_main_t *vm)
union ip_adjacency_t_::@144 sub_type
void ip6_neighbor_advertise(vlib_main_t *vm, vnet_main_t *vnm, u32 sw_if_index, const ip6_address_t *addr)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
vl_api_interface_index_t sw_if_index
void vlib_packet_template_init(vlib_main_t *vm, vlib_packet_template_t *t, void *packet_data, uword n_packet_data_bytes, uword min_n_buffers_each_alloc, char *fmt,...)
static char * ip6_discover_neighbor_error_strings[]
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
u32 trace_handle
Specifies trace buffer handle if VLIB_PACKET_IS_TRACED flag is set.
static u64 throttle_seed(throttle_t *t, u32 thread_index, f64 time_now)
ip6_discover_neighbor_error_t
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
A throttle Used in the data plane to decide if a given hash should be throttled, i.e.
vlib_thread_main_t vlib_thread_main
static uword ip6_discover_neighbor(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define VLIB_REGISTER_NODE(x,...)
#define log_debug(fmt,...)
#define vec_free(V)
Free vector's memory (no header).
void ip6_neighbor_probe_dst(u32 sw_if_index, const ip6_address_t *dst)
u16 ip6_tcp_udp_icmp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip6_header_t *ip0, int *bogus_lengthp)
VLIB_REGISTER_LOG_CLASS(ip6_neighbor_log, static)
vlib_put_next_frame(vm, node, next_index, 0)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
static vlib_main_t * vlib_get_main(void)
static throttle_t nd_throttle
ND throttling.
static void ip6_set_solicited_node_multicast_address(ip6_address_t *a, u32 id)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_main_t vlib_node_runtime_t * node
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u8 * ethernet_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
build a rewrite string to use for sending packets of type 'link_type' to 'dst_address' ...
bool ip6_link_is_enabled(u32 sw_if_index)
vlib_node_registration_t ip6_glean_node
(constructor) VLIB_REGISTER_NODE (ip6_glean_node)
vlib_node_registration_t ip6_discover_neighbor_node
(constructor) VLIB_REGISTER_NODE (ip6_discover_neighbor_node)
void ip6_forward_next_trace(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, vlib_rx_or_tx_t which_adj_index)
u16 flags
Copy of main node flags.
static void ip6_multicast_ethernet_address(u8 *ethernet_address, u32 group_id)
#define VLIB_NODE_FLAG_TRACE
struct ip_adjacency_t_::@144::@145 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static void ip6_set_reserved_multicast_address(ip6_address_t *a, ip6_multicast_address_scope_t scope, u16 id)
static int throttle_check(throttle_t *t, u32 thread_index, u64 hash, u64 seed)
u8 * format_ip6_forward_next_trace(u8 *s, va_list *args)