|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
27 .subclass_name =
"neighbor",
30 #define log_debug(fmt, ...) \
31 vlib_log_debug (ip6_neighbor_log.class, fmt, __VA_ARGS__)
57 log_debug (
"Sending unsolicitated NA IP6 address %U on sw_if_idex %d",
63 icmp6_neighbor_solicitation_header_t *
h =
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);
146 to_next_drop, n_left_to_next_drop);
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;
244 return frame->n_vectors;
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);
330 "ip6 neighbor discovery");
void throttle_init(throttle_t *t, u32 n_threads, f64 time)
static clib_error_t * ip6_neighbor_init(vlib_main_t *vm)
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)
#define ICMP6_NEIGHBOR_ADVERTISEMENT_FLAG_OVERRIDE
static void ip6_multicast_ethernet_address(u8 *ethernet_address, u32 group_id)
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'
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
ip6_discover_neighbor_next_t
u16 ip6_tcp_udp_icmp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip6_header_t *ip0, int *bogus_lengthp)
#define clib_memcpy(d, s, n)
@ IP6_NBR_ERROR_NO_SOURCE_ADDRESS
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static u64 ip6_address_hash_to_u64(const ip6_address_t *a)
vlib_main_t vlib_node_runtime_t * node
vlib_packet_template_t ip6_neighbor_packet_template
vnet_hw_interface_flags_t flags
static uword ip6_discover_neighbor_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int is_glean)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
@ VNET_HW_INTERFACE_FLAG_LINK_UP
u32 trace_handle
Specifies trace buffer handle if VLIB_PACKET_IS_TRACED flag is set.
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
#define STRUCT_OFFSET_OF(t, f)
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
static uword ip6_glean(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
vnet_main_t * vnet_get_main(void)
static char * ip6_discover_neighbor_error_strings[]
#define VLIB_NODE_FLAG_TRACE
ip6_discover_neighbor_error_t
static void ip6_set_solicited_node_multicast_address(ip6_address_t *a, u32 id)
void ip6_neighbor_advertise(vlib_main_t *vm, vnet_main_t *vnm, u32 sw_if_index, const ip6_address_t *addr)
static clib_error_t * ip6_nd_main_loop_enter(vlib_main_t *vm)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
vlib_thread_main_t vlib_thread_main
@ IP_LOOKUP_NEXT_REWRITE
This packet is to be rewritten and forwarded to the next processing node.
static uword ip6_discover_neighbor(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define log_debug(fmt,...)
static u64 throttle_seed(throttle_t *t, u32 thread_index, f64 time_now)
A throttle Used in the data plane to decide if a given hash should be throttled, i....
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.
struct _vlib_node_registration vlib_node_registration_t
static void ip6_set_reserved_multicast_address(ip6_address_t *a, ip6_multicast_address_scope_t scope, u16 id)
bool ip6_link_is_enabled(u32 sw_if_index)
#define vec_free(V)
Free vector's memory (no header).
union ip_adjacency_t_::@144 sub_type
void * vlib_packet_template_get_packet(vlib_main_t *vm, vlib_packet_template_t *t, u32 *bi_result)
@ IP6_NBR_ERROR_NO_BUFFERS
ip6_address_t * ip6_interface_first_address(ip6_main_t *im, u32 sw_if_index)
get first IPv6 interface address
vlib_put_next_frame(vm, node, next_index, 0)
static int throttle_check(throttle_t *t, u32 thread_index, u64 hash, u64 seed)
#define VLIB_INIT_FUNCTION(x)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
void ip6_neighbor_probe_dst(u32 sw_if_index, const ip6_address_t *dst)
static throttle_t nd_throttle
ND throttling.
VLIB_REGISTER_LOG_CLASS(ip6_neighbor_log, static)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static vlib_main_t * vlib_get_main(void)
vlib_node_registration_t ip6_glean_node
(constructor) VLIB_REGISTER_NODE (ip6_glean_node)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
struct ip_adjacency_t_::@144::@145 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
@ IP6_NBR_ERROR_REQUEST_SENT
vlib_node_registration_t ip6_discover_neighbor_node
(constructor) VLIB_REGISTER_NODE (ip6_discover_neighbor_node)
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 f64 vlib_time_now(vlib_main_t *vm)
vl_api_interface_index_t sw_if_index
#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).
#define VLIB_MAIN_LOOP_ENTER_FUNCTION(x)
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)
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
u8 * format_ip6_forward_next_trace(u8 *s, va_list *args)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)