aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/unix/plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib/unix/plugin.c')
-rw-r--r--src/vlib/unix/plugin.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/vlib/unix/plugin.c b/src/vlib/unix/plugin.c
index a714c7c29ce..5cac9abc8fe 100644
--- a/src/vlib/unix/plugin.c
+++ b/src/vlib/unix/plugin.c
@@ -35,7 +35,7 @@ char *vlib_plugin_app_version __attribute__ ((weak));
char *vlib_plugin_app_version = "";
void *
-vlib_get_plugin_symbol (char *plugin_name, char *symbol_name)
+vlib_get_plugin_symbol (const char *plugin_name, const char *symbol_name)
{
plugin_main_t *pm = &vlib_plugin_main;
uword *p;
@@ -194,6 +194,8 @@ load_one_plugin (plugin_main_t * pm, plugin_info_t * pi, int from_early_init)
reread_reg = 0;
goto process_reg;
}
+ else
+ clib_error_free (error);
error = elf_get_section_by_name (&em, ".vlib_plugin_registration",
&section);
@@ -304,7 +306,12 @@ process_reg:
}
vec_free (version_required);
+#if defined(RTLD_DEEPBIND)
+ handle = dlopen ((char *) pi->filename,
+ RTLD_LAZY | (reg->deep_bind ? RTLD_DEEPBIND : 0));
+#else
handle = dlopen ((char *) pi->filename, RTLD_LAZY);
+#endif
if (handle == 0)
{
@@ -593,7 +600,12 @@ vlib_plugin_early_init (vlib_main_t * vm)
0x7FFFFFFF /* aka no rate limit */ );
if (pm->plugin_path == 0)
- pm->plugin_path = format (0, "%s%c", vlib_plugin_path, 0);
+ pm->plugin_path = format (0, "%s", vlib_plugin_path);
+
+ if (pm->plugin_path_add)
+ pm->plugin_path = format (pm->plugin_path, ":%s", pm->plugin_path_add);
+
+ pm->plugin_path = format (pm->plugin_path, "%c", 0);
PLUGIN_LOG_DBG ("plugin path %s", pm->plugin_path);
@@ -632,7 +644,6 @@ vlib_plugins_show_cmd_fn (vlib_main_t * vm,
s = format (s, " Plugin path is: %s\n\n", pm->plugin_path);
s = format (s, " %-41s%-33s%s\n", "Plugin", "Version", "Description");
- /* *INDENT-OFF* */
hash_foreach_mem (key, value, pm->plugin_by_name_hash,
{
if (key != 0)
@@ -644,21 +655,18 @@ vlib_plugins_show_cmd_fn (vlib_main_t * vm,
index++;
}
});
- /* *INDENT-ON* */
vlib_cli_output (vm, "%v", s);
vec_free (s);
return 0;
}
-/* *INDENT-OFF* */
VLIB_CLI_COMMAND (plugins_show_cmd, static) =
{
.path = "show plugins",
.short_help = "show loaded plugins",
.function = vlib_plugins_show_cmd_fn,
};
-/* *INDENT-ON* */
static clib_error_t *
config_one_plugin (vlib_main_t * vm, char *name, unformat_input_t * input)
@@ -755,6 +763,8 @@ done:
u8 *s = 0;
if (unformat (input, "path %s", &s))
pm->plugin_path = s;
+ else if (unformat (input, "add-path %s", &s))
+ pm->plugin_path_add = s;
else if (unformat (input, "name-filter %s", &s))
pm->plugin_name_filter = s;
else if (unformat (input, "vat-path %s", &s))