From 994a58997dec4a1a34efd8e43440b56d100d44af Mon Sep 17 00:00:00 2001 From: Benoît Ganne Date: Fri, 4 Aug 2023 16:13:43 +0200 Subject: nsh: fix nsh gre references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since gre is a plugin, nsh should not use symbol names directly. Type: fix Fixes: cefb178aa487a217d4ac75d7d4fa62db4b7d70fd Change-Id: I1a1c20740aabdaafd69f507cd71016c3109b0205 Signed-off-by: Benoît Ganne --- src/plugins/nsh/nsh.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/plugins/nsh/nsh.c b/src/plugins/nsh/nsh.c index 3c804e9934c..de7bdcebfca 100644 --- a/src/plugins/nsh/nsh.c +++ b/src/plugins/nsh/nsh.c @@ -184,7 +184,7 @@ nsh_md2_set_next_ioam_export_override (uword next) clib_error_t * nsh_init (vlib_main_t * vm) { - vlib_node_t *node; + vlib_node_t *node, *gre4_input, *gre6_input; nsh_main_t *nm = &nsh_main; clib_error_t *error = 0; uword next_node; @@ -240,15 +240,19 @@ nsh_init (vlib_main_t * vm) vlib_node_add_next (vm, vxlan6_gpe_input_node.index, nsh_aware_vnf_proxy_node.index); - vlib_node_add_next (vm, gre4_input_node.index, nm->nsh_input_node_index); - vlib_node_add_next (vm, gre4_input_node.index, nm->nsh_proxy_node_index); - vlib_node_add_next (vm, gre4_input_node.index, - nsh_aware_vnf_proxy_node.index); - - vlib_node_add_next (vm, gre6_input_node.index, nm->nsh_input_node_index); - vlib_node_add_next (vm, gre6_input_node.index, nm->nsh_proxy_node_index); - vlib_node_add_next (vm, gre6_input_node.index, - nsh_aware_vnf_proxy_node.index); + gre4_input = vlib_get_node_by_name (vm, (u8 *) "gre4-input"); + gre6_input = vlib_get_node_by_name (vm, (u8 *) "gre6-input"); + if (gre4_input == 0 || gre6_input == 0) + { + error = clib_error_return (0, "gre_plugin.so is not loaded"); + return error; + } + vlib_node_add_next (vm, gre4_input->index, nm->nsh_input_node_index); + vlib_node_add_next (vm, gre4_input->index, nm->nsh_proxy_node_index); + vlib_node_add_next (vm, gre4_input->index, nsh_aware_vnf_proxy_node.index); + vlib_node_add_next (vm, gre6_input->index, nm->nsh_input_node_index); + vlib_node_add_next (vm, gre6_input->index, nm->nsh_proxy_node_index); + vlib_node_add_next (vm, gre6_input->index, nsh_aware_vnf_proxy_node.index); /* Add NSH-Proxy support */ vxlan4_input = -- cgit 1.2.3-korg