70 int *result = va_arg (*args,
int *);
98 int *result = va_arg (*args,
int *);
103 *result = clib_host_to_net_u16 ((
u16) * result);
165 u32 input_sw_if_index,
u32 conn_sw_if_index)
190 const ethernet_arp_ip4_over_ethernet_address_t *
addr)
201 return (ETHERNET_ARP_ERROR_l3_src_address_learned);
214 u32 n_left_from, next_index, *from, *to_next, n_left_to_next;
226 while (n_left_from > 0)
230 while (n_left_from > 0 && n_left_to_next > 0)
237 pi0 = to_next[0] = from[0];
246 error0 = ETHERNET_ARP_ERROR_replies_sent;
251 clib_net_to_host_u16 (ETHERNET_ARP_HARDWARE_TYPE_ethernet) ?
252 ETHERNET_ARP_ERROR_l2_type_not_ethernet : error0);
255 clib_net_to_host_u16 (ETHERNET_TYPE_IP4) ?
256 ETHERNET_ARP_ERROR_l3_type_not_ip4 : error0);
259 ETHERNET_ARP_ERROR_l3_dst_address_unset : error0);
261 if (ETHERNET_ARP_ERROR_replies_sent == error0)
272 n_left_to_next, pi0, next0);
287 #define foreach_arp_disabled_error \ 288 _ (DISABLED, "ARP Disabled on this interface") \ 292 #define _(sym,string) ARP_DISABLED_ERROR_##sym, 299 #define _(sym,string) string, 308 u32 n_left_from, next_index, *from, *to_next, n_left_to_next;
319 while (n_left_from > 0)
323 while (n_left_from > 0 && n_left_to_next > 0)
330 error0 = ARP_DISABLED_ERROR_DISABLED;
332 pi0 = to_next[0] = from[0];
342 n_left_to_next, pi0, next0);
387 u32 n_left_from, next_index, *from, *to_next;
388 u32 n_replies_sent = 0;
399 while (n_left_from > 0)
405 while (n_left_from > 0 && n_left_to_next > 0)
411 u32 pi0, error0, next0, sw_if_index0, conn_sw_if_index0, fib_index0;
412 u8 dst_is_local0, is_vrrp_reply0;
430 error0 = ETHERNET_ARP_ERROR_replies_sent;
435 if (~0 == fib_index0)
437 error0 = ETHERNET_ARP_ERROR_interface_no_table;
465 ip4_over_ethernet[0].ip4,
483 error0 = ETHERNET_ARP_ERROR_l3_src_address_is_local;
538 error0 = ETHERNET_ARP_ERROR_l3_src_address_not_local;
567 error0 = ETHERNET_ARP_ERROR_l3_dst_address_not_local;
577 clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply))
590 error0 = ETHERNET_ARP_ERROR_l2_address_mismatch;
597 clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply))
606 error0 = ETHERNET_ARP_ERROR_l3_dst_address_not_local;
611 clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_request) &&
612 (dst_is_local0 == 0))
619 if (sw_if_index0 != conn_sw_if_index0 ||
629 error0 = ETHERNET_ARP_ERROR_unnumbered_mismatch;
636 error0 = ETHERNET_ARP_ERROR_gratuitous_arp;
641 if_addr0, arp0, eth_rx);
660 n_left_to_next, pi0, next0);
667 ETHERNET_ARP_ERROR_replies_sent, n_replies_sent);
674 #define _(sym,string) string, 685 .vector_size =
sizeof (
u32),
700 .name =
"arp-disabled",
701 .vector_size =
sizeof (
u32),
716 .vector_size =
sizeof (
u32),
733 .last_in_arc =
"error-drop",
740 .node_name =
"arp-reply",
747 .node_name =
"arp-proxy",
755 .node_name =
"arp-disabled",
762 .node_name =
"error-drop",
777 } ip4_over_ethernet[2];
784 #define _(f) pg_edit_init (&p->f, ethernet_arp_header_t, f); 787 _(n_l2_address_bytes);
788 _(n_l3_address_bytes);
790 _(ip4_over_ethernet[0].
mac);
791 _(ip4_over_ethernet[0].
ip4);
792 _(ip4_over_ethernet[1].mac);
793 _(ip4_over_ethernet[1].ip4);
814 if (!
unformat (input,
"%U: %U/%U -> %U/%U",
882 #define _(o) hash_set_mem (am->opcode_by_name, #o, ETHERNET_ARP_OPCODE_##o); 892 vnet_pcap_drop_trace_filter_add_del \ 893 (rt->errors[ETHERNET_ARP_ERROR_##a], \ #define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
#define foreach_ethernet_arp_error
enum fib_source_t_ fib_source_t
The different sources that can create a route.
static void arp_enable(ethernet_arp_main_t *am, u32 sw_if_index)
static uword arp_disabled(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
vl_api_wireguard_peer_flags_t flags
static uword arp_reply(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u32 enabled
Is ARP enabled on this interface.
uword unformat_pg_arp_header(unformat_input_t *input, va_list *args)
static void pg_ethernet_arp_header_init(pg_ethernet_arp_header_t *p)
vnet_main_t * vnet_get_main(void)
static void pg_edit_set_fixed(pg_edit_t *e, u64 value)
vnet_interface_main_t interface_main
void ip_neighbor_learn_dp(const ip_neighbor_learn_t *l)
APIs invoked by neighbor implementation (i.s.
static void vlib_error_count(vlib_main_t *vm, uword node_index, uword counter, uword increment)
static vlib_node_registration_t arp_reply_node
(constructor) VLIB_REGISTER_NODE (arp_reply_node)
Information related to the source of a FIB entry.
struct ethernet_arp_interface_t_ ethernet_arp_interface_t
Per-interface ARP configuration and state.
#define foreach_arp_disabled_error
static uword arp_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static vlib_node_registration_t arp_disabled_node
(constructor) VLIB_REGISTER_NODE (arp_disabled_node)
static uword unformat_ethernet_arp_opcode_host_byte_order(unformat_input_t *input, va_list *args)
uword unformat_pg_edit(unformat_input_t *input, va_list *args)
static void arp_enable_disable_interface(ip4_main_t *im, uword opaque, u32 sw_if_index, u32 is_enable)
const fib_prefix_t * fib_entry_get_prefix(fib_node_index_t fib_entry_index)
int arp_proxy_del(u32 fib_index, const ip4_address_t *lo_addr, const ip4_address_t *hi_addr)
vlib_error_t * errors
Vector of errors for this node.
static pg_node_t * pg_get_node(uword node_index)
static const u8 vrrp_prefix[]
u32 ip4_fib_table_get_index_for_sw_if_index(u32 sw_if_index)
ip4_enable_disable_interface_callback_t * enable_disable_interface_callbacks
Functions to call when interface becomes IPv4 enabled/disable.
#define VLIB_INIT_FUNCTION(x)
enum arp_input_next_t_ arp_input_next_t
Aggregate type for a prefix.
static u8 * format_ethernet_arp_input_trace(u8 *s, va_list *va)
static void * pg_create_edit_group(pg_stream_t *s, int n_edit_bytes, int n_packet_bytes, u32 *group_index)
u16 fp_len
The mask length.
static enum arp_dst_fib_type arp_dst_fib_check(const fib_node_index_t fei, fib_entry_flag_t *flags)
int arp_proxy_add(u32 fib_index, const ip4_address_t *lo_addr, const ip4_address_t *hi_addr)
#define hash_create_string(elts, value_bytes)
#define foreach_ethernet_arp_opcode
Per-interface ARP configuration and state.
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#define FOR_EACH_SRC_ADDED(_entry, _src, _source, action)
static int arp_is_enabled(ethernet_arp_main_t *am, u32 sw_if_index)
static ethernet_header_t * ethernet_buffer_get_header(vlib_buffer_t *b)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
void ip_neighbor_register(ip46_type_t type, const ip_neighbor_vft_t *vft)
static clib_error_t * vnet_arp_add_del_sw_interface(vnet_main_t *vnm, u32 sw_if_index, u32 is_add)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vnet_sw_interface_flags_t flags
ethernet_arp_interface_t * ethernet_arp_by_sw_if_index
Per interface state.
u32 node_index
Node index.
static clib_error_t * ethernet_arp_init(vlib_main_t *vm)
#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.
static_always_inline u32 arp_mk_reply(vnet_main_t *vnm, vlib_buffer_t *p0, u32 sw_if_index0, const ip4_address_t *if_addr0, ethernet_arp_header_t *arp0, ethernet_header_t *eth_rx)
#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).
uword unformat_mac_address_t(unformat_input_t *input, va_list *args)
u32 fib_entry_get_resolving_interface(fib_node_index_t entry_index)
fib_node_index_t ip4_fib_table_lookup(const ip4_fib_t *fib, const ip4_address_t *addr, u32 len)
int arp_proxy_disable(u32 sw_if_index)
int fib_entry_is_sourced(fib_node_index_t fib_entry_index, fib_source_t source)
#define VLIB_REGISTER_NODE(x,...)
static void arp_disable(ethernet_arp_main_t *am, u32 sw_if_index)
sll srl srl sll sra u16x4 i
ip4_enable_disable_interface_function_t * function
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
static ethernet_arp_main_t ethernet_arp_main
static ip4_fib_t * ip4_fib_get(u32 index)
Get the FIB at the given index.
static int ethernet_mac_address_equal(const u8 *a, const u8 *b)
static char * ethernet_arp_error_strings[]
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
VNET_SW_INTERFACE_ADD_DEL_FUNCTION(vnet_arp_add_del_sw_interface)
unformat_function_t * unformat_edit
Virtual function Table for neighbor protocol implementations to register.
u32 fib_node_index_t
A typedef of a node index.
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.
fib_entry_t * fib_entry_get(fib_node_index_t index)
enum fib_entry_flag_t_ fib_entry_flag_t
vlib_main_t vlib_node_runtime_t * node
u32 unnumbered_sw_if_index
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
VNET_FEATURE_ARC_INIT(arp_feat, static)
static void pg_free_edit_group(pg_stream_t *s)
VNET_FEATURE_INIT(arp_reply_feat_node, static)
static char * arp_disabled_error_strings[]
#define VNET_FEATURES(...)
void ethernet_register_input_type(vlib_main_t *vm, ethernet_type_t type, u32 node_index)
fib_entry_flag_t fib_entry_get_flags_for_source(fib_node_index_t fib_entry_index, fib_source_t source)
void vlib_trace_frame_buffers_only(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, uword n_buffers, uword next_buffer_stride, uword n_buffer_data_bytes_in_trace)
static vlib_node_registration_t arp_input_node
(constructor) VLIB_REGISTER_NODE (arp_input_node)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
VLIB buffer representation.
vnet_sw_interface_t * sw_interfaces
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
The default route source.
u8 * format_ethernet_arp_header(u8 *s, va_list *va)
enum arp_disabled_next_t_ arp_disabled_next_t
ip4_main_t ip4_main
Global ip4 main structure.
u16 flags
Copy of main node flags.
static int arp_unnumbered(vlib_buffer_t *p0, u32 input_sw_if_index, u32 conn_sw_if_index)
#define VLIB_NODE_FLAG_TRACE
static uword unformat_ethernet_arp_opcode_net_byte_order(unformat_input_t *input, va_list *args)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
ip4_neighbor_proxy_addr_t inv_proxy4_add
vl_api_interface_index_t sw_if_index
static u32 arp_learn(u32 sw_if_index, const ethernet_arp_ip4_over_ethernet_address_t *addr)
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
static_always_inline void vnet_feature_arc_start(u8 arc, u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)