summaryrefslogtreecommitdiffstats
path: root/src/vlibapi
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2017-03-02 13:13:23 -0500
committerDamjan Marion <dmarion.lists@gmail.com>2017-03-02 20:33:52 +0000
commita1a093d4e46e38503332a97ad216f80053a15f2b (patch)
treeac0c40a3985b9593b141b534978d3f3ee91a65ec /src/vlibapi
parent25b36674f7e9072084f8f149067450f5eb6a5841 (diff)
Clean up binary api message handler registration issues
Removed a fair number of "BUG" message handlers, due to conflicts with actual message handlers in api_format.c. Vpp itself had no business receiving certain messages, up to the point where we started building in relevant code from vpp_api_test. Eliminated all but one duplicate registration complaint. That one needs attention from the vxlan team since the duplicated handlers have diverged. Change-Id: Iafce5429d2f906270643b4ea5f0130e20beb4d1d Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vlibapi')
-rw-r--r--src/vlibapi/api.h15
-rw-r--r--src/vlibapi/api_shared.c4
2 files changed, 19 insertions, 0 deletions
diff --git a/src/vlibapi/api.h b/src/vlibapi/api.h
index fcb101d7dba..b40ece158ff 100644
--- a/src/vlibapi/api.h
+++ b/src/vlibapi/api.h
@@ -271,6 +271,21 @@ vlib_node_t **vlib_node_unserialize (u8 * vector);
#define VLIB_API_INIT_FUNCTION(x) VLIB_DECLARE_INIT_FUNCTION(x,api_init)
+/* Call given init function: used for init function dependencies. */
+#define vlib_call_api_init_function(vm, x) \
+ ({ \
+ extern vlib_init_function_t * _VLIB_INIT_FUNCTION_SYMBOL (x,api_init); \
+ vlib_init_function_t * _f = _VLIB_INIT_FUNCTION_SYMBOL (x,api_init); \
+ clib_error_t * _error = 0; \
+ if (! hash_get (vm->init_functions_called, _f)) \
+ { \
+ hash_set1 (vm->init_functions_called, _f); \
+ _error = _f (vm); \
+ } \
+ _error; \
+ })
+
+
#endif /* included_api_h */
/*
diff --git a/src/vlibapi/api_shared.c b/src/vlibapi/api_shared.c
index 1a2740e2400..79921afe2d7 100644
--- a/src/vlibapi/api_shared.c
+++ b/src/vlibapi/api_shared.c
@@ -667,6 +667,10 @@ vl_msg_api_config (vl_msg_api_msg_config_t * c)
foreach_msg_api_vector;
#undef _
+ if (am->msg_names[c->id])
+ clib_warning ("BUG: multiple registrations of 'vl_api_%s_t_handler'",
+ c->name);
+
am->msg_names[c->id] = c->name;
am->msg_handlers[c->id] = c->handler;
am->msg_cleanup_handlers[c->id] = c->cleanup;