122 #define ETHERNET_ARP_ARGS_REMOVE (1<<0) 123 #define ETHERNET_ARP_ARGS_FLUSH (1<<1) 124 #define ETHERNET_ARP_ARGS_POPULATE (1<<2) 125 #define ETHERNET_ARP_ARGS_WC_PUB (1<<3) 144 #define _(n,f) case n: t = #f; break; 149 return format (s,
"unknown 0x%x", h);
152 return format (s,
"%s", t);
162 #define _(f) case ETHERNET_ARP_OPCODE_##f: t = #f; break; 167 return format (s,
"unknown 0x%x", o);
170 return format (s,
"%s", t);
177 int *result = va_arg (*args,
int *);
205 int *result = va_arg (*args,
int *);
210 *result = clib_host_to_net_u16 ((
u16) * result);
218 u32 max_header_bytes = va_arg (*va,
u32);
220 u16 l2_type, l3_type;
222 if (max_header_bytes != 0 &&
sizeof (a[0]) > max_header_bytes)
223 return format (s,
"ARP header truncated");
225 l2_type = clib_net_to_host_u16 (a->
l2_type);
226 l3_type = clib_net_to_host_u16 (a->
l3_type);
230 s =
format (s,
"%U, type %U/%U, address size %d/%d",
236 if (l2_type == ETHERNET_ARP_HARDWARE_TYPE_ethernet
237 && l3_type == ETHERNET_TYPE_IP4)
239 s =
format (s,
"\n%U%U/%U -> %U/%U",
250 s =
format (s,
"\n%U%U/%U -> %U/%U",
269 return format (s,
"%=12s%=16s%=6s%=20s%=24s",
"Time",
"IP4",
270 "Flags",
"Ethernet",
"Interface");
274 return format (s,
"%=12U%=16U%=6U%=20U%U",
401 adj->rewrite_header.sw_if_index,
477 u32 i, *to_delete = 0;
493 e = pool_elt_at_index(am->ip4_entry_pool,
495 vec_add1 (to_delete, e - am->ip4_entry_pool);
499 for (i = 0; i <
vec_len (to_delete); i++)
604 offset =
vec_len (rewrite) - 2;
684 if ((count++ == 100) || (index == ~0))
711 int make_new_arp_cache_entry = 1;
734 goto check_customers;
737 make_new_arp_cache_entry = 0;
741 if (make_new_arp_cache_entry)
784 goto check_customers;
814 while (next_index != (
u32) ~ 0)
833 while (next_index != (
u32) ~ 0)
902 while (p && *p != ~0)
911 int found = p && *p != ~0;
915 return VNET_API_ERROR_ENTRY_ALREADY_EXISTS;
922 .node_index = node_index,
923 .type_opaque = type_opaque,
940 return VNET_API_ERROR_NO_SUCH_ENTRY;
952 if (*p == ~0 && p == first)
966 #define foreach_ethernet_arp_error \ 967 _ (replies_sent, "ARP replies sent") \ 968 _ (l2_type_not_ethernet, "L2 type not ethernet") \ 969 _ (l3_type_not_ip4, "L3 type not IP4") \ 970 _ (l3_src_address_not_local, "IP4 source address not local to subnet") \ 971 _ (l3_dst_address_not_local, "IP4 destination address not local to subnet") \ 972 _ (l3_dst_address_unset, "IP4 destination address is unset") \ 973 _ (l3_src_address_is_local, "IP4 source address matches local interface") \ 974 _ (l3_src_address_learned, "ARP request IP4 source address learned") \ 975 _ (replies_received, "ARP replies received") \ 976 _ (opcode_not_request, "ARP opcode not request") \ 977 _ (proxy_arp_replies_sent, "Proxy ARP replies sent") \ 978 _ (l2_address_mismatch, "ARP hw addr does not match L2 frame src addr") \ 979 _ (gratuitous_arp, "ARP probe or announcement dropped") \ 980 _ (interface_no_table, "Interface is not mapped to an IP table") \ 981 _ (interface_not_ip_enabled, "Interface is not IP enabled") \ 982 _ (unnumbered_mismatch, "RX interface is unnumbered to different subnet") \ 986 #define _(sym,string) ETHERNET_ARP_ERROR_##sym, 994 u32 input_sw_if_index,
u32 conn_sw_if_index)
1020 const ethernet_arp_ip4_over_ethernet_address_t *
addr)
1023 return (ETHERNET_ARP_ERROR_l3_src_address_learned);
1036 u32 n_left_from, next_index, *from, *to_next, n_left_to_next;
1048 while (n_left_from > 0)
1052 while (n_left_from > 0 && n_left_to_next > 0)
1059 pi0 = to_next[0] = from[0];
1063 n_left_to_next -= 1;
1068 error0 = ETHERNET_ARP_ERROR_replies_sent;
1073 clib_net_to_host_u16 (ETHERNET_ARP_HARDWARE_TYPE_ethernet) ?
1074 ETHERNET_ARP_ERROR_l2_type_not_ethernet : error0);
1077 clib_net_to_host_u16 (ETHERNET_TYPE_IP4) ?
1078 ETHERNET_ARP_ERROR_l3_type_not_ip4 : error0);
1081 ETHERNET_ARP_ERROR_l3_dst_address_unset : error0);
1083 if (ETHERNET_ARP_ERROR_replies_sent == error0)
1094 n_left_to_next, pi0, next0);
1109 #define foreach_arp_disabled_error \ 1110 _ (DISABLED, "ARP Disabled on this interface") \ 1114 #define _(sym,string) ARP_DISABLED_ERROR_##sym, 1121 #define _(sym,string) string, 1130 u32 n_left_from, next_index, *from, *to_next, n_left_to_next;
1141 while (n_left_from > 0)
1145 while (n_left_from > 0 && n_left_to_next > 0)
1152 error0 = ARP_DISABLED_ERROR_DISABLED;
1154 pi0 = to_next[0] = from[0];
1158 n_left_to_next -= 1;
1164 n_left_to_next, pi0, next0);
1181 u8 *rewrite0, rewrite0_len;
1191 rewrite0_len =
vec_len (rewrite0);
1204 arp0->
opcode = clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply);
1262 u32 n_left_from, next_index, *from, *to_next;
1263 u32 n_replies_sent = 0;
1274 while (n_left_from > 0)
1280 while (n_left_from > 0 && n_left_to_next > 0)
1286 u32 pi0, error0, next0, sw_if_index0, conn_sw_if_index0, fib_index0;
1287 u8 dst_is_local0, is_vrrp_reply0;
1297 n_left_to_next -= 1;
1305 error0 = ETHERNET_ARP_ERROR_replies_sent;
1310 if (~0 == fib_index0)
1312 error0 = ETHERNET_ARP_ERROR_interface_no_table;
1340 ip4_over_ethernet[0].ip4,
1358 error0 = ETHERNET_ARP_ERROR_l3_src_address_is_local;
1413 error0 = ETHERNET_ARP_ERROR_l3_src_address_not_local;
1434 error0 =
arp_learn (vnm, am, sw_if_index0,
1442 error0 = ETHERNET_ARP_ERROR_l3_dst_address_not_local;
1448 if_addr0 = &pfx0->
fp_addr.ip4;
1452 clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply))
1465 error0 = ETHERNET_ARP_ERROR_l2_address_mismatch;
1472 clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply))
1475 error0 =
arp_learn (vnm, am, sw_if_index0,
1481 error0 = ETHERNET_ARP_ERROR_l3_dst_address_not_local;
1486 clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_request) &&
1487 (dst_is_local0 == 0))
1494 if (sw_if_index0 != conn_sw_if_index0 ||
1504 error0 = ETHERNET_ARP_ERROR_unnumbered_mismatch;
1511 error0 = ETHERNET_ARP_ERROR_gratuitous_arp;
1516 if_addr0, arp0, eth_rx);
1521 error0 =
arp_learn (vnm, am, sw_if_index0,
1524 n_replies_sent += 1;
1536 n_left_to_next, pi0, next0);
1543 ETHERNET_ARP_ERROR_replies_sent, n_replies_sent);
1553 u32 n_left_from, next_index, *from, *to_next;
1554 u32 n_arp_replies_sent = 0;
1565 while (n_left_from > 0)
1571 while (n_left_from > 0 && n_left_to_next > 0)
1577 u32 pi0, error0, next0, sw_if_index0, fib_index0;
1586 n_left_to_next -= 1;
1593 is_request0 = arp0->
opcode 1594 == clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_request);
1596 error0 = ETHERNET_ARP_ERROR_replies_sent;
1601 if (~0 == fib_index0)
1603 error0 = ETHERNET_ARP_ERROR_interface_no_table;
1606 if (0 == error0 && is_request0)
1608 u32 this_addr = clib_net_to_host_u32
1617 if ((this_addr >= lo_addr && this_addr <= hi_addr) &&
1626 n_arp_replies_sent++;
1640 n_left_to_next, pi0, next0);
1647 ETHERNET_ARP_ERROR_replies_sent, n_arp_replies_sent);
1653 #define _(sym,string) string, 1663 .name =
"arp-input",
1664 .vector_size =
sizeof (
u32),
1679 .name =
"arp-disabled",
1680 .vector_size =
sizeof (
u32),
1694 .name =
"arp-reply",
1695 .vector_size =
sizeof (
u32),
1710 .name =
"arp-proxy",
1711 .vector_size =
sizeof (
u32),
1728 .last_in_arc =
"error-drop",
1735 .node_name =
"arp-reply",
1742 .node_name =
"arp-proxy",
1750 .node_name =
"arp-disabled",
1757 .node_name =
"error-drop",
1793 if (sw_if_index != ~0 && n->sw_if_index != sw_if_index)
1795 vec_add1 (ns, n[0]);
1861 .path =
"show ip arp",
1863 .short_help =
"show ip arp",
1876 } ip4_over_ethernet[2];
1883 #define _(f) pg_edit_init (&p->f, ethernet_arp_header_t, f); 1886 _(n_l2_address_bytes);
1887 _(n_l3_address_bytes);
1889 _(ip4_over_ethernet[0].
mac);
1890 _(ip4_over_ethernet[0].ip4);
1891 _(ip4_over_ethernet[1].mac);
1892 _(ip4_over_ethernet[1].ip4);
1913 if (!
unformat (input,
"%U: %U/%U -> %U/%U",
1948 ethernet_arp_ip4_over_ethernet_address_t *
1959 (
u8 *) & args,
sizeof (args));
1969 const ethernet_arp_ip4_over_ethernet_address_t *
a)
1979 (
u8 *) & args,
sizeof (args));
1993 if (ni == (
uword) ~ 0)
2081 u32 if_address_index,
u32 is_del)
2096 u32 i, *to_delete = 0;
2104 e = pool_elt_at_index(am->ip4_entry_pool,
2106 if (ip4_destination_matches_route (im, &e->ip4_address,
2107 address, address_length))
2109 vec_add1 (to_delete, e - am->ip4_entry_pool);
2156 e = pool_elt_at_index(am->ip4_entry_pool,
2161 arp_adj_fib_remove(e, old_fib_index);
2162 arp_adj_fib_add(e, new_fib_index);
2181 #define _(o) hash_set_mem (am->opcode_by_name, #o, ETHERNET_ARP_OPCODE_##o); 2198 vnet_pcap_drop_trace_filter_add_del \ 2199 (rt->errors[ETHERNET_ARP_ERROR_##a], \ 2207 cb.function_opaque = 0;
2317 u32 i, *to_update = 0;
2322 if (e->sw_if_index == sw_if_index)
2323 vec_add1 (to_update,
2324 e - am->ip4_entry_pool);
2328 for (i = 0; i <
vec_len (to_update); i++)
2362 for (i = 3; i >= 0; i--)
2364 old = a->ip4.as_u8[
i];
2365 a->ip4.as_u8[
i] += 1;
2366 if (old < a->ip4.as_u8[i])
2370 for (i = 5; i >= 0; i--)
2372 old = a->mac.bytes[
i];
2373 a->mac.bytes[
i] += 1;
2374 if (old < a->
mac.bytes[i])
2382 const ethernet_arp_ip4_over_ethernet_address_t
2389 .ip4.as_u32 = a->ip4.as_u32,
2394 (
u8 *) & args,
sizeof (args));
2426 sw_if_index, 1, NULL, 0);
2435 sw_if_index, 0, NULL, 0);
2449 u32 found_at_index = ~0;
2461 if (found_at_index != ~0)
2470 return VNET_API_ERROR_NO_SUCH_ENTRY;
2502 u32 *entries_to_delete = 0;
2507 if (~0 == fib_index)
2508 return VNET_API_ERROR_NO_SUCH_ENTRY;
2518 for (i = 0; i <
vec_len (entries_to_delete); i++)
2534 ethernet_arp_ip4_over_ethernet_address_t lo_addr, hi_addr,
addr;
2557 else if (
unformat (input,
"static"))
2560 else if (
unformat (input,
"no-fib-entry"))
2563 else if (
unformat (input,
"count %d", &count))
2566 else if (
unformat (input,
"fib-id %d", &fib_id))
2570 if (~0 == fib_index)
2574 else if (
unformat (input,
"proxy %U - %U",
2593 for (i = 0; i <
count; i++)
2597 uword event_type, *event_data = 0;
2609 if (event_type != 1)
2657 .path =
"set ip arp",
2659 "set ip arp [del] <intfc> <ip-address> <mac-address> [static] [no-fib-entry] [count <count>] [fib-id <fib-id>] [proxy <lo-addr> - <hi-addr>]",
2688 if (~0 == sw_if_index)
2718 .path =
"set interface proxy-arp",
2720 "set interface proxy-arp <intfc> [enable|disable]",
2744 u32 n_left_from, next_index, *from, *to_next;
2745 u32 n_replies_sent = 0;
2746 u16 last_bd_index = ~0;
2754 while (n_left_from > 0)
2760 while (n_left_from > 0 && n_left_to_next > 0)
2767 u32 pi0, error0, next0, sw_if_index0;
2778 n_left_to_next -= 1;
2783 goto next_l2_feature;
2787 ethertype0 = clib_net_to_host_u16 (*(
u16 *) (l3h0 - 2));
2790 if (ethertype0 != ETHERNET_TYPE_ARP)
2794 clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_request)) &&
2796 clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply)))
2801 (p0->
flags & VLIB_BUFFER_IS_TRACED)))
2812 clib_net_to_host_u16 (ETHERNET_ARP_HARDWARE_TYPE_ethernet)
2813 ? ETHERNET_ARP_ERROR_l2_type_not_ethernet : error0);
2816 clib_net_to_host_u16 (ETHERNET_TYPE_IP4) ?
2817 ETHERNET_ARP_ERROR_l3_type_not_ip4 : error0);
2836 error0 = ETHERNET_ARP_ERROR_l2_address_mismatch;
2843 error0 = ETHERNET_ARP_ERROR_l3_src_address_not_local;
2858 || (last_bd_index == (
u16) ~ 0)))
2860 last_bd_index = bd_index0;
2866 goto next_l2_feature;
2869 goto next_l2_feature;
2873 arp0->
opcode = clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply);
2879 n_replies_sent += 1;
2887 vnet_buffer (p0)->l2.feature_bitmap |= L2INPUT_FEAT_FWD;
2889 goto next_l2_feature;
2896 to_next, n_left_to_next, pi0,
2905 iph0->
protocol == IP_PROTOCOL_ICMP6 &&
2911 (vm, node, p0, eth0, iph0, sw_if_index0,
2913 goto output_response;
2919 L2INPUT_FEAT_ARP_TERM);
2921 to_next, n_left_to_next,
2931 error0 = ETHERNET_ARP_ERROR_gratuitous_arp;
2937 to_next, n_left_to_next, pi0,
2945 ETHERNET_ARP_ERROR_replies_sent, n_replies_sent);
2952 .name =
"arp-term-l2bd",
2953 .vector_size =
sizeof (
u32),
3000 change_arp_mac (sw_if_index, e);
3025 u8 *rewrite, rewrite_len;
3030 clib_warning (
"Sending GARP for IP4 address %U on sw_if_idex %d",
3053 rewrite_len =
vec_len (rewrite);
3078 if (!is_add && sw_if_index != ~0)
3083 if (e->sw_if_index != sw_if_index)
3085 vnet_arp_set_ip4_over_ethernet_rpc_args_t args = {
3086 .sw_if_index = sw_if_index,
3087 .ip4 = e->ip4_address,
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
ip_neighbor_flags_t flags
#define vnet_rewrite_one_header(rw0, p0, most_likely_size)
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 void set_ip4_over_ethernet_rpc_callback(vnet_arp_set_ip4_over_ethernet_rpc_args_t *a)
static vlib_node_registration_t arp_proxy_node
(constructor) VLIB_REGISTER_NODE (arp_proxy_node)
int vnet_arp_set_ip4_over_ethernet(vnet_main_t *vnm, u32 sw_if_index, const ethernet_arp_ip4_over_ethernet_address_t *a, ip_neighbor_flags_t flags)
#define pool_next_index(P, I)
Return next occupied pool index after i, useful for safe iteration.
fib_node_index_t fib_table_entry_path_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_mpls_label_t *next_hop_labels, fib_route_path_flags_t path_flags)
Add one path to an entry (aka route) in the FIB.
#define VNET_REWRITE_FOR_SW_INTERFACE_ADDRESS_BROADCAST
static uword arp_term_l2bd(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define hash_set(h, key, value)
l2_input_config_t * configs
static void arp_enable(ethernet_arp_main_t *am, u32 sw_if_index)
ip4_table_bind_function_t * function
static uword arp_disabled(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u8 * format_ethernet_arp_ip4_entry(u8 *s, va_list *va)
ip4_add_del_interface_address_callback_t * add_del_interface_address_callbacks
Functions to call when interface address changes.
#define hash_unset(h, key)
int vnet_arp_unset_ip4_over_ethernet(vnet_main_t *vnm, u32 sw_if_index, const ethernet_arp_ip4_over_ethernet_address_t *a)
Control Plane hook to remove an ARP entry.
An indication that the rewrite is incomplete, i.e.
static uword * vlib_process_wait_for_event(vlib_main_t *vm)
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)
static int vnet_arp_unset_ip4_over_ethernet_internal(vnet_main_t *vnm, vnet_arp_set_ip4_over_ethernet_rpc_args_t *args)
static void increment_ip4_and_mac_address(ethernet_arp_ip4_over_ethernet_address_t *a)
An indication that the rewrite is complete, i.e.
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)
static uword vlib_current_process(vlib_main_t *vm)
static void arp_add_del_interface_address(ip4_main_t *im, uword opaque, u32 sw_if_index, ip4_address_t *address, u32 address_length, u32 if_address_index, u32 is_del)
static void pg_edit_set_fixed(pg_edit_t *e, u64 value)
static clib_error_t * show_ip4_arp(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vnet_interface_main_t interface_main
pending_resolution_t * pending_resolutions
static void vlib_error_count(vlib_main_t *vm, uword node_index, uword counter, uword increment)
#define clib_memcpy_fast(a, b, c)
static vlib_node_registration_t arp_reply_node
(constructor) VLIB_REGISTER_NODE (arp_reply_node)
vnet_link_t adj_get_link_type(adj_index_t ai)
Return the link type of the adjacency.
ip4_address_t * ip4_interface_first_address(ip4_main_t *im, u32 sw_if_index, ip_interface_address_t **result_ia)
static f64 vlib_time_now(vlib_main_t *vm)
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
void change_arp_mac(u32 sw_if_index, ethernet_arp_ip4_entry_t *e)
static u8 * format_ethernet_arp_header(u8 *s, va_list *va)
static clib_error_t * set_int_proxy_arp_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
clib_error_t * ip4_set_arp_limit(u32 arp_limit)
static uword arp_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
This packet is to be rewritten and forwarded to the next processing node.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
word vnet_sw_interface_compare(vnet_main_t *vnm, uword sw_if_index0, uword sw_if_index1)
void arp_update_adjacency(vnet_main_t *vnm, u32 sw_if_index, u32 ai)
static vlib_node_registration_t arp_disabled_node
(constructor) VLIB_REGISTER_NODE (arp_disabled_node)
static void arp_table_bind(ip4_main_t *im, uword opaque, u32 sw_if_index, u32 new_fib_index, u32 old_fib_index)
static uword unformat_ethernet_arp_opcode_host_byte_order(unformat_input_t *input, va_list *args)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
static_always_inline void mac_address_copy(mac_address_t *dst, const mac_address_t *src)
adj_index_t adj_glean_get(fib_protocol_t proto, u32 sw_if_index)
Get an existing glean.
uword unformat_pg_edit(unformat_input_t *input, va_list *args)
void adj_nbr_walk_nh4(u32 sw_if_index, const ip4_address_t *addr, adj_walk_cb_t cb, void *ctx)
Walk adjacencies on a link with a given v4 next-hop.
static void arp_enable_disable_interface(ip4_main_t *im, uword opaque, u32 sw_if_index, u32 is_enable)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
const fib_prefix_t * fib_entry_get_prefix(fib_node_index_t fib_entry_index)
unformat_function_t unformat_vnet_sw_interface
static uword ip4_address_is_multicast(const ip4_address_t *a)
vlib_error_t * errors
Vector of errors for this node.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
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 vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static pg_node_t * pg_get_node(uword node_index)
vnet_link_t ia_link
link/ether-type 1 bytes
union ip_adjacency_t_::@48 sub_type
static int vnet_arp_populate_ip4_over_ethernet_internal(vnet_main_t *vnm, vnet_arp_set_ip4_over_ethernet_rpc_args_t *args)
u32 send_garp_na_process_node_index
Adjacency to punt this packet.
VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION(ethernet_arp_sw_interface_up_down)
void adj_glean_update_rewrite(adj_index_t adj_index)
adj_glean_update_rewrite
static const u8 vrrp_prefix[]
u32 ip4_fib_table_get_index_for_sw_if_index(u32 sw_if_index)
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
#define static_always_inline
void * vlib_packet_template_get_packet(vlib_main_t *vm, vlib_packet_template_t *t, u32 *bi_result)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
ip4_enable_disable_interface_callback_t * enable_disable_interface_callbacks
Functions to call when interface becomes IPv4 enabled/disable.
vl_api_interface_index_t sw_if_index
#define VLIB_INIT_FUNCTION(x)
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type...
static ethernet_arp_ip4_entry_t * force_reuse_arp_entry(void)
static uword ethernet_address_cast(u8 *a)
pending_resolution_t * mac_changes
enum ip_neighbor_flags_t_ ip_neighbor_flags_t
static int vnet_arp_set_ip4_over_ethernet_internal(vnet_main_t *vnm, vnet_arp_set_ip4_over_ethernet_rpc_args_t *args)
static int ip4_arp_entry_sort(void *a1, void *a2)
enum adj_walk_rc_t_ adj_walk_rc_t
return codes from a adjacency walker callback function
void proxy_arp_walk(proxy_arp_walk_t cb, void *data)
enum arp_input_next_t_ arp_input_next_t
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
Aggregate type for a prefix.
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
#define clib_error_return(e, args...)
ethernet_arp_hardware_type_t
static u8 * format_ethernet_arp_input_trace(u8 *s, va_list *va)
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
#define foreach_ethernet_arp_opcode
uword * pending_resolutions_by_address
static void * pg_create_edit_group(pg_stream_t *s, int n_edit_bytes, int n_packet_bytes, u32 *group_index)
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
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_change_event_cb_t)(u32 pool_index, const mac_address_t *mac, u32 sw_if_index, const ip4_address_t *address)
static ethernet_arp_ip4_entry_t * arp_entry_find(ethernet_arp_interface_t *eai, const ip4_address_t *addr)
#define hash_create_string(elts, value_bytes)
static adj_walk_rc_t arp_mk_complete_walk(adj_index_t ai, void *ctx)
Per-interface ARP configuration and state.
static heap_elt_t * first(heap_header_t *h)
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)
format_function_t format_vnet_sw_interface_name
void adj_mcast_update_rewrite(adj_index_t adj_index, u8 *rewrite, u8 offset)
adj_mcast_update_rewrite
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static ethernet_header_t * ethernet_buffer_get_header(vlib_buffer_t *b)
static_always_inline void mac_address_from_bytes(mac_address_t *mac, const u8 *bytes)
#define foreach_ethernet_arp_error
int vnet_proxy_arp_enable_disable(vnet_main_t *vnm, u32 sw_if_index, u8 enable)
static void arp_mk_complete(adj_index_t ai, ethernet_arp_ip4_entry_t *e)
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
enum fib_source_t_ fib_source_t
The different sources that can create a route.
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
vlib_frame_t * data_callback(flow_report_main_t *frm, flow_report_t *fr, vlib_frame_t *f, u32 *to_next, u32 node_index)
#define ETHERNET_ARP_ARGS_FLUSH
ip4_address_t ip4_address
ethernet_arp_ip4_entry_t * ip4_neighbors_pool(void)
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.
#define pool_put(P, E)
Free an object E in pool P.
static void * vlib_process_signal_event_data(vlib_main_t *vm, uword node_index, uword type_opaque, uword n_data_elts, uword n_data_elt_bytes)
This packet matches an "interface route" and packets need to be passed to ARP to find rewrite string ...
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)
static_always_inline int mac_address_equal(const mac_address_t *a, const mac_address_t *b)
#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.
#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).
void fib_table_unlock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Take a reference counting lock on the table.
static clib_error_t * vnet_arp_delete_sw_interface(vnet_main_t *vnm, u32 sw_if_index, u32 is_add)
uword unformat_mac_address_t(unformat_input_t *input, va_list *args)
u32 fib_entry_get_resolving_interface(fib_node_index_t entry_index)
static clib_error_t * ip_arp_add_del_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u8 * format_ethernet_type(u8 *s, va_list *args)
fib_node_index_t ip4_fib_table_lookup(const ip4_fib_t *fib, const ip4_address_t *addr, u32 len)
static void arp_adj_fib_add(ethernet_arp_ip4_entry_t *e, u32 fib_index)
struct ip_adjacency_t_::@48::@49 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
ethernet_proxy_arp_t * proxy_arps
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
void send_ip4_garp(vlib_main_t *vm, u32 sw_if_index)
int fib_entry_is_sourced(fib_node_index_t fib_entry_index, fib_source_t source)
Adjacency to drop this packet.
#define VLIB_REGISTER_NODE(x,...)
static_always_inline uword vlib_get_thread_index(void)
static void arp_mk_incomplete(adj_index_t ai)
int ip4_address_compare(ip4_address_t *a1, ip4_address_t *a2)
static void arp_disable(ethernet_arp_main_t *am, u32 sw_if_index)
ip4_enable_disable_interface_function_t * function
#define vec_free(V)
Free vector's memory (no header).
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
ip4_add_del_interface_address_function_t * function
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 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.
Multicast Midchain Adjacency.
static int ethernet_mac_address_equal(const u8 *a, const u8 *b)
static char * ethernet_arp_error_strings[]
#define ETHERNET_ARP_ARGS_POPULATE
#define clib_warning(format, args...)
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
ethernet_arp_reply_error_t
unformat_function_t * unformat_edit
u8 * format_ip_neighbor_flags(u8 *s, va_list *args)
uword * mac_changes_by_address
uword wc_ip4_arp_publisher_et
void wc_arp_set_publisher_node(uword node_index, uword event_type)
static void arp_adj_fib_remove(ethernet_arp_ip4_entry_t *e, u32 fib_index)
u32 fib_node_index_t
A typedef of a node index.
u32 adj_index_t
An index for adjacencies.
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.
int vnet_add_del_ip4_arp_change_event(vnet_main_t *vnm, arp_change_event_cb_t data_callback, u32 pid, void *address_arg, uword node_index, uword type_opaque, uword data, int is_add)
void vnet_register_ip4_arp_resolution_event(vnet_main_t *vnm, void *address_arg, uword node_index, uword type_opaque, uword data)
static clib_error_t * ethernet_arp_sw_interface_up_down(vnet_main_t *vnm, u32 sw_if_index, u32 flags)
Invoked when the interface's admin state changes.
fib_entry_t * fib_entry_get(fib_node_index_t index)
int vnet_proxy_arp_add_del(ip4_address_t *lo_addr, ip4_address_t *hi_addr, u32 fib_index, int is_del)
enum fib_entry_flag_t_ fib_entry_flag_t
static u8 * format_ethernet_arp_opcode(u8 *s, va_list *va)
void send_ip4_garp_w_addr(vlib_main_t *vm, const ip4_address_t *ip4_addr, u32 sw_if_index)
walk_rc_t() proxy_arp_intf_walk_t(u32 sw_if_index, void *data)
call back function when walking the DB of proxy ARP interface
ip_neighbor_flags_t nbr_flags
void fib_table_lock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Release a reference counting lock on the table.
u32 unnumbered_sw_if_index
u32 proxy_enabled
Is Proxy ARP enabled on this interface.
#define VLIB_CLI_COMMAND(x,...)
This packets follow a mid-chain adjacency.
clib_error_t * arp_term_init(vlib_main_t *vm)
vlib_packet_template_t ip4_arp_request_packet_template
Template used to generate IP4 ARP packets.
#define hash_create(elts, value_bytes)
#define ETHERNET_ARP_ARGS_REMOVE
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static int vnet_arp_wc_publish(u32 sw_if_index, const ethernet_arp_ip4_over_ethernet_address_t *a)
publish wildcard arp event
u32 arp_term_next_node_index[32]
#define vec_delete(V, N, M)
Delete N elements starting at element M.
VNET_FEATURE_ARC_INIT(arp_feat, static)
walk_rc_t() proxy_arp_walk_t(const ip4_address_t *lo_addr, const ip4_address_t *hi_addr, u32 fib_index, void *dat)
call back function when walking the DB of proxy ARPs
The default route source.
void proxy_arp_intfc_walk(proxy_arp_intf_walk_t cb, void *data)
static void pg_free_edit_group(pg_stream_t *s)
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)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
VNET_FEATURE_INIT(arp_reply_feat_node, static)
#define clib_mem_unaligned(pointer, type)
static char * arp_disabled_error_strings[]
void fib_table_entry_path_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_route_path_flags_t path_flags)
remove one path to an entry (aka route) in the FIB.
static void arp_nbr_probe(ip_adjacency_t *adj)
#define VNET_FEATURES(...)
void ethernet_register_input_type(vlib_main_t *vm, ethernet_type_t type, u32 node_index)
static vlib_main_t * vlib_get_main(void)
static vlib_node_registration_t arp_term_l2bd_node
(constructor) VLIB_REGISTER_NODE (arp_term_l2bd_node)
uword * arp_entries
Hash table of ARP entries.
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
ip4_table_bind_callback_t * table_bind_callbacks
Functions to call when interface to table biding changes.
static u32 arp_learn(vnet_main_t *vnm, ethernet_arp_main_t *am, u32 sw_if_index, const ethernet_arp_ip4_over_ethernet_address_t *addr)
fib_entry_flag_t fib_entry_get_flags_for_source(fib_node_index_t fib_entry_index, fib_source_t source)
This packets needs to go to ICMP error.
This packet is for one of our own IP addresses.
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 FIB_NODE_INDEX_INVALID
int vnet_proxy_arp_fib_reset(u32 fib_id)
fib_node_index_t fib_entry_index
The index of the adj-fib entry created.
#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.
#define hash_foreach_pair(p, v, body)
Iterate over hash pairs.
VLIB buffer representation.
format_function_t format_vlib_time
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
#define ETHERNET_ARP_ARGS_WC_PUB
static u8 * format_arp_term_input_trace(u8 *s, va_list *va)
static int vnet_arp_flush_ip4_over_ethernet_internal(vnet_main_t *vnm, vnet_arp_set_ip4_over_ethernet_rpc_args_t *args)
vnet_sw_interface_t * sw_interfaces
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static u8 * format_ethernet_arp_hardware_type(u8 *s, va_list *va)
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' ...
l2_bridge_domain_t * bd_configs
static void arp_entry_free(ethernet_arp_interface_t *eai, ethernet_arp_ip4_entry_t *e)
static uword arp_proxy(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static void vnet_arp_wc_publish_internal(vnet_main_t *vnm, vnet_arp_set_ip4_over_ethernet_rpc_args_t *args)
struct clib_bihash_value offset
template key/value backing page structure
static uword ip6_address_is_unspecified(const ip6_address_t *a)
enum arp_disabled_next_t_ arp_disabled_next_t
ip4_main_t ip4_main
Global ip4 main structure.
u8 * format_mac_address_t(u8 *s, va_list *args)
#define vec_foreach(var, vec)
Vector iterator.
arp_change_event_cb_t data_callback
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)
ethernet_arp_ip4_entry_t * ip4_neighbor_entries(u32 sw_if_index)
uword wc_ip4_arp_publisher_node
VNET_SW_INTERFACE_ADD_DEL_FUNCTION(vnet_arp_delete_sw_interface)
#define VLIB_NODE_FLAG_TRACE
static uword unformat_ethernet_arp_opcode_net_byte_order(unformat_input_t *input, va_list *args)
void adj_nbr_update_rewrite(adj_index_t adj_index, adj_nbr_rewrite_flag_t flags, u8 *rewrite)
adj_nbr_update_rewrite
void ethernet_arp_change_mac(u32 sw_if_index)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
ethernet_arp_ip4_entry_t * ip4_entry_pool
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
const u8 * ethernet_ip4_mcast_dst_addr(void)
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)
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 adj_walk_rc_t arp_mk_incomplete_walk(adj_index_t ai, void *ctx)
static_always_inline void vnet_feature_arc_start(u8 arc, u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
static ip4_address_t * ip4_interface_address_matching_destination(ip4_main_t *im, ip4_address_t *dst, u32 sw_if_index, ip_interface_address_t **result_ia)
static uword pool_elts(void *v)
Number of active elements in a pool.