45 u8 ethernet_address[6];
48 #define ETHERNET_ARP_IP4_ENTRY_FLAG_STATIC (1 << 0) 49 #define ETHERNET_ARP_IP4_ENTRY_FLAG_GLEAN (2 << 0) 108 #define _(n,f) case n: t = #f; break; 113 return format (s,
"unknown 0x%x", h);
116 return format (s,
"%s", t);
126 #define _(f) case ETHERNET_ARP_OPCODE_##f: t = #f; break; 131 return format (s,
"unknown 0x%x", o);
134 return format (s,
"%s", t);
141 int *result = va_arg (*args,
int *);
169 int *result = va_arg (*args,
int *);
174 *result = clib_host_to_net_u16 ((
u16) * result);
182 u32 max_header_bytes = va_arg (*va,
u32);
184 u16 l2_type, l3_type;
186 if (max_header_bytes != 0 &&
sizeof (a[0]) > max_header_bytes)
187 return format (s,
"ARP header truncated");
189 l2_type = clib_net_to_host_u16 (a->
l2_type);
190 l3_type = clib_net_to_host_u16 (a->
l3_type);
194 s =
format (s,
"%U, type %U/%U, address size %d/%d",
200 if (l2_type == ETHERNET_ARP_HARDWARE_TYPE_ethernet
201 && l3_type == ETHERNET_TYPE_IP4)
203 s =
format (s,
"\n%U%U/%U -> %U/%U",
214 s =
format (s,
"\n%U%U/%U -> %U/%U",
235 return format (s,
"%=12s%=6s%=16s%=6s%=20s%=24s",
"Time",
"FIB",
"IP4",
236 "Flags",
"Ethernet",
"Interface");
243 flags =
format (flags,
"G");
246 flags =
format (flags,
"S");
248 s =
format (s,
"%=12U%=6u%=16U%=6s%=20U%=24U",
252 flags ? (
char *) flags :
"",
290 if (e->key.sw_if_index == sw_if_index)
291 vec_add1 (to_add_del, e - am->ip4_entry_pool);
295 for (i = 0; i <
vec_len (to_add_del); i++)
297 ethernet_arp_ip4_over_ethernet_address_t arp_add;
329 void *a_arg,
int is_static);
334 u32 fib_index,
void *a_arg);
340 ethernet_arp_ip4_over_ethernet_address_t
a;
365 u32 fib_index,
void *a_arg,
int is_static)
367 ethernet_arp_ip4_over_ethernet_address_t *a = a_arg;
377 (
u8 *) & args,
sizeof (args));
385 void *a_arg,
int is_static)
390 ethernet_arp_ip4_over_ethernet_address_t *a = a_arg;
394 int make_new_arp_cache_entry = 1;
403 fib_index = (fib_index != (
u32) ~ 0)
418 make_new_arp_cache_entry = 0;
422 memset (&adj, 0,
sizeof (adj));
428 sizeof (adj.rewrite_data));
435 existing_adj->
arp.next_hop.ip4.as_u32 == a->ip4.as_u32)
444 for (i = 0; i < uadj->
n_adj; i++)
446 uadj[i].arp.
next_hop.ip4.as_u32 == a->ip4.as_u32)
474 if (make_new_arp_cache_entry)
495 while (next_index != (
u32) ~ 0)
513 while (next_index != (
u32) ~ 0)
522 rv = (*fp) (mc->
data, a->ethernet, sw_if_index, 0);
581 void (*fp) (
u32,
u8 *) = data_callback;
613 return VNET_API_ERROR_NO_SUCH_ENTRY;
617 while (index != (
u32) ~ 0)
625 (*fp) (mc->
data, 0 );
647 return VNET_API_ERROR_NO_SUCH_ENTRY;
659 #define foreach_ethernet_arp_error \ 660 _ (replies_sent, "ARP replies sent") \ 661 _ (l2_type_not_ethernet, "L2 type not ethernet") \ 662 _ (l3_type_not_ip4, "L3 type not IP4") \ 663 _ (l3_src_address_not_local, "IP4 source address not local to subnet") \ 664 _ (l3_dst_address_not_local, "IP4 destination address not local to subnet") \ 665 _ (l3_src_address_is_local, "IP4 source address matches local interface") \ 666 _ (l3_src_address_learned, "ARP request IP4 source address learned") \ 667 _ (replies_received, "ARP replies received") \ 668 _ (opcode_not_request, "ARP opcode not request") \ 669 _ (proxy_arp_replies_sent, "Proxy ARP replies sent") \ 670 _ (l2_address_mismatch, "ARP hw addr does not match L2 frame src addr") \ 671 _ (missing_interface_address, "ARP missing interface address") \ 672 _ (gratuitous_arp, "ARP probe or announcement dropped") \ 676 #define _(sym,string) ETHERNET_ARP_ERROR_##sym, 702 *result_ia = result ? ia : 0;
712 ethernet_arp_ip4_over_ethernet_address_t delme;
748 u32 unnum_src_sw_if_index;
749 u32 *broadcast_swifs = 0;
754 u8 dst_mac_address[6];
768 if (si->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED &&
769 (si->unnumbered_sw_if_index == unnum_src_sw_if_index))
771 vec_add1 (broadcast_swifs, si->sw_if_index);
779 if (
vec_len (broadcast_swifs) > 1)
783 _vec_len (buffers) = n_alloc;
784 for (
i = 0;
i < n_alloc;
i++)
790 p0->current_length + p0->current_data);
791 b0->current_data = p0->current_data;
792 b0->current_length = p0->current_length;
813 clib_memcpy (arp0->ip4_over_ethernet[0].ethernet,
hi->hw_address, 6);
817 if (si->sub.eth.flags.one_tag)
819 else if (si->sub.eth.flags.two_tags)
825 if (si->sub.eth.flags.one_tag)
829 eth0->
type = si->sub.eth.flags.dot1ad ?
830 clib_host_to_net_u16 (ETHERNET_TYPE_DOT1AD) :
831 clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
833 clib_host_to_net_u16 (si->sub.eth.outer_vlan_id);
834 outer->
type = clib_host_to_net_u16 (ETHERNET_TYPE_ARP);
837 else if (si->sub.eth.flags.two_tags)
842 eth0->
type = si->sub.eth.flags.dot1ad ?
843 clib_host_to_net_u16 (ETHERNET_TYPE_DOT1AD) :
844 clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
846 clib_host_to_net_u16 (si->sub.eth.outer_vlan_id);
847 outer->
type = clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
849 clib_host_to_net_u16 (si->sub.eth.inner_vlan_id);
850 inner->
type = clib_host_to_net_u16 (ETHERNET_TYPE_ARP);
855 eth0->type = clib_host_to_net_u16 (ETHERNET_TYPE_ARP);
860 sizeof (eth0->dst_address));
862 sizeof (eth0->src_address));
870 to_next[0] = buffers[
i];
889 u32 n_left_from, next_index, *from, *to_next;
890 u32 n_replies_sent = 0, n_proxy_arp_replies_sent = 0;
901 while (n_left_from > 0)
907 while (n_left_from > 0 && n_left_to_next > 0)
917 u32 pi0, error0, next0, sw_if_index0;
918 u8 is_request0, src_is_local0, dst_is_local0, is_unnum0;
931 is_request0 = arp0->
opcode 932 == clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_request);
934 error0 = ETHERNET_ARP_ERROR_replies_sent;
938 clib_net_to_host_u16 (ETHERNET_ARP_HARDWARE_TYPE_ethernet) ?
939 ETHERNET_ARP_ERROR_l2_type_not_ethernet : error0);
942 clib_net_to_host_u16 (ETHERNET_TYPE_IP4) ?
943 ETHERNET_ARP_ERROR_l3_type_not_ip4 : error0);
954 ip4_over_ethernet[1].
959 error0 = ETHERNET_ARP_ERROR_l3_dst_address_not_local;
970 error0 = ETHERNET_ARP_ERROR_l3_src_address_not_local;
979 error0 = ETHERNET_ARP_ERROR_l3_src_address_is_local;
994 error0 = ETHERNET_ARP_ERROR_l2_address_mismatch;
1011 error0 = ETHERNET_ARP_ERROR_l3_src_address_learned;
1015 if (!(is_request0 && dst_is_local0))
1019 clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply) ?
1020 ETHERNET_ARP_ERROR_replies_received : error0);
1033 arp0->
opcode = clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply);
1055 error0 = ETHERNET_ARP_ERROR_missing_interface_address;
1065 n_left_to_next, pi0, next0);
1067 n_replies_sent += 1;
1075 error0 = ETHERNET_ARP_ERROR_gratuitous_arp;
1082 u32 this_addr = clib_net_to_host_u32
1096 u32 lo_addr = clib_net_to_host_u32 (pa->
lo_addr);
1097 u32 hi_addr = clib_net_to_host_u32 (pa->
hi_addr);
1100 if ((this_addr >= lo_addr && this_addr <= hi_addr) &&
1114 if_addr0 = &proxy_src;
1116 n_proxy_arp_replies_sent++;
1128 n_left_to_next, pi0, next0);
1135 ETHERNET_ARP_ERROR_replies_sent,
1136 n_replies_sent - n_proxy_arp_replies_sent);
1139 ETHERNET_ARP_ERROR_proxy_arp_replies_sent,
1140 n_proxy_arp_replies_sent);
1144 static char *ethernet_arp_error_strings[] = {
1145 #define _(sym,string) string, 1154 .name =
"arp-input",
1155 .vector_size =
sizeof (
u32),
1157 .error_strings = ethernet_arp_error_strings,
1203 vec_add1 (es, e[0]);
1251 .path =
"show ip arp",
1253 .short_help =
"show ip arp",
1266 } ip4_over_ethernet[2];
1273 #define _(f) pg_edit_init (&p->f, ethernet_arp_header_t, f); 1276 _(n_l2_address_bytes);
1277 _(n_l3_address_bytes);
1279 _(ip4_over_ethernet[0].ethernet);
1280 _(ip4_over_ethernet[0].ip4);
1281 _(ip4_over_ethernet[1].ethernet);
1282 _(ip4_over_ethernet[1].ip4);
1303 if (!
unformat (input,
"%U: %U/%U -> %U/%U",
1374 && adj->
arp.next_hop.ip4.as_u32)
1390 clib_warning (
"Adjacency contains unknown ARP next hop %U (del)",
1399 clib_warning (
"Adjacency contains unknown ARP next hop %U (add)",
1426 #define _(o) hash_set_mem (am->opcode_by_name, #o, ETHERNET_ARP_OPCODE_##o); 1446 vnet_pcap_drop_trace_filter_add_del \ 1447 (rt->errors[ETHERNET_ARP_ERROR_##a], \ 1462 u32 sw_if_index,
u32 fib_index,
void *a_arg)
1464 ethernet_arp_ip4_over_ethernet_address_t *
a = a_arg;
1473 (
u8 *) & args,
sizeof (args));
1480 u32 fib_index,
void *a_arg)
1484 ethernet_arp_ip4_over_ethernet_address_t *
a = a_arg;
1500 memset (&args, 0,
sizeof (args));
1516 (im, fib_index, &a->ip4, 1 );
1553 for (i = 3; i >= 0; i--)
1555 old = a->ip4.as_u8[
i];
1556 a->ip4.as_u8[
i] += 1;
1557 if (old < a->ip4.as_u8[i])
1561 for (i = 5; i >= 0; i--)
1563 old = a->ethernet[
i];
1564 a->ethernet[
i] += 1;
1565 if (old < a->ethernet[i])
1576 u32 found_at_index = ~0;
1588 if (found_at_index != ~0)
1597 return VNET_API_ERROR_NO_SUCH_ENTRY;
1617 u32 *entries_to_delete = 0;
1624 return VNET_API_ERROR_NO_SUCH_ENTRY;
1635 for (i = 0; i <
vec_len (entries_to_delete); i++)
1664 if (adj->
arp.next_hop.ip4.as_u32 != 0)
1681 memset (&args, 0,
sizeof (args));
1702 ethernet_arp_ip4_over_ethernet_address_t lo_addr, hi_addr,
addr;
1723 else if (
unformat (input,
"static"))
1726 else if (
unformat (input,
"count %d", &count))
1729 else if (
unformat (input,
"fib-id %d", &fib_id))
1738 else if (
unformat (input,
"proxy %U - %U",
1757 for (i = 0; i < count; i++)
1761 uword event_type, *event_data = 0;
1769 (vnm, sw_if_index, fib_index, &addr, is_static);
1774 if (event_type != 1)
1779 (vnm, sw_if_index, fib_index, &addr);
1824 .path =
"set ip arp",
1826 "set ip arp [del] <intfc> <ip-address> <mac-address> [static] [count <count>] [fib-id <fib-id>] [proxy <lo-addr> - <hi-addr>]",
1891 .path =
"set interface proxy-arp",
1893 "set interface proxy-arp <intfc> [enable|disable]",
1910 u32 arp_term_next_node_index[32];
1917 u32 n_left_from, next_index, *from, *to_next;
1918 u32 n_replies_sent = 0;
1919 u16 last_bd_index = ~0;
1927 while (n_left_from > 0)
1933 while (n_left_from > 0 && n_left_to_next > 0)
1939 u32 pi0, error0, next0, sw_if_index0;
1950 n_left_to_next -= 1;
1955 ethertype0 = clib_net_to_host_u16 (*(
u16 *) (l3h0 - 2));
1968 clib_host_to_net_u16
1969 (ETHERNET_ARP_OPCODE_request))))
1970 goto next_l2_feature;
1972 error0 = ETHERNET_ARP_ERROR_replies_sent;
1975 clib_net_to_host_u16 (ETHERNET_ARP_HARDWARE_TYPE_ethernet) ?
1976 ETHERNET_ARP_ERROR_l2_type_not_ethernet : error0);
1979 clib_net_to_host_u16 (ETHERNET_TYPE_IP4) ?
1980 ETHERNET_ARP_ERROR_l3_type_not_ip4 : error0);
1994 error0 = ETHERNET_ARP_ERROR_l2_address_mismatch;
2005 u32 next_index = p[0];
2006 while (next_index != (
u32) ~ 0)
2014 rv = (*fp) (mc->
data,
2031 || (last_bd_index == (
u16) ~ 0)))
2033 last_bd_index = bd_index0;
2039 goto next_l2_feature;
2043 arp0->
opcode = clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply);
2049 n_replies_sent += 1;
2056 vnet_buffer (p0)->l2.feature_bitmap |= L2INPUT_FEAT_FWD;
2058 goto next_l2_feature;
2071 n_left_to_next, pi0, next0);
2076 u32 feature_bitmap0 =
2077 vnet_buffer (p0)->l2.feature_bitmap & ~L2INPUT_FEAT_ARP_TERM;
2078 vnet_buffer (p0)->l2.feature_bitmap = feature_bitmap0;
2082 n_left_to_next, pi0, next0);
2091 error0 = ETHERNET_ARP_ERROR_gratuitous_arp;
2097 n_left_to_next, pi0, next0);
2104 ETHERNET_ARP_ERROR_replies_sent, n_replies_sent);
2111 .name =
"arp-term-l2bd",
2112 .vector_size =
sizeof (
u32),
2114 .error_strings = ethernet_arp_error_strings,
2129 arp_term_l2bd_node.index,
2132 arp_term_next_node_index);
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
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.
#define foreach_ip_interface_address(lm, a, sw_if_index, loop, body)
static void set_ip4_over_ethernet_rpc_callback(vnet_arp_set_ip4_over_ethernet_rpc_args_t *a)
ip4_fib_t * find_ip4_fib_by_table_index_or_id(ip4_main_t *im, u32 table_index_or_id, u32 flags)
Get or create an IPv4 fib.
#define pool_next_index(P, I)
Return next occupied pool index after i, useful for safe iteration.
#define vec_foreach_index(var, v)
Iterate over vector indices.
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
#define hash_unset(h, key)
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 vlib_main_t * vlib_get_main(void)
static void increment_ip4_and_mac_address(ethernet_arp_ip4_over_ethernet_address_t *a)
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)
u16 n_adj
Number of adjecencies in block.
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
ip_lookup_next_t lookup_next_index
ip4_address_t * ip4_interface_first_address(ip4_main_t *im, u32 sw_if_index, ip_interface_address_t **result_ia)
pending_resolution_t * pending_resolutions
static void vlib_error_count(vlib_main_t *vm, uword node_index, uword counter, uword increment)
static void arp_ip4_entry_del_adj(ethernet_arp_ip4_entry_t *e, u32 adj_index)
u32 miss_adj_index
Adjacency index for routing table misses, local punts, and drops.
uword mhash_unset(mhash_t *h, void *key, uword *old_value)
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)
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.
#define ETHERNET_ARP_IP4_ENTRY_FLAG_GLEAN
uword unformat_pg_edit(unformat_input_t *input, va_list *args)
ip_lookup_main_t lookup_main
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.
format_function_t format_vlib_cpu_time
unformat_function_t unformat_vnet_sw_interface
u64 cpu_time_last_updated
static int vnet_ip_adjacency_share_compare(ip_adjacency_t *a1, ip_adjacency_t *a2)
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
void ip4_maybe_remap_adjacencies(ip4_main_t *im, u32 table_index_or_table_id, u32 flags)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
u32 neighbor_probe_adj_index
static int vnet_arp_set_ip4_over_ethernet_internal(vnet_main_t *vnm, u32 sw_if_index, u32 fib_index, void *a_arg, int is_static)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static pg_node_t * pg_get_node(uword node_index)
VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION(ethernet_arp_sw_interface_up_down)
vnet_main_t * vnet_get_main(void)
u8 * format_ethernet_address(u8 *s, va_list *args)
#define VNET_SW_INTERFACE_FLAG_PROXY_ARP
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define VLIB_INIT_FUNCTION(x)
#define IP4_ROUTE_FLAG_NEIGHBOR
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 uword ethernet_address_cast(u8 *a)
pending_resolution_t * mac_changes
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static int ip4_arp_entry_sort(void *a1, void *a2)
u32 vnet_arp_glean_add(u32 fib_index, void *next_hop_arg)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
u32 ip4_fib_lookup_with_table(ip4_main_t *im, u32 fib_index, ip4_address_t *dst, u32 disable_default_route)
ethernet_arp_hardware_type_t
static u8 * format_ethernet_arp_input_trace(u8 *s, va_list *va)
#define clib_warning(format, args...)
#define foreach_ethernet_arp_opcode
uword * pending_resolutions_by_address
int vnet_arp_unset_ip4_over_ethernet(vnet_main_t *vnm, u32 sw_if_index, u32 fib_index, void *a_arg)
static void * pg_create_edit_group(pg_stream_t *s, int n_edit_bytes, int n_packet_bytes, u32 *group_index)
#define vlib_call_init_function(vm, x)
#define hash_create_string(elts, value_bytes)
ip4_address_t ip4_address
format_function_t format_vnet_sw_interface_name
#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 vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
uword os_get_cpu_number(void)
#define pool_put(P, E)
Free an object E in pool P.
#define vec_dup(V)
Return copy of vector (no header, no alignment)
static void unset_random_arp_entry(void)
#define vec_del1(v, i)
Delete the element at index I.
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
static void arp_ip4_entry_add_adj(ethernet_arp_ip4_entry_t *e, u32 adj_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...
static void vlib_buffer_reset(vlib_buffer_t *b)
Reset current header & length to state they were in when packet was received.
#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 uword mhash_set(mhash_t *h, void *key, uword new_value, uword *old_value)
#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).
ethernet_arp_ip4_key_t key
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static clib_error_t * ethernet_init(vlib_main_t *vm)
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)
ethernet_proxy_arp_t * proxy_arps
void mhash_init(mhash_t *h, uword n_value_bytes, uword n_key_bytes)
vlib_node_registration_t ip4_rewrite_node
(constructor) VLIB_REGISTER_NODE (ip4_rewrite_node)
int ip4_address_compare(ip4_address_t *a1, ip4_address_t *a2)
int vnet_arp_set_ip4_over_ethernet(vnet_main_t *vnm, u32 sw_if_index, u32 fib_index, void *a_arg, int is_static)
static void arp_add_del_adj_cb(struct ip_lookup_main_t *lm, u32 adj_index, ip_adjacency_t *adj, u32 is_del)
#define vec_free(V)
Free vector's memory (no header).
void vnet_rewrite_for_sw_interface(vnet_main_t *vnm, vnet_l3_packet_type_t packet_type, u32 sw_if_index, u32 node_index, void *dst_address, vnet_rewrite_header_t *rw, u32 max_rewrite_bytes)
static ethernet_arp_main_t ethernet_arp_main
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 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)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
unformat_function_t * unformat_edit
uword * mac_changes_by_address
static uword * mhash_get(mhash_t *h, void *key)
This packet matches an "interface route" and packets need to be passed to ARP to find rewrite string ...
void vnet_register_ip4_arp_resolution_event(vnet_main_t *vnm, void *address_arg, uword node_index, uword type_opaque, uword data)
int vnet_proxy_arp_add_del(ip4_address_t *lo_addr, ip4_address_t *hi_addr, u32 fib_index, int is_del)
#define IP4_ROUTE_FLAG_DEL
static u8 * format_ethernet_arp_opcode(u8 *s, va_list *va)
clib_error_t * arp_term_init(vlib_main_t *vm)
#define hash_create(elts, value_bytes)
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
static int vnet_arp_unset_ip4_over_ethernet_internal(vnet_main_t *vnm, u32 sw_if_index, u32 fib_index, void *a_arg)
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
static void ip_register_add_del_adjacency_callback(ip_lookup_main_t *lm, ip_add_del_adjacency_callback_t cb)
static u8 * format_ethernet_arp_ip4_entry(u8 *s, va_list *va)
ip4_address_t dst_address
#define IP4_ROUTE_FLAG_ADD
#define vec_delete(V, N, M)
Delete N elements starting at element M.
#define ip46_address_set_ip4(ip46, ip)
static void arp_unnumbered(vlib_buffer_t *p0, u32 pi0, ethernet_header_t *eth0, ip_interface_address_t *ifa0)
static void pg_free_edit_group(pg_stream_t *s)
#define VLIB_NODE_FLAG_TRACE
u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
clib_error_t * ethernet_arp_sw_interface_up_down(vnet_main_t *vnm, u32 sw_if_index, u32 flags)
void ip_update_adjacency(ip_lookup_main_t *lm, u32 adj_index, ip_adjacency_t *copy_adj)
#define VLIB_BUFFER_IS_TRACED
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 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)
VLIB_CLI_COMMAND(set_interface_ip_source_and_port_range_check_command, static)
int vnet_proxy_arp_fib_reset(u32 fib_id)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u32 heap_handle
Handle for this adjacency in adjacency heap.
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
#define IP4_ROUTE_FLAG_FIB_INDEX
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)
u32 table_index_or_table_id
l2_bridge_domain_t * bd_configs
#define clib_mem_unaligned(pointer, type)
ethernet_arp_input_error_t
static uword ip4_destination_matches_interface(ip4_main_t *im, ip4_address_t *key, ip_interface_address_t *ia)
#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.
struct ip_adjacency_t::@143::@145 arp
IP_LOOKUP_NEXT_ARP only.
#define clib_error_return(e, args...)
static void * ip_interface_address_get_address(ip_lookup_main_t *lm, ip_interface_address_t *a)
void ip4_add_del_route(ip4_main_t *im, ip4_add_del_route_args_t *args)
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
#define ETHERNET_ARP_IP4_ENTRY_FLAG_STATIC
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
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.
static ip_adjacency_t * ip_get_adjacency(ip_lookup_main_t *lm, u32 adj_index)
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.