X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvlib%2Fnode.c;h=cc1732bb90d133626ae22c136600772f26161141;hb=812b32dd8f637118bf65de2cdff0e95b421a963b;hp=17dd2ea87d42e76271fb37d3be1e7cf61ec60812;hpb=04e0bb2ff0f39dab45da01ecdbc7914035a36897;p=vpp.git diff --git a/src/vlib/node.c b/src/vlib/node.c index 17dd2ea87d4..cc1732bb90d 100644 --- a/src/vlib/node.c +++ b/src/vlib/node.c @@ -324,6 +324,26 @@ register_node (vlib_main_t * vm, vlib_node_registration_t * r) ASSERT (VLIB_NODE_TYPE_INTERNAL == zero.type); } + if (r->node_fn_registrations) + { + vlib_node_fn_registration_t *fnr = r->node_fn_registrations; + int priority = -1; + + /* to avoid confusion, please remove ".function " statiement from + CLIB_NODE_REGISTRATION() if using function function candidates */ + ASSERT (r->function == 0); + + while (fnr) + { + if (fnr->priority > priority) + { + priority = fnr->priority; + r->function = fnr->function; + } + fnr = fnr->next_registration; + } + } + ASSERT (r->function != 0); n = clib_mem_alloc_no_fail (sizeof (n[0]));