plugin: Add plugin 'default' disable/enable 15/11315/6
authorMohsin Kazmi <sykazmi@cisco.com>
Thu, 22 Mar 2018 22:45:23 +0000 (23:45 +0100)
committerDamjan Marion <dmarion.lists@gmail.com>
Mon, 26 Mar 2018 12:18:30 +0000 (12:18 +0000)
How to use:
  plugins
  {
    plugin default {disable}
    plugin dpdk_plugin.so {enable}
    plugin acl_plugin.so {enable}
  }

It also preserves the old behavior.

Change-Id: I9901c56d82ec4410e69c917992b78052aa6a99e0
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
src/vlib/unix/plugin.c
src/vlib/unix/plugin.h

index a1df3b2..b4eb0b9 100644 (file)
@@ -94,6 +94,9 @@ load_one_plugin (plugin_main_t * pm, plugin_info_t * pi, int from_early_init)
       goto error;
     }
 
+  if (pm->plugins_default_disable)
+    reg->default_disabled = 1;
+
   p = hash_get_mem (pm->config_index_by_name, pi->name);
   if (p)
     {
@@ -517,6 +520,13 @@ done:
        pm->vat_plugin_path = s;
       else if (unformat (input, "vat-name-filter %s", &s))
        pm->vat_plugin_name_filter = s;
+      else if (unformat (input, "plugin default %U",
+                        unformat_vlib_cli_sub_input, &sub_input))
+       {
+         pm->plugins_default_disable =
+           unformat (&sub_input, "disable") ? 1 : 0;
+         unformat_free (&sub_input);
+       }
       else if (unformat (input, "plugin %s %U", &s,
                         unformat_vlib_cli_sub_input, &sub_input))
        {
index aad1ca3..2a23827 100644 (file)
@@ -97,6 +97,7 @@ typedef struct
   u8 *plugin_name_filter;
   u8 *vat_plugin_path;
   u8 *vat_plugin_name_filter;
+  u8 plugins_default_disable;
 
   /* plugin configs and hash by name */
   plugin_config_t *configs;