|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
53 #define foreach_ethernet_arp_error \
54 _ (replies_sent, "ARP replies sent") \
55 _ (l2_type_not_ethernet, "L2 type not ethernet") \
56 _ (l3_type_not_ip4, "L3 type not IP4") \
57 _ (l3_src_address_not_local, "IP4 source address not local to subnet") \
58 _ (l3_dst_address_not_local, "IP4 destination address not local to subnet") \
59 _ (l3_dst_address_unset, "IP4 destination address is unset") \
60 _ (l3_src_address_is_local, "IP4 source address matches local interface") \
61 _ (l3_src_address_learned, "ARP request IP4 source address learned") \
62 _ (replies_received, "ARP replies received") \
63 _ (opcode_not_request, "ARP opcode not request") \
64 _ (proxy_arp_replies_sent, "Proxy ARP replies sent") \
65 _ (l2_address_mismatch, "ARP hw addr does not match L2 frame src addr") \
66 _ (gratuitous_arp, "ARP probe or announcement dropped") \
67 _ (interface_no_table, "Interface is not mapped to an IP table") \
68 _ (interface_not_ip_enabled, "Interface is not IP enabled") \
69 _ (unnumbered_mismatch, "RX interface is unnumbered to different subnet") \
73 #define _(sym,string) ETHERNET_ARP_ERROR_##sym,
80 #define _(sym,string) string,
126 const ethernet_arp_ip4_over_ethernet_address_t *
a)
146 const ip6_address_t *
addr,
172 icmp6_neighbor_solicitation_or_advertisement_header_t *ndh;
177 if (ndh->icmp.type != ICMP6_neighbor_solicitation &&
178 ndh->icmp.type != ICMP6_neighbor_advertisement)
182 (p0->
flags & VLIB_BUFFER_IS_TRACED)))
196 if (ndh->icmp.type == ICMP6_neighbor_solicitation)
198 icmp6_neighbor_discovery_ethernet_link_layer_address_option_t *opt;
202 opt = (
void *) (ndh + 1);
203 if ((opt->header.type !=
204 ICMP6_NEIGHBOR_DISCOVERY_OPTION_source_link_layer_address) ||
205 (opt->header.n_data_u64s != 1))
216 ip->dst_address =
ip->src_address;
217 ip->src_address = ndh->target_address;
220 ICMP6_NEIGHBOR_DISCOVERY_OPTION_target_link_layer_address;
222 ndh->icmp.type = ICMP6_neighbor_advertisement;
223 ndh->advertisement_flags = clib_host_to_net_u32
226 ndh->icmp.checksum = 0;
232 ICMP6_ERROR_NEIGHBOR_ADVERTISEMENTS_TX, 1);
247 u32 n_replies_sent = 0;
248 u16 last_bd_index = ~0;
269 u32 pi0, error0, next0, sw_if_index0;
285 goto next_l2_feature;
289 ethertype0 = clib_net_to_host_u16 (*(
u16 *) (l3h0 - 2));
292 if (ethertype0 != ETHERNET_TYPE_ARP)
296 clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_request)) &&
298 clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply)))
303 (p0->
flags & VLIB_BUFFER_IS_TRACED)))
314 clib_net_to_host_u16 (ETHERNET_ARP_HARDWARE_TYPE_ethernet)
315 ? ETHERNET_ARP_ERROR_l2_type_not_ethernet : error0);
318 clib_net_to_host_u16 (ETHERNET_TYPE_IP4) ?
319 ETHERNET_ARP_ERROR_l3_type_not_ip4 : error0);
338 error0 = ETHERNET_ARP_ERROR_l2_address_mismatch;
345 error0 = ETHERNET_ARP_ERROR_l3_src_address_not_local;
357 || (last_bd_index == (
u16) ~ 0)))
359 last_bd_index = bd_index0;
365 goto next_l2_feature;
368 goto next_l2_feature;
372 arp0->
opcode = clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply);
386 vnet_buffer (p0)->l2.feature_bitmap |= L2INPUT_FEAT_FWD;
388 goto next_l2_feature;
395 to_next, n_left_to_next, pi0,
404 iph0->
protocol == IP_PROTOCOL_ICMP6 &&
410 (
vm,
node, p0, eth0, iph0, sw_if_index0,
412 goto output_response;
418 L2INPUT_FEAT_ARP_TERM);
420 to_next, n_left_to_next,
430 error0 = ETHERNET_ARP_ERROR_gratuitous_arp;
436 to_next, n_left_to_next, pi0,
444 ETHERNET_ARP_ERROR_replies_sent, n_replies_sent);
445 return frame->n_vectors;
451 .name =
"arp-term-l2bd",
452 .vector_size =
sizeof (
u32),
static uword ip6_address_is_link_local_unicast(const ip6_address_t *a)
static void l2_arp_term_publish_v6_dp(u32 sw_if_index, const ip6_address_t *addr, const mac_address_t *mac)
static u8 * format_arp_term_input_trace(u8 *s, va_list *va)
#define ICMP6_NEIGHBOR_ADVERTISEMENT_FLAG_OVERRIDE
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
clib_error_t * arp_term_init(vlib_main_t *vm)
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)
nat44_ei_hairpin_src_next_t next_index
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
l2_arp_term_main_t l2_arp_term_main
#define clib_memcmp(s1, s2, m1)
vlib_main_t vlib_node_runtime_t * node
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static uword ip6_address_is_unspecified(const ip6_address_t *a)
void l2_arp_term_set_publisher_node(bool on)
static void vlib_error_count(vlib_main_t *vm, uword node_index, uword counter, uword increment)
static void * ip6_next_header(ip6_header_t *i)
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
@ ARP_TERM_NEXT_L2_OUTPUT
static int ethernet_mac_address_equal(const u8 *a, const u8 *b)
static uword ip4_address_is_multicast(const ip4_address_t *a)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#define foreach_ethernet_arp_error
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static int vnet_ip6_nd_term(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_buffer_t *p0, ethernet_header_t *eth, ip6_header_t *ip, u32 sw_if_index, u16 bd_index)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define VLIB_NODE_FLAG_TRACE
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define ICMP6_NEIGHBOR_ADVERTISEMENT_FLAG_SOLICITED
struct _vlib_node_registration vlib_node_registration_t
@ L2_ARP_TERM_EVENT_PUBLISH
static u32 vnet_l2_feature_next(vlib_buffer_t *b, u32 *next_nodes, u32 feat_bit)
Return the graph node index for the feature corresponding to the next set bit after clearing the curr...
#define hash_get_mem(h, key)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
u32 node_index
Node index.
u32 arp_term_next_node_index[32]
description fragment has unexpected format
vlib_put_next_frame(vm, node, next_index, 0)
static uword ethernet_address_cast(const u8 *a)
ethernet_arp_reply_error_t
#define VLIB_INIT_FUNCTION(x)
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
static char * ethernet_arp_error_strings[]
l2_arp_term_publish_event_t * publish_events
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
static const u8 vrrp_prefix[]
static vlib_node_registration_t arp_term_l2bd_node
(constructor) VLIB_REGISTER_NODE (arp_term_l2bd_node)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static vlib_main_t * vlib_get_main(void)
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)
static int l2_arp_term_publish(l2_arp_term_publish_event_t *ctx)
static void l2_arp_term_publish_v4_dp(u32 sw_if_index, const ethernet_arp_ip4_over_ethernet_address_t *a)
vlib_node_registration_t ip6_icmp_input_node
(constructor) VLIB_REGISTER_NODE (ip6_icmp_input_node)
static uword arp_term_l2bd(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
l2_input_config_t * configs
vlib_node_registration_t l2_arp_term_process_node
(constructor) VLIB_REGISTER_NODE (l2_arp_term_process_node)
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).
u8 * format_ethernet_arp_header(u8 *s, va_list *va)
static void feat_bitmap_init_next_nodes(vlib_main_t *vm, u32 node_index, u32 num_features, char **feat_names, u32 *next_nodes)
Initialize the feature next-node indexes of a graph node.
l2_bridge_domain_t * bd_configs
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
static_always_inline void mac_address_from_bytes(mac_address_t *mac, const u8 *bytes)
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)