vlib: add option to plugin registration to prefer deep binding 30/33730/1
authorDamjan Marion <damarion@cisco.com>
Wed, 15 Sep 2021 13:08:28 +0000 (15:08 +0200)
committerDamjan Marion <damarion@cisco.com>
Wed, 15 Sep 2021 13:15:40 +0000 (15:15 +0200)
Type: improvement
Change-Id: I9ce7e1ee7e7afe8e9befe36ae8c59291beaaaf36
Signed-off-by: Damjan Marion <damarion@cisco.com>
src/vlib/unix/plugin.c
src/vlib/unix/plugin.h

index a714c7c..4a7ff27 100644 (file)
@@ -304,7 +304,8 @@ process_reg:
     }
   vec_free (version_required);
 
-  handle = dlopen ((char *) pi->filename, RTLD_LAZY);
+  handle = dlopen ((char *) pi->filename,
+                  RTLD_LAZY | (reg->deep_bind ? RTLD_DEEPBIND : 0));
 
   if (handle == 0)
     {
index ae15e5d..e3555fe 100644 (file)
  * vlib_load_new_plugins().
  */
 
-/* *INDENT-OFF* */
-typedef CLIB_PACKED(struct {
-  u8 default_disabled;
+typedef struct
+{
+  u8 default_disabled : 1;
+  u8 deep_bind : 1;
   const char version[32];
   const char version_required[32];
   const char overrides[256];
   const char *early_init;
   const char *description;
-}) vlib_plugin_registration_t;
-/* *INDENT-ON* */
+} __clib_packed vlib_plugin_registration_t;
 
 /*
  * Plugins may also use this registration format, which is