101 ethernet_arp_ip4_over_ethernet_address_t
a;
105 #define ETHERNET_ARP_ARGS_REMOVE (1<<0) 106 #define ETHERNET_ARP_ARGS_FLUSH (1<<1) 107 #define ETHERNET_ARP_ARGS_POPULATE (1<<2) 121 #define _(n,f) case n: t = #f; break; 126 return format (s,
"unknown 0x%x", h);
129 return format (s,
"%s", t);
139 #define _(f) case ETHERNET_ARP_OPCODE_##f: t = #f; break; 144 return format (s,
"unknown 0x%x", o);
147 return format (s,
"%s", t);
154 int *result = va_arg (*args,
int *);
182 int *result = va_arg (*args,
int *);
187 *result = clib_host_to_net_u16 ((
u16) * result);
195 u32 max_header_bytes = va_arg (*va,
u32);
197 u16 l2_type, l3_type;
199 if (max_header_bytes != 0 &&
sizeof (a[0]) > max_header_bytes)
200 return format (s,
"ARP header truncated");
202 l2_type = clib_net_to_host_u16 (a->
l2_type);
203 l3_type = clib_net_to_host_u16 (a->
l3_type);
207 s =
format (s,
"%U, type %U/%U, address size %d/%d",
213 if (l2_type == ETHERNET_ARP_HARDWARE_TYPE_ethernet
214 && l3_type == ETHERNET_TYPE_IP4)
216 s =
format (s,
"\n%U%U/%U -> %U/%U",
227 s =
format (s,
"\n%U%U/%U -> %U/%U",
247 return format (s,
"%=12s%=16s%=6s%=20s%=24s",
"Time",
"IP4",
248 "Flags",
"Ethernet",
"Interface");
253 flags =
format (flags,
"S");
256 flags =
format (flags,
"D");
259 flags =
format (flags,
"N");
261 s =
format (s,
"%=12U%=16U%=6s%=20U%=24U",
264 flags ? (
char *) flags :
"",
390 adj->rewrite_header.sw_if_index,
499 adj->rewrite_header.dst_mcast_offset = 11;
500 adj->rewrite_header.dst_mcast_n_bytes = 3;
524 ethernet_arp_ip4_over_ethernet_address_t *
a = &args->
a;
526 int make_new_arp_cache_entry = 1;
548 make_new_arp_cache_entry = 0;
552 if (make_new_arp_cache_entry)
568 if (!is_no_fib_entry)
573 .fp_addr.ip4 = a->ip4,
618 while (next_index != (
u32) ~ 0)
637 while (next_index != (
u32) ~ 0)
646 rv = (*fp) (mc->
data, a->ethernet, sw_if_index, 0);
705 void (*fp) (
u32,
u8 *) = data_callback;
737 return VNET_API_ERROR_NO_SUCH_ENTRY;
741 while (index != (
u32) ~ 0)
749 (*fp) (mc->
data, 0 );
771 return VNET_API_ERROR_NO_SUCH_ENTRY;
783 #define foreach_ethernet_arp_error \ 784 _ (replies_sent, "ARP replies sent") \ 785 _ (l2_type_not_ethernet, "L2 type not ethernet") \ 786 _ (l3_type_not_ip4, "L3 type not IP4") \ 787 _ (l3_src_address_not_local, "IP4 source address not local to subnet") \ 788 _ (l3_dst_address_not_local, "IP4 destination address not local to subnet") \ 789 _ (l3_src_address_is_local, "IP4 source address matches local interface") \ 790 _ (l3_src_address_learned, "ARP request IP4 source address learned") \ 791 _ (replies_received, "ARP replies received") \ 792 _ (opcode_not_request, "ARP opcode not request") \ 793 _ (proxy_arp_replies_sent, "Proxy ARP replies sent") \ 794 _ (l2_address_mismatch, "ARP hw addr does not match L2 frame src addr") \ 795 _ (missing_interface_address, "ARP missing interface address") \ 796 _ (gratuitous_arp, "ARP probe or announcement dropped") \ 797 _ (interface_no_table, "Interface is not mapped to an IP table") \ 798 _ (interface_not_ip_enabled, "Interface is not IP enabled") \ 802 #define _(sym,string) ETHERNET_ARP_ERROR_##sym, 815 ethernet_arp_ip4_over_ethernet_address_t delme;
849 u32 unnum_src_sw_if_index;
850 u32 *broadcast_swifs = 0;
855 u8 dst_mac_address[6];
863 unnum_src_sw_if_index = sw_if_index;
869 if (si->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED &&
870 (si->unnumbered_sw_if_index == unnum_src_sw_if_index))
872 vec_add1 (broadcast_swifs, si->sw_if_index);
879 if (0 ==
vec_len (broadcast_swifs))
883 if (
vec_len (broadcast_swifs) > 1)
887 _vec_len (buffers) = n_alloc;
888 for (
i = 0;
i < n_alloc;
i++)
894 p0->current_length + p0->current_data);
895 b0->current_data = p0->current_data;
896 b0->current_length = p0->current_length;
917 clib_memcpy (arp0->ip4_over_ethernet[0].ethernet,
hi->hw_address, 6);
921 if (si->sub.eth.flags.one_tag)
923 else if (si->sub.eth.flags.two_tags)
929 if (si->sub.eth.flags.one_tag)
933 eth0->
type = si->sub.eth.flags.dot1ad ?
934 clib_host_to_net_u16 (ETHERNET_TYPE_DOT1AD) :
935 clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
937 clib_host_to_net_u16 (si->sub.eth.outer_vlan_id);
938 outer->
type = clib_host_to_net_u16 (ETHERNET_TYPE_ARP);
941 else if (si->sub.eth.flags.two_tags)
946 eth0->
type = si->sub.eth.flags.dot1ad ?
947 clib_host_to_net_u16 (ETHERNET_TYPE_DOT1AD) :
948 clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
950 clib_host_to_net_u16 (si->sub.eth.outer_vlan_id);
951 outer->
type = clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
953 clib_host_to_net_u16 (si->sub.eth.inner_vlan_id);
954 inner->
type = clib_host_to_net_u16 (ETHERNET_TYPE_ARP);
959 eth0->type = clib_host_to_net_u16 (ETHERNET_TYPE_ARP);
964 sizeof (eth0->dst_address));
966 sizeof (eth0->src_address));
974 to_next[0] = buffers[
i];
995 u32 n_left_from, next_index, *from, *to_next;
996 u32 n_replies_sent = 0, n_proxy_arp_replies_sent = 0;
1007 while (n_left_from > 0)
1013 while (n_left_from > 0 && n_left_to_next > 0)
1020 u32 pi0, error0, next0, sw_if_index0, conn_sw_if_index0, fib_index0;
1021 u8 is_request0, dst_is_local0, is_unnum0;
1032 n_left_to_next -= 1;
1038 is_request0 = arp0->
opcode 1039 == clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_request);
1041 error0 = ETHERNET_ARP_ERROR_replies_sent;
1045 clib_net_to_host_u16 (ETHERNET_ARP_HARDWARE_TYPE_ethernet) ?
1046 ETHERNET_ARP_ERROR_l2_type_not_ethernet : error0);
1049 clib_net_to_host_u16 (ETHERNET_TYPE_IP4) ?
1050 ETHERNET_ARP_ERROR_l3_type_not_ip4 : error0);
1057 ETHERNET_ARP_ERROR_interface_not_ip_enabled : error0);
1064 if (~0 == fib_index0)
1066 error0 = ETHERNET_ARP_ERROR_interface_no_table;
1084 error0 = ETHERNET_ARP_ERROR_l3_dst_address_not_local;
1089 is_unnum0 = sw_if_index0 != conn_sw_if_index0;
1100 error0 = ETHERNET_ARP_ERROR_l3_src_address_not_local;
1116 error0 = ETHERNET_ARP_ERROR_l3_src_address_is_local;
1132 error0 = ETHERNET_ARP_ERROR_l2_address_mismatch;
1148 error0 = ETHERNET_ARP_ERROR_l3_src_address_learned;
1152 if (!(is_request0 && dst_is_local0))
1156 clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply) ?
1157 ETHERNET_ARP_ERROR_replies_received : error0);
1170 arp0->
opcode = clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply);
1235 -adj0->rewrite_header.data_bytes);
1239 error0 = ETHERNET_ARP_ERROR_missing_interface_address;
1246 n_left_to_next, pi0, next0);
1248 n_replies_sent += 1;
1256 error0 = ETHERNET_ARP_ERROR_gratuitous_arp;
1263 u32 this_addr = clib_net_to_host_u32
1277 u32 lo_addr = clib_net_to_host_u32 (pa->
lo_addr);
1278 u32 hi_addr = clib_net_to_host_u32 (pa->
hi_addr);
1281 if ((this_addr >= lo_addr && this_addr <= hi_addr) &&
1292 if_addr0 = &proxy_src;
1294 i32 ethernet_start =
1295 vnet_buffer (p0)->ethernet.start_of_ethernet_header;
1298 n_proxy_arp_replies_sent++;
1310 n_left_to_next, pi0, next0);
1317 ETHERNET_ARP_ERROR_replies_sent,
1318 n_replies_sent - n_proxy_arp_replies_sent);
1321 ETHERNET_ARP_ERROR_proxy_arp_replies_sent,
1322 n_proxy_arp_replies_sent);
1327 #define _(sym,string) string, 1336 .name =
"arp-input",
1337 .vector_size =
sizeof (
u32),
1339 .error_strings = ethernet_arp_error_strings,
1373 if (sw_if_index != ~0 && n->sw_if_index != sw_if_index)
1375 vec_add1 (ns, n[0]);
1441 .path =
"show ip arp",
1443 .short_help =
"show ip arp",
1456 } ip4_over_ethernet[2];
1463 #define _(f) pg_edit_init (&p->f, ethernet_arp_header_t, f); 1466 _(n_l2_address_bytes);
1467 _(n_l3_address_bytes);
1469 _(ip4_over_ethernet[0].ethernet);
1470 _(ip4_over_ethernet[0].ip4);
1471 _(ip4_over_ethernet[1].ethernet);
1472 _(ip4_over_ethernet[1].ip4);
1493 if (!
unformat (input,
"%U: %U/%U -> %U/%U",
1526 u32 sw_if_index,
void *a_arg)
1528 ethernet_arp_ip4_over_ethernet_address_t *
a = a_arg;
1536 (
u8 *) & args,
sizeof (args));
1548 u32 sw_if_index,
void *a_arg)
1550 ethernet_arp_ip4_over_ethernet_address_t *
a = a_arg;
1558 (
u8 *) & args,
sizeof (args));
1571 u32 sw_if_index,
void *a_arg)
1573 ethernet_arp_ip4_over_ethernet_address_t *
a = a_arg;
1581 (
u8 *) & args,
sizeof (args));
1596 u32 if_address_index,
u32 is_del)
1611 u32 i, *to_delete = 0;
1619 e = pool_elt_at_index(am->ip4_entry_pool,
1621 if (ip4_destination_matches_route (im, &e->ip4_address,
1622 address, address_length))
1624 vec_add1 (to_delete, e - am->ip4_entry_pool);
1631 ethernet_arp_ip4_over_ethernet_address_t delme;
1662 #define _(o) hash_set_mem (am->opcode_by_name, #o, ETHERNET_ARP_OPCODE_##o); 1678 vnet_pcap_drop_trace_filter_add_del \ 1679 (rt->errors[ETHERNET_ARP_ERROR_##a], \ 1687 cb.function_opaque = 0;
1811 u32 i, *to_delete = 0;
1816 if (e->sw_if_index == sw_if_index)
1817 vec_add1 (to_delete,
1818 e - am->ip4_entry_pool);
1822 for (i = 0; i <
vec_len (to_delete); i++)
1824 ethernet_arp_ip4_over_ethernet_address_t delme;
1853 for (i = 3; i >= 0; i--)
1855 old = a->ip4.as_u8[
i];
1856 a->ip4.as_u8[
i] += 1;
1857 if (old < a->ip4.as_u8[i])
1861 for (i = 5; i >= 0; i--)
1863 old = a->ethernet[
i];
1864 a->ethernet[
i] += 1;
1865 if (old < a->ethernet[i])
1872 u32 sw_if_index,
void *a_arg,
1873 int is_static,
int is_no_fib_entry)
1875 ethernet_arp_ip4_over_ethernet_address_t *
a = a_arg;
1885 (
u8 *) & args,
sizeof (args));
1895 u32 found_at_index = ~0;
1907 if (found_at_index != ~0)
1916 return VNET_API_ERROR_NO_SUCH_ENTRY;
1936 u32 *entries_to_delete = 0;
1943 return VNET_API_ERROR_NO_SUCH_ENTRY;
1954 for (i = 0; i <
vec_len (entries_to_delete); i++)
1970 ethernet_arp_ip4_over_ethernet_address_t lo_addr, hi_addr,
addr;
1977 int is_no_fib_entry = 0;
1992 else if (
unformat (input,
"static"))
1995 else if (
unformat (input,
"no-fib-entry"))
1996 is_no_fib_entry = 1;
1998 else if (
unformat (input,
"count %d", &count))
2001 else if (
unformat (input,
"fib-id %d", &fib_id))
2010 else if (
unformat (input,
"proxy %U - %U",
2029 for (i = 0; i < count; i++)
2033 uword event_type, *event_data = 0;
2041 (vnm, sw_if_index, &addr, is_static, is_no_fib_entry);
2046 if (event_type != 1)
2094 .path =
"set ip arp",
2096 "set ip arp [del] <intfc> <ip-address> <mac-address> [static] [no-fib-entry] [count <count>] [fib-id <fib-id>] [proxy <lo-addr> - <hi-addr>]",
2160 .path =
"set interface proxy-arp",
2162 "set interface proxy-arp <intfc> [enable|disable]",
2186 u32 n_left_from, next_index, *from, *to_next;
2187 u32 n_replies_sent = 0;
2188 u16 last_bd_index = ~0;
2196 while (n_left_from > 0)
2202 while (n_left_from > 0 && n_left_to_next > 0)
2209 u32 pi0, error0, next0, sw_if_index0;
2220 n_left_to_next -= 1;
2225 goto next_l2_feature;
2229 ethertype0 = clib_net_to_host_u16 (*(
u16 *) (l3h0 - 2));
2234 clib_host_to_net_u16
2235 (ETHERNET_ARP_OPCODE_request))))
2247 error0 = ETHERNET_ARP_ERROR_replies_sent;
2250 clib_net_to_host_u16 (ETHERNET_ARP_HARDWARE_TYPE_ethernet)
2251 ? ETHERNET_ARP_ERROR_l2_type_not_ethernet : error0);
2254 clib_net_to_host_u16 (ETHERNET_TYPE_IP4) ?
2255 ETHERNET_ARP_ERROR_l3_type_not_ip4 : error0);
2269 error0 = ETHERNET_ARP_ERROR_l2_address_mismatch;
2280 u32 next_index = p[0];
2281 while (next_index != (
u32) ~ 0)
2289 rv = (*fp) (mc->
data,
2306 || (last_bd_index == (
u16) ~ 0)))
2308 last_bd_index = bd_index0;
2314 goto next_l2_feature;
2318 arp0->
opcode = clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply);
2324 n_replies_sent += 1;
2332 vnet_buffer (p0)->l2.feature_bitmap |= L2INPUT_FEAT_FWD;
2334 goto next_l2_feature;
2341 to_next, n_left_to_next, pi0,
2350 iph0->
protocol == IP_PROTOCOL_ICMP6 &&
2356 (vm, node, p0, eth0, iph0, sw_if_index0,
2358 goto output_response;
2363 u32 feature_bitmap0 =
2364 vnet_buffer (p0)->l2.feature_bitmap & ~L2INPUT_FEAT_ARP_TERM;
2365 vnet_buffer (p0)->l2.feature_bitmap = feature_bitmap0;
2370 to_next, n_left_to_next,
2380 error0 = ETHERNET_ARP_ERROR_gratuitous_arp;
2386 to_next, n_left_to_next, pi0,
2394 ETHERNET_ARP_ERROR_replies_sent, n_replies_sent);
2401 .name =
"arp-term-l2bd",
2402 .vector_size =
sizeof (
u32),
2423 arp_term_next_node_index);
2448 change_arp_mac (sw_if_index, e);
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
This packets follow a load-balance.
fib_node_index_t fib_table_entry_update_one_path(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, fib_protocol_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, mpls_label_t *next_hop_labels, fib_route_path_flags_t path_flags)
Update the entry to have just one path.
#define vnet_rewrite_one_header(rw0, p0, most_likely_size)
static void set_ip4_over_ethernet_rpc_callback(vnet_arp_set_ip4_over_ethernet_rpc_args_t *a)
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
#define pool_next_index(P, I)
Return next occupied pool index after i, useful for safe iteration.
#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
sll srl srl sll sra u16x4 i
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)
An indication that the rewrite is incomplete, i.e.
static uword * vlib_process_wait_for_event(vlib_main_t *vm)
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)
struct ip_adjacency_t_::@138::@139 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
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
void fib_entry_get_prefix(fib_node_index_t fib_entry_index, fib_prefix_t *pfx)
static void vlib_error_count(vlib_main_t *vm, uword node_index, uword counter, uword increment)
vnet_link_t adj_get_link_type(adj_index_t ai)
Return the link type of the adjacency.
struct ethernet_arp_interface_t_ ethernet_arp_interface_t
Per-interface ARP configuration and state.
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.
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)
#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)
static u64 clib_cpu_time_now(void)
void arp_update_adjacency(vnet_main_t *vnm, u32 sw_if_index, u32 ai)
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.
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 vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
u32 * fib_index_by_sw_if_index
Table index indexed by software interface.
union ip_adjacency_t_::@138 sub_type
format_function_t format_vlib_cpu_time
unformat_function_t unformat_vnet_sw_interface
u64 cpu_time_last_updated
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
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).
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
Adjacency to drop this packet.
static pg_node_t * pg_get_node(uword node_index)
static int vnet_arp_populate_ip4_over_ethernet_internal(vnet_main_t *vnm, vnet_arp_set_ip4_over_ethernet_rpc_args_t *args)
VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION(ethernet_arp_sw_interface_up_down)
void adj_mcast_update_rewrite(adj_index_t adj_index, u8 *rewrite)
adj_mcast_update_rewrite
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.
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
u8 * format_ethernet_address(u8 *s, va_list *args)
#define VNET_SW_INTERFACE_FLAG_PROXY_ARP
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.
#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...
This packets needs to go to ICMP error.
static uword ethernet_address_cast(u8 *a)
pending_resolution_t * mac_changes
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
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
Aggregrate type for a prefix.
Adjacency to punt this packet.
#define clib_error_return(e, args...)
ethernet_arp_hardware_type_t
static u8 * format_ethernet_arp_input_trace(u8 *s, va_list *va)
static int vnet_arp_flush_ip4_over_ethernet(vnet_main_t *vnm, u32 sw_if_index, void *a_arg)
Internally generated event to flush the ARP cache on an interface state change event.
#define foreach_ethernet_arp_opcode
uword * pending_resolutions_by_address
This packet is for one of our own IP addresses.
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.
#define vlib_call_init_function(vm, x)
static ethernet_arp_ip4_entry_t * arp_entry_find(ethernet_arp_interface_t *eai, const ip4_address_t *addr)
This packet matches an "interface route" and packets need to be passed to ARP to find rewrite string ...
int vnet_arp_unset_ip4_over_ethernet(vnet_main_t *vnm, u32 sw_if_index, void *a_arg)
Control Plane hook to remove an ARP entry.
static vlib_cli_command_t ip_arp_add_del_command
(constructor) VLIB_CLI_COMMAND (ip_arp_add_del_command)
#define hash_create_string(elts, value_bytes)
adj_index_t fib_entry_get_adj(fib_node_index_t fib_entry_index)
static adj_walk_rc_t arp_mk_complete_walk(adj_index_t ai, void *ctx)
Per-interface ARP configuration and state.
format_function_t format_vnet_sw_interface_name
#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.
#define vec_insert(V, N, M)
Insert N vector elements starting at element M, initialize new elements to zero (no header...
static ethernet_header_t * ethernet_buffer_get_header(vlib_buffer_t *b)
uword * fib_index_by_table_id
Hash table mapping table id to fib index.
#define foreach_ethernet_arp_error
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)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
#define ETHERNET_ARP_ARGS_FLUSH
ip4_address_t ip4_address
uword os_get_cpu_number(void)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
u8 * ip_enabled_by_sw_if_index
#define pool_put(P, E)
Free an object E in pool P.
static vlib_cli_command_t show_ip4_arp_command
(constructor) VLIB_CLI_COMMAND (show_ip4_arp_command)
static int arp_unnumbered(vlib_buffer_t *p0, u32 pi0, ethernet_header_t *eth0, u32 sw_if_index)
static void unset_random_arp_entry(void)
ethernet_arp_interface_t * ethernet_arp_by_sw_if_index
Per interface state.
int vnet_arp_set_ip4_over_ethernet_internal(vnet_main_t *vnm, vnet_arp_set_ip4_over_ethernet_rpc_args_t *args)
u32 node_index
Node index.
static clib_error_t * ethernet_arp_init(vlib_main_t *vm)
static u32 feat_bitmap_get_next_node_index(u32 *next_nodes, u32 bitmap)
Return the graph node index for the feature corresponding to the first set bit in the bitmap...
#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).
vlib_error_t error
Error code for buffers to be enqueued to error handler.
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)
The IPv4 FIB.
ethernet_proxy_arp_t * proxy_arps
static void arp_mk_incomplete(adj_index_t ai)
int ip4_address_compare(ip4_address_t *a1, ip4_address_t *a2)
void fib_table_entry_delete_index(fib_node_index_t fib_entry_index, fib_source_t source)
Delete a FIB entry.
#define vec_free(V)
Free vector's memory (no header).
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.
static char * ethernet_arp_error_strings[]
#define ETHERNET_ARP_ARGS_POPULATE
#define clib_warning(format, args...)
#define VLIB_BUFFER_IS_TRACED
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
#define clib_memcpy(a, b, c)
unformat_function_t * unformat_edit
uword * mac_changes_by_address
u32 fib_node_index_t
A typedef of a node index.
u32 adj_index_t
An index for adjacencies.
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
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.
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)
#define VLIB_CLI_COMMAND(x,...)
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.
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
u32 arp_term_next_node_index[32]
adj_index_t fib_entry_get_adj_for_source(fib_node_index_t fib_entry_index, fib_source_t source)
#define vec_delete(V, N, M)
Delete N elements starting at element M.
This packets follow a mid-chain adjacency.
static void pg_free_edit_group(pg_stream_t *s)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
#define VLIB_NODE_FLAG_TRACE
ethernet_arp_entry_flags_t flags
Route added as a result of interface configuration.
static void arp_nbr_probe(ip_adjacency_t *adj)
ethernet_arp_ip4_over_ethernet_address_t a
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)
#define vec_elt(v, i)
Get vector value at index i.
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)
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
#define hash_foreach_pair(p, v, body)
Iterate over hash pairs.
static vlib_cli_command_t set_int_proxy_enable_command
(constructor) VLIB_CLI_COMMAND (set_int_proxy_enable_command)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
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 clib_error_t * ethernet_init(vlib_main_t *vm)
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)
#define clib_mem_unaligned(pointer, type)
ethernet_arp_input_error_t
#define VLIB_REGISTER_NODE(x,...)
ip4_main_t ip4_main
Global ip4 main structure.
This packet is to be rewritten and forwarded to the next processing node.
#define vec_foreach(var, vec)
Vector iterator.
static uword ip6_address_is_unspecified(ip6_address_t *a)
u16 flags
Copy of main node flags.
ethernet_arp_ip4_entry_t * ip4_neighbor_entries(u32 sw_if_index)
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
int vnet_arp_set_ip4_over_ethernet(vnet_main_t *vnm, u32 sw_if_index, void *a_arg, int is_static, int is_no_fib_entry)
static int vnet_arp_populate_ip4_over_ethernet(vnet_main_t *vnm, u32 sw_if_index, void *a_arg)
Internally generated event to populate the ARP cache on an interface state change event...
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
static uword unformat_ethernet_arp_opcode_net_byte_order(unformat_input_t *input, va_list *args)
#define ETHERNET_ADDRESS_UNICAST
static u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
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
int vnet_add_del_ip4_arp_change_event(vnet_main_t *vnm, void *data_callback, u32 pid, void *address_arg, uword node_index, uword type_opaque, uword data, int is_add)
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)
fib_entry_flag_t fib_entry_get_flags(fib_node_index_t fib_entry_index)
static adj_walk_rc_t arp_mk_incomplete_walk(adj_index_t ai, void *ctx)
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.