summaryrefslogtreecommitdiffstats
path: root/nsh-plugin
diff options
context:
space:
mode:
authorKeith Burns (alagalah) <alagalah@gmail.com>2016-06-17 11:16:31 -0700
committerKeith Burns <alagalah@gmail.com>2016-06-21 11:27:07 +0000
commita72e5a1cb6637486794da3fbcdd728d5e37fb5ff (patch)
tree965baa9acaf489a14d0a454f50f60a134a0af44d /nsh-plugin
parent4928fda10e118ac7eecc296d04b8c93f9078f369 (diff)
Add input node wiring for vxlan4-gpe-input, vxlan6-gpe-input, gre
Change-Id: Ie7b132924f36a0522e956a80d3f6f2b5fcca84f0 Signed-off-by: Keith Burns (alagalah) <alagalah@gmail.com>
Diffstat (limited to 'nsh-plugin')
-rw-r--r--nsh-plugin/Makefile.am4
-rw-r--r--nsh-plugin/nsh/nsh.c81
2 files changed, 54 insertions, 31 deletions
diff --git a/nsh-plugin/Makefile.am b/nsh-plugin/Makefile.am
index 99c607e..e34e903 100644
--- a/nsh-plugin/Makefile.am
+++ b/nsh-plugin/Makefile.am
@@ -42,9 +42,9 @@ nsh_test_plugin_la_LDFLAGS = -module
install-data-hook:
mkdir $(prefix)/lib/vpp_plugins || true
mkdir $(prefix)/lib/vpp_api_test_plugins || true
- cp $(prefix)/lib/nsh_plugin.so.*.*.* $(prefix)/lib/vpp_plugins
+ cp $(prefix)/lib/nsh_plugin.so.*.*.* $(prefix)/lib/vpp_plugins/nsh_plugin.so
cp $(prefix)/lib/nsh_test_plugin.so.*.*.* \
- $(prefix)/lib/vpp_api_test_plugins
+ $(prefix)/lib/vpp_api_test_plugins/nsh_test_plugin.so
rm -f $(prefix)/lib/nsh_plugin.*
rm -f $(prefix)/lib/nsh_test_plugin.*
diff --git a/nsh-plugin/nsh/nsh.c b/nsh-plugin/nsh/nsh.c
index 10cd60f..e937204 100644
--- a/nsh-plugin/nsh/nsh.c
+++ b/nsh-plugin/nsh/nsh.c
@@ -612,35 +612,6 @@ nsh_plugin_api_hookup (vlib_main_t *vm)
return 0;
}
-clib_error_t *nsh_init (vlib_main_t *vm)
-{
- nsh_main_t *nm = &nsh_main;
- clib_error_t * error = 0;
- u8 * name;
-
- nm->nsh_mapping_by_key
- = hash_create_mem (0, sizeof(u32), sizeof (uword));
-
- nm->nsh_mapping_by_mapped_key
- = hash_create_mem (0, sizeof(u32), sizeof (uword));
-
- nm->nsh_entry_by_key
- = hash_create_mem (0, sizeof(u32), sizeof (uword));
-
- name = format (0, "nsh_%08x%c", api_version, 0);
-
-
- nm->msg_id_base = vl_msg_api_get_msg_ids
- ((char *) name, VL_MSG_FIRST_AVAILABLE);
-
- error = nsh_plugin_api_hookup (vm);
-
- vec_free(name);
-
- return error;
-}
-
-VLIB_INIT_FUNCTION(nsh_init);
@@ -881,3 +852,55 @@ VLIB_REGISTER_NODE (nsh_input_node) = {
#undef _
},
};
+
+clib_error_t *nsh_init (vlib_main_t *vm)
+{
+ nsh_main_t *nm = &nsh_main;
+ clib_error_t * error = 0;
+ vlib_node_t * vxlan4_gpe_input_node = 0;
+ vlib_node_t * vxlan6_gpe_input_node = 0;
+ vlib_node_t * gre_input_node = 0;
+ u8 * name;
+
+ /* Init the main structures from VPP */
+ nm->vlib_main = vm;
+ nm->vnet_main = vnet_get_main();
+
+ /* Various state maintenance mappings */
+ nm->nsh_mapping_by_key
+ = hash_create_mem (0, sizeof(u32), sizeof (uword));
+
+ nm->nsh_mapping_by_mapped_key
+ = hash_create_mem (0, sizeof(u32), sizeof (uword));
+
+ nm->nsh_entry_by_key
+ = hash_create_mem (0, sizeof(u32), sizeof (uword));
+
+ name = format (0, "nsh_%08x%c", api_version, 0);
+
+ /* Set up the API */
+ nm->msg_id_base = vl_msg_api_get_msg_ids
+ ((char *) name, VL_MSG_FIRST_AVAILABLE);
+
+ error = nsh_plugin_api_hookup (vm);
+
+ /* Add dispositions to nodes that feed nsh-input */
+ vxlan4_gpe_input_node = vlib_get_node_by_name (vm, (u8 *)"vxlan4-gpe-input");
+ ASSERT(vxlan4_gpe_input_node);
+ //alagalah - validate we don't really need to use the node value
+ vlib_node_add_next (vm, vxlan4_gpe_input_node->index, nsh_input_node.index);
+
+ vxlan6_gpe_input_node = vlib_get_node_by_name (vm, (u8 *)"vxlan6-gpe-input");
+ ASSERT(vxlan6_gpe_input_node);
+ vlib_node_add_next (vm, vxlan6_gpe_input_node->index, nsh_input_node.index);
+
+ gre_input_node = vlib_get_node_by_name (vm, (u8 *)"gre-input");
+ ASSERT(gre_input_node);
+ vlib_node_add_next (vm, gre_input_node->index, nsh_input_node.index);
+
+ vec_free(name);
+
+ return error;
+}
+
+VLIB_INIT_FUNCTION(nsh_init);