aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/ila-plugin/ila/ila.c
diff options
context:
space:
mode:
authorPierre Pfister <ppfister@cisco.com>2016-07-27 17:46:11 +0100
committerDave Barach <openvpp@barachs.net>2016-07-28 12:19:21 +0000
commit4c3f39353d0307a35180e597c0b0454439e848e9 (patch)
tree191befe11b7a42c07e812e7dcecf1f9c5c3c4ab9 /plugins/ila-plugin/ila/ila.c
parent6cc6f9175c46d9a98db43f47da35119e2b59aa00 (diff)
Add IP adjacency registration function
Given that it is possible and easy to add dynamic IP adjacencies, it might be helpful to have an explicit call to do so. This way, additional information such as how to display the adjacency can be provided at the same time. Change-Id: I5c735ae45ed763560352f637e3462f2931dc97d9 Signed-off-by: Pierre Pfister <ppfister@cisco.com>
Diffstat (limited to 'plugins/ila-plugin/ila/ila.c')
-rw-r--r--plugins/ila-plugin/ila/ila.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/plugins/ila-plugin/ila/ila.c b/plugins/ila-plugin/ila/ila.c
index 69fbb82a3ad..c0e6da11fac 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 *