27 (&
ip6_main, dst, adj->rewrite_header.sw_if_index, &ia);
42 u8 *rewrite, rewrite_len;
51 (
"Sending unsolicitated NA IP6 address %U on sw_if_idex %d",
57 icmp6_neighbor_solicitation_header_t *
h =
59 &ip6_neighbor_packet_template,
65 IP6_MULTICAST_SCOPE_link_local,
66 IP6_MULTICAST_GROUP_ID_all_hosts);
67 h->ip.src_address = addr[0];
68 h->neighbor.icmp.type = ICMP6_neighbor_advertisement;
69 h->neighbor.target_address = addr[0];
70 h->neighbor.advertisement_flags = clib_host_to_net_u32
72 h->link_layer_option.header.type =
73 ICMP6_NEIGHBOR_DISCOVERY_OPTION_target_link_layer_address;
76 h->neighbor.icmp.checksum =
78 ASSERT (bogus_length == 0);
83 IP6_MULTICAST_GROUP_ID_all_hosts);
86 rewrite_len =
vec_len (rewrite);
125 u32 *from, *to_next_drop;
126 uword n_left_from, n_left_to_next_drop;
138 while (n_left_from > 0)
141 to_next_drop, n_left_to_next_drop);
143 while (n_left_from > 0 && n_left_to_next_drop > 0)
145 u32 pi0, adj_index0, sw_if_index0, drop0, r0;
170 sw_if_index0 = adj0->rewrite_header.sw_if_index;
180 to_next_drop[0] = pi0;
182 n_left_to_next_drop -= 1;
224 b0->
flags |= p0->
flags & VLIB_BUFFER_IS_TRACED;
267 .vector_size =
sizeof (
u32),
281 .name =
"ip6-discover-neighbor",
282 .vector_size =
sizeof (
u32),
301 icmp6_neighbor_solicitation_header_t p;
305 p.ip.ip_version_traffic_class_and_flow_label =
306 clib_host_to_net_u32 (0x6 << 28);
307 p.ip.payload_length =
308 clib_host_to_net_u16 (
sizeof (p) -
310 (icmp6_neighbor_solicitation_header_t, neighbor));
311 p.ip.protocol = IP_PROTOCOL_ICMP6;
312 p.ip.hop_limit = 255;
315 p.neighbor.icmp.type = ICMP6_neighbor_solicitation;
317 p.link_layer_option.header.type =
318 ICMP6_NEIGHBOR_DISCOVERY_OPTION_source_link_layer_address;
319 p.link_layer_option.header.n_data_u64s =
320 sizeof (p.link_layer_option) /
sizeof (
u64);
323 &ip6_neighbor_packet_template, &p,
sizeof (p),
325 "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, const ip_adjacency_t *adj, 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)
vnet_main_t * vnet_get_main(void)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
#define clib_memcpy_fast(a, b, c)
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.
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)
vl_api_interface_index_t sw_if_index
#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
struct ip_adjacency_t_::@119::@120 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
vnet_hw_interface_flags_t flags
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
int ip6_src_address_for_packet(u32 sw_if_index, const ip6_address_t *dst, ip6_address_t *src)
union ip_adjacency_t_::@119 sub_type
void ip6_neighbor_advertise(vlib_main_t *vm, vnet_main_t *vnm, u32 sw_if_index, const ip6_address_t *addr)
throttle_t nd_throttle
ND throttling.
vlib_error_t error
Error code for buffers to be enqueued to error handler.
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
#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).
static uword ip6_discover_neighbor(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define VLIB_REGISTER_NODE(x,...)
#define vec_free(V)
Free vector's memory (no header).
#define clib_warning(format, args...)
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
vlib_main_t vlib_node_runtime_t * node
u16 ip6_tcp_udp_icmp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip6_header_t *ip0, int *bogus_lengthp)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static vlib_main_t * vlib_get_main(void)
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)
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.
void ip6_neighbor_probe_dst(const ip_adjacency_t *adj, const ip6_address_t *dst)
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)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
u16 flags
Copy of main node flags.
static void ip6_multicast_ethernet_address(u8 *ethernet_address, u32 group_id)
static ip6_address_t * ip6_interface_address_matching_destination(ip6_main_t *im, const ip6_address_t *dst, u32 sw_if_index, ip_interface_address_t **result_ia)
#define VLIB_NODE_FLAG_TRACE
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)