From 3b3688f9d3a640a169e9c7fc858d36ab3aeb147e Mon Sep 17 00:00:00 2001 From: Ole Troan Date: Wed, 15 Jun 2016 14:29:08 +0200 Subject: 6rd: Move to plugin - Change toplevel plugins make target. Now builds all plugins under plugins/. (Apart from sample-plugin). - Move sixrd code to plugins directory and make necessary changes to make it a plugin - Remove 6rd hooks from IP lookup code Change-Id: I447e92e3bee240cd8de01d0abac2e1708e8c27d1 Signed-off-by: Ole Troan --- vlib/vlib/unix/plugin.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'vlib') diff --git a/vlib/vlib/unix/plugin.c b/vlib/vlib/unix/plugin.c index 3411ef340af..93bfbb71b7c 100644 --- a/vlib/vlib/unix/plugin.c +++ b/vlib/vlib/unix/plugin.c @@ -61,11 +61,13 @@ load_one_plugin (plugin_main_t *pm, plugin_info_t *pi, int from_early_init) pi->handle = handle; + register_handle = dlsym (pi->handle, "vlib_plugin_register"); if (register_handle == 0) { dlclose (handle); - return 0; + clib_warning("Plugin missing vlib_plugin_register: %s\n", (char *)pi->name); + return 1; } fp = register_handle; @@ -148,9 +150,12 @@ int vlib_load_new_plugins (plugin_main_t *pm, int from_early_init) plugin_name = format (0, "%s/%s%c", plugin_path[i], entry->d_name, 0); - + + /* Only accept .so */ + char * ext = strrchr((const char *)plugin_name, '.'); /* unreadable */ - if (stat ((char *)plugin_name, &statb) < 0) + if(!ext || (strcmp(ext, ".so") != 0) || + stat ((char *)plugin_name, &statb) < 0) { ignore: vec_free (plugin_name); -- cgit 1.2.3-korg