diff options
Diffstat (limited to 'plugins/ila-plugin/ila/ila.c')
-rw-r--r-- | plugins/ila-plugin/ila/ila.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/plugins/ila-plugin/ila/ila.c b/plugins/ila-plugin/ila/ila.c index 69fbb82a..c0e6da11 100644 --- a/plugins/ila-plugin/ila/ila.c +++ b/plugins/ila-plugin/ila/ila.c @@ -15,6 +15,7 @@ #include <ila/ila.h> #include <vnet/plugin/plugin.h> +#include <vnet/ip/lookup.h> static ila_main_t ila_main; @@ -794,6 +795,16 @@ vlib_plugin_register (vlib_main_t * vm, vnet_plugin_handoff_t * h, return error; } +u8 *ila_format_adjacency(u8 * s, + struct ip_lookup_main_t * lm, + ip_adjacency_t *adj) +{ + ila_main_t *ilm = &ila_main; + ila_adj_data_t * ad = (ila_adj_data_t *) & adj->opaque; + ila_entry_t *ie = pool_elt_at_index (ilm->entries, ad->entry_index); + return format(s, "idx:%d sir:%U", ad->entry_index, format_ip6_address, &ie->sir_address); +} + clib_error_t * ila_init (vlib_main_t * vm) { @@ -810,14 +821,15 @@ ila_init (vlib_main_t * vm) "ila id to entry index table", ilm->lookup_table_nbuckets, ilm->lookup_table_size); - vlib_node_t *ip6_lookup_node = - vlib_get_node_by_name (vm, (u8 *) "ip6-lookup"); - - ilm->ip6_lookup_next_index = - vlib_node_add_next (vm, ip6_lookup_node->index, ila_ila2sir_node.index); return NULL; } +VNET_IP6_REGISTER_ADJACENCY(ila2sir) = { + .node_name = "ila-to-sir", + .fn = ila_format_adjacency, + .next_index = &ila_main.ip6_lookup_next_index +}; + VLIB_INIT_FUNCTION (ila_init); static clib_error_t * |