if (e->flags & ETHERNET_ARP_IP4_ENTRY_FLAG_NO_FIB_ENTRY)
flags = format (flags, "N");
- s = format (s, "%=12U%=16U%=6s%=20U%=24U",
+ s = format (s, "%=12U%=16U%=6s%=20U%U",
format_vlib_cpu_time, vnm->vlib_main, e->cpu_time_last_updated,
format_ip4_address, &e->ip4_address,
flags ? (char *) flags : "",
e->fib_entry_index =
fib_table_entry_path_add (fib_index, &pfx, FIB_SOURCE_ADJ,
FIB_ENTRY_FLAG_ATTACHED,
- FIB_PROTOCOL_IP4, &pfx.fp_addr,
+ DPO_PROTO_IP4, &pfx.fp_addr,
e->sw_if_index, ~0, 1, NULL,
FIB_ROUTE_PATH_FLAG_NONE);
}
_ (opcode_not_request, "ARP opcode not request") \
_ (proxy_arp_replies_sent, "Proxy ARP replies sent") \
_ (l2_address_mismatch, "ARP hw addr does not match L2 frame src addr") \
- _ (missing_interface_address, "ARP missing interface address") \
_ (gratuitous_arp, "ARP probe or announcement dropped") \
_ (interface_no_table, "Interface is not mapped to an IP table") \
_ (interface_not_ip_enabled, "Interface is not IP enabled") \
fib_node_index_t dst_fei, src_fei;
fib_prefix_t pfx0;
fib_entry_flag_t src_flags, dst_flags;
- ip_adjacency_t *adj0 = NULL;
- adj_index_t ai;
+ u8 *rewrite0, rewrite0_len;
pi0 = from[0];
to_next[0] = pi0;
if (FIB_ENTRY_FLAG_LOCAL & src_flags)
{
error0 = ETHERNET_ARP_ERROR_l3_src_address_is_local;
- goto drop2;
+ /*
+ * When VPP has an interface whose address is also
+ * applied to a TAP interface on the host, then VPP's
+ * TAP interface will be unnumbered to the 'real'
+ * interface and do proxy ARP from the host.
+ * The curious aspect of this setup is that ARP requests
+ * from the host will come from the VPP's own address.
+ * So don't drop immediately here, instead go see if this
+ * is a proxy ARP case.
+ */
+ goto drop1;
}
/* A Source must also be local to subnet of matching
* interface address. */
goto drop1;
}
- /* Send a reply. */
send_reply:
- ai = fib_entry_get_adj (src_fei);
- if (ADJ_INDEX_INVALID != ai)
- {
- adj0 = adj_get (ai);
- }
- else
- {
- error0 = ETHERNET_ARP_ERROR_missing_interface_address;
- goto drop2;
- }
+ /* Send a reply.
+ An adjacency to the sender is not always present,
+ so we use the interface to build us a rewrite string
+ which will contain all the necessary tags. */
+ rewrite0 = ethernet_build_rewrite (vnm, sw_if_index0,
+ VNET_LINK_ARP,
+ eth_rx->src_address);
+ rewrite0_len = vec_len (rewrite0);
+
/* Figure out how much to rewind current data from adjacency. */
- vlib_buffer_advance (p0, -adj0->rewrite_header.data_bytes);
+ vlib_buffer_advance (p0, -rewrite0_len);
eth_tx = vlib_buffer_get_current (p0);
vnet_buffer (p0)->sw_if_index[VLIB_TX] = sw_if_index0;
/* the rx nd tx ethernet headers wil overlap in the case
* when we received a tagged VLAN=0 packet, but we are sending
* back untagged */
- memmove (eth_tx->dst_address, eth_rx->src_address, 6);
- clib_memcpy (eth_tx->src_address, hw_if0->hw_address, 6);
+ clib_memcpy (eth_tx, rewrite0, vec_len (rewrite0));
+ vec_free (rewrite0);
if (NULL == pa)
{
}
}
- /* We are going to reply to this request, so learn the sender */
- error0 = arp_learn (vnm, am, sw_if_index0,
- &arp0->ip4_over_ethernet[1]);
+ /* We are going to reply to this request, so, in the absence of
+ errors, learn the sender */
+ if (!error0)
+ error0 = arp_learn (vnm, am, sw_if_index0,
+ &arp0->ip4_over_ethernet[1]);
vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
n_left_to_next, pi0, next0);
fib_table_entry_path_remove (fib_index, &pfx,
FIB_SOURCE_ADJ,
- FIB_PROTOCOL_IP4,
+ DPO_PROTO_IP4,
&pfx.fp_addr,
e->sw_if_index, ~0, 1,
FIB_ROUTE_PATH_FLAG_NONE);
ethernet_arp_ip4_entry_t *e;
ethernet_arp_interface_t *eai;
+ if (vec_len (am->ethernet_arp_by_sw_if_index) <= args->sw_if_index)
+ return 0;
+
eai = &am->ethernet_arp_by_sw_if_index[args->sw_if_index];
e = arp_entry_find (eai, &args->a.ip4);
ethernet_arp_ip4_entry_t *e;
ethernet_arp_interface_t *eai;
+ if (vec_len (am->ethernet_arp_by_sw_if_index) <= args->sw_if_index)
+ return 0;
+
eai = &am->ethernet_arp_by_sw_if_index[args->sw_if_index];
e = arp_entry_find (eai, &args->a.ip4);
ethernet_arp_ip4_entry_t *e;
ethernet_arp_interface_t *eai;
+ vec_validate (am->ethernet_arp_by_sw_if_index, args->sw_if_index);
eai = &am->ethernet_arp_by_sw_if_index[args->sw_if_index];
e = arp_entry_find (eai, &args->a.ip4);