#include <vnet/ip/lookup.h>
#include <vnet/dpo/dpo.h>
#include <vnet/fib/fib_table.h>
+#include <vpp/app/version.h>
static ila_main_t ila_main;
*/
static fib_node_type_t ila_fib_node_type;
+/**
+ * FIB source for adding entries
+ */
+static fib_source_t ila_fib_src;
+
u8 *
format_half_ip6_address (u8 * s, va_list * va)
{
{
ila_ila2sir_trace_t *tr =
vlib_add_trace (vm, node, p0, sizeof (*tr));
- tr->ila_index = ie0 ? (ie0 - ilm->entries) : ~0;
+ tr->ila_index = ie0 - ilm->entries;
tr->initial_dst = ip60->dst_address;
tr->adj_index = vnet_buffer (p0)->ip.adj_index[VLIB_TX];
}
ip61->dst_address.as_u64[0] = ila_address1->as_u64[0];
ip61->dst_address.as_u64[1] = ila_address1->as_u64[1];
- vnet_feature_next (vnet_buffer (p0)->sw_if_index[VLIB_RX], &next0, p0);
- vnet_feature_next (vnet_buffer (p1)->sw_if_index[VLIB_RX], &next1, p1);
+ vnet_feature_next (&next0, p0);
+ vnet_feature_next (&next1, p1);
vlib_validate_buffer_enqueue_x2 (vm, node, next_index, to_next,
n_left_to_next, pi0, pi1, next0,
ip60->dst_address.as_u64[0] = ila_address0->as_u64[0];
ip60->dst_address.as_u64[1] = ila_address0->as_u64[1];
- vnet_feature_next (vnet_buffer (p0)->sw_if_index[VLIB_RX], &next0, p0);
+ vnet_feature_next (&next0, p0);
vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
n_left_to_next, pi0, next0);
fib_table_entry_special_add(0,
&next_hop,
FIB_SOURCE_RR,
- FIB_ENTRY_FLAG_NONE,
- ADJ_INDEX_INVALID);
+ FIB_ENTRY_FLAG_NONE);
e->next_hop_child_index =
fib_entry_child_add(e->next_hop_fib_entry_index,
ila_fib_node_type,
fib_table_entry_special_dpo_add(0,
&pfx,
- FIB_SOURCE_PLUGIN_HI,
+ ila_fib_src,
FIB_ENTRY_FLAG_EXCLUSIVE,
&dpo);
dpo_reset(&dpo);
.fp_proto = FIB_PROTOCOL_IP6,
};
- fib_table_entry_special_remove(0, &pfx, FIB_SOURCE_PLUGIN_HI);
+ fib_table_entry_special_remove(0, &pfx, ila_fib_src);
/*
* remove this ILA entry as child of the FIB netry for the next-hop
*/
return 0;
}
-clib_error_t *
-vlib_plugin_register (vlib_main_t * vm, vnet_plugin_handoff_t * h,
- int from_early_init)
-{
- clib_error_t *error = 0;
-
- return error;
-}
+/* *INDENT-OFF* */
+VLIB_PLUGIN_REGISTER () = {
+ .version = VPP_BUILD_VER,
+ .description = "Identifier Locator Addressing (ILA) for IPv6",
+};
+/* *INDENT-ON* */
u8 *format_ila_dpo (u8 * s, va_list * va)
{
ila_dpo_type = dpo_register_new_type(&ila_vft, ila_nodes);
ila_fib_node_type = fib_node_register_new_type(&ila_fib_node_vft);
-
+ ila_fib_src = fib_source_allocate("ila",
+ FIB_SOURCE_PRIORITY_HI,
+ FIB_SOURCE_BH_SIMPLE);
return NULL;
}
ila_add_del_entry_args_t args = { 0 };
u8 next_hop_set = 0;
int ret;
+ clib_error_t *error = 0;
args.type = ILA_TYPE_IID;
args.csum_mode = ILA_CSUM_MODE_NO_ACTION;
else if (unformat (line_input, "del"))
args.is_del = 1;
else
- return clib_error_return (0, "parse error: '%U'",
- format_unformat_error, line_input);
+ {
+ error = clib_error_return (0, "parse error: '%U'",
+ format_unformat_error, line_input);
+ goto done;
+ }
}
- unformat_free (line_input);
-
if (!next_hop_set)
- return clib_error_return (0, "Specified a next hop");
+ {
+ error = clib_error_return (0, "Specified a next hop");
+ goto done;
+ }
if ((ret = ila_add_del_entry (&args)))
- return clib_error_return (0, "ila_add_del_entry returned error %d", ret);
+ {
+ error = clib_error_return (0, "ila_add_del_entry returned error %d", ret);
+ goto done;
+ }
- return NULL;
+done:
+ unformat_free (line_input);
+
+ return error;
}
VLIB_CLI_COMMAND (ila_entry_command, static) =
ila_entry_t *e;
vlib_cli_output (vm, " %U\n", format_ila_entry, vnm, NULL);
- pool_foreach (e, ilm->entries,
- ({
+ pool_foreach (e, ilm->entries)
+ {
vlib_cli_output (vm, " %U\n", format_ila_entry, vnm, e);
- }));
+ }
return NULL;
}