vnet_main_t *vnm = va_arg (*va, vnet_main_t *);
ethernet_arp_ip4_entry_t *e = va_arg (*va, ethernet_arp_ip4_entry_t *);
vnet_sw_interface_t *si;
- u8 *flags = 0;
if (!e)
return format (s, "%=12s%=16s%=6s%=20s%=24s", "Time", "IP4",
si = vnet_get_sw_interface (vnm, e->sw_if_index);
- if (e->flags & IP_NEIGHBOR_FLAG_STATIC)
- flags = format (flags, "S");
-
- if (e->flags & IP_NEIGHBOR_FLAG_DYNAMIC)
- flags = format (flags, "D");
-
- if (e->flags & IP_NEIGHBOR_FLAG_NO_FIB_ENTRY)
- flags = format (flags, "N");
-
- s = format (s, "%=12U%=16U%=6s%=20U%U",
- format_vlib_time, vnm->vlib_main, e->time_last_updated,
- format_ip4_address, &e->ip4_address,
- flags ? (char *) flags : "",
- format_mac_address_t, &e->mac,
- format_vnet_sw_interface_name, vnm, si);
-
- vec_free (flags);
- return s;
+ return format (s, "%=12U%=16U%=6U%=20U%U",
+ format_vlib_time, vnm->vlib_main, e->time_last_updated,
+ format_ip4_address, &e->ip4_address,
+ format_ip_neighbor_flags, e->flags,
+ format_mac_address_t, &e->mac,
+ format_vnet_sw_interface_name, vnm, si);
}
typedef struct
am->ethernet_arp_by_sw_if_index[sw_if_index].enabled = 1;
vnet_feature_enable_disable ("arp", "arp-reply", sw_if_index, 1, NULL, 0);
+ vnet_feature_enable_disable ("arp", "arp-disabled", sw_if_index, 0, NULL,
+ 0);
}
static int
if (!arp_is_enabled (am, sw_if_index))
return;
+ vnet_feature_enable_disable ("arp", "arp-disabled", sw_if_index, 1, NULL,
+ 0);
vnet_feature_enable_disable ("arp", "arp-reply", sw_if_index, 0, NULL, 0);
eai = &am->ethernet_arp_by_sw_if_index[sw_if_index];
typedef enum arp_input_next_t_
{
ARP_INPUT_NEXT_DROP,
+ ARP_INPUT_NEXT_DISABLED,
ARP_INPUT_N_NEXT,
} arp_input_next_t;
ETHERNET_ARP_ERROR_l3_dst_address_unset : error0);
if (ETHERNET_ARP_ERROR_replies_sent == error0)
- vnet_feature_arc_start (am->feature_arc_index,
- vnet_buffer (p0)->sw_if_index[VLIB_RX],
- &next0, p0);
+ {
+ next0 = ARP_INPUT_NEXT_DISABLED;
+ vnet_feature_arc_start (am->feature_arc_index,
+ vnet_buffer (p0)->sw_if_index[VLIB_RX],
+ &next0, p0);
+ }
else
p0->error = node->errors[error0];
return frame->n_vectors;
}
+typedef enum arp_disabled_next_t_
+{
+ ARP_DISABLED_NEXT_DROP,
+ ARP_DISABLED_N_NEXT,
+} arp_disabled_next_t;
+
+#define foreach_arp_disabled_error \
+ _ (DISABLED, "ARP Disabled on this interface") \
+
+typedef enum
+{
+#define _(sym,string) ARP_DISABLED_ERROR_##sym,
+ foreach_arp_disabled_error
+#undef _
+ ARP_DISABLED_N_ERROR,
+} arp_disabled_error_t;
+
+static char *arp_disabled_error_strings[] = {
+#define _(sym,string) string,
+ foreach_arp_disabled_error
+#undef _
+};
+
+static uword
+arp_disabled (vlib_main_t * vm,
+ vlib_node_runtime_t * node, vlib_frame_t * frame)
+{
+ u32 n_left_from, next_index, *from, *to_next, n_left_to_next;
+
+ from = vlib_frame_vector_args (frame);
+ n_left_from = frame->n_vectors;
+ next_index = node->cached_next_index;
+
+ if (node->flags & VLIB_NODE_FLAG_TRACE)
+ vlib_trace_frame_buffers_only (vm, node, from, frame->n_vectors,
+ /* stride */ 1,
+ sizeof (ethernet_arp_input_trace_t));
+
+ while (n_left_from > 0)
+ {
+ vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
+
+ while (n_left_from > 0 && n_left_to_next > 0)
+ {
+ arp_disabled_next_t next0 = ARP_DISABLED_NEXT_DROP;
+ vlib_buffer_t *p0;
+ u32 pi0, error0;
+
+ next0 = ARP_DISABLED_NEXT_DROP;
+ error0 = ARP_DISABLED_ERROR_DISABLED;
+
+ pi0 = to_next[0] = from[0];
+ from += 1;
+ to_next += 1;
+ n_left_from -= 1;
+ n_left_to_next -= 1;
+
+ p0 = vlib_get_buffer (vm, pi0);
+ p0->error = node->errors[error0];
+
+ vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
+ n_left_to_next, pi0, next0);
+ }
+
+ vlib_put_next_frame (vm, node, next_index, n_left_to_next);
+ }
+
+ return frame->n_vectors;
+}
+
static_always_inline u32
arp_mk_reply (vnet_main_t * vnm,
vlib_buffer_t * p0,
/* *INDENT-OFF* */
-/* Built-in ARP rx feature path definition */
-VNET_FEATURE_ARC_INIT (arp_feat, static) =
-{
- .arc_name = "arp",
- .start_nodes = VNET_FEATURES ("arp-input"),
- .last_in_arc = "error-drop",
- .arc_index_ptr = ðernet_arp_main.feature_arc_index,
-};
-
VLIB_REGISTER_NODE (arp_input_node, static) =
{
.function = arp_input,
.n_errors = ETHERNET_ARP_N_ERROR,
.error_strings = ethernet_arp_error_strings,
.n_next_nodes = ARP_INPUT_N_NEXT,
+ .next_nodes = {
+ [ARP_INPUT_NEXT_DROP] = "error-drop",
+ [ARP_INPUT_NEXT_DISABLED] = "arp-disabled",
+ },
+ .format_buffer = format_ethernet_arp_header,
+ .format_trace = format_ethernet_arp_input_trace,
+};
+
+VLIB_REGISTER_NODE (arp_disabled_node, static) =
+{
+ .function = arp_disabled,
+ .name = "arp-disabled",
+ .vector_size = sizeof (u32),
+ .n_errors = ARP_DISABLED_N_ERROR,
+ .error_strings = arp_disabled_error_strings,
+ .n_next_nodes = ARP_DISABLED_N_NEXT,
.next_nodes = {
[ARP_INPUT_NEXT_DROP] = "error-drop",
},
.format_trace = format_ethernet_arp_input_trace,
};
+/* Built-in ARP rx feature path definition */
+VNET_FEATURE_ARC_INIT (arp_feat, static) =
+{
+ .arc_name = "arp",
+ .start_nodes = VNET_FEATURES ("arp-input"),
+ .last_in_arc = "error-drop",
+ .arc_index_ptr = ðernet_arp_main.feature_arc_index,
+};
+
VNET_FEATURE_INIT (arp_reply_feat_node, static) =
{
.arc_name = "arp",
.node_name = "arp-reply",
- .runs_before = VNET_FEATURES ("error-drop"),
+ .runs_before = VNET_FEATURES ("arp-disabled"),
};
VNET_FEATURE_INIT (arp_proxy_feat_node, static) =
.arc_name = "arp",
.node_name = "arp-proxy",
.runs_after = VNET_FEATURES ("arp-reply"),
+ .runs_before = VNET_FEATURES ("arp-disabled"),
+};
+
+VNET_FEATURE_INIT (arp_disabled_feat_node, static) =
+{
+ .arc_name = "arp",
+ .node_name = "arp-disabled",
.runs_before = VNET_FEATURES ("error-drop"),
};
{
.arc_name = "arp",
.node_name = "error-drop",
+ .runs_before = 0, /* last feature */
};
/* *INDENT-ON* */
}
}
-/*
- * Remove any proxy arp entries associated with the
- * specified fib.
- */
-int
-vnet_proxy_arp_fib_reset (u32 fib_id)
-{
- ethernet_arp_main_t *am = ðernet_arp_main;
- ethernet_proxy_arp_t *pa;
- u32 *entries_to_delete = 0;
- u32 fib_index;
- int i;
-
- fib_index = fib_table_find (FIB_PROTOCOL_IP4, fib_id);
- if (~0 == fib_index)
- return VNET_API_ERROR_NO_SUCH_ENTRY;
-
- vec_foreach (pa, am->proxy_arps)
- {
- if (pa->fib_index == fib_index)
- {
- vec_add1 (entries_to_delete, pa - am->proxy_arps);
- }
- }
-
- for (i = 0; i < vec_len (entries_to_delete); i++)
- {
- vec_delete (am->proxy_arps, 1, entries_to_delete[i]);
- }
-
- vec_free (entries_to_delete);
-
- return 0;
-}
-
static clib_error_t *
ip_arp_add_del_command_fn (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
static clib_error_t *
vnet_arp_delete_sw_interface (vnet_main_t * vnm, u32 sw_if_index, u32 is_add)
{
+ ethernet_arp_main_t *am = ðernet_arp_main;
+
if (!is_add && sw_if_index != ~0)
{
- ethernet_arp_main_t *am = ðernet_arp_main;
ethernet_arp_ip4_entry_t *e;
/* *INDENT-OFF* */
pool_foreach (e, am->ip4_entry_pool, ({
vnet_arp_unset_ip4_over_ethernet_internal (vnm, &args);
}));
/* *INDENT-ON* */
+ arp_disable (am, sw_if_index);
+ }
+ else if (is_add)
+ {
+ vnet_feature_enable_disable ("arp", "arp-disabled",
+ sw_if_index, 1, NULL, 0);
}
return (NULL);