aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/unix/plugin.c
AgeCommit message (Collapse)AuthorFilesLines
2020-10-15vlib: add cgo-friendly plugin registration supportDave Barach1-9/+101
Allows us to declare plugin registrations in a non-disgusting way: var plugin_reg = vpp.PluginRegistration{ Description: "The CGO plugin", Version: "My Version", Overrides: "sample_plugin.so", } It turns out that the specific compiler setup generates (.data section offset, length) pairs in the .vlib_plugin_r2 section: Contents of section .vlib_plugin_r2: 1ba9d0 00000000 00000000 50a81800 00000000 ........P....... 1ba9e0 0a000000 00000000 00000000 00000000 ................ 1ba9f0 00000000 00000000 00000000 00000000 ................ 1baa00 00000000 00000000 00000000 00000000 ................ 1baa10 00000000 00000000 70a81800 00000000 ........p....... 1baa20 0e000000 00000000 ........ Contents of section .data: 18a800 00a81800 00000000 00000000 00000000 ................ 18a810 00000000 00000000 00000000 00000000 ................ 18a820 00000000 00000000 00000000 00000000 ................ 18a830 00000000 00000000 00000000 00000000 ................ 18a840 00000000 00000000 14000000 00000000 ................ 18a850 4d792056 65727369 6f6e0000 00000000 My Version...... 18a860 00000000 00000000 14000000 00000000 ................ 18a870 54686520 45474f20 706c7567 696e0000 The CGO plugin.. 18a880 00000000 00000000 0c000000 00000000 ................ <etc> Unfortunately, it seems impossible to torture clang / gcc into producing anything like this. This patch fabricates a plausible vlib_plugin_registration_t from the so-called vlib_plugin_r2_t. Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I8c0c5a24f3b7bfea07d5181a7250b3d9685e8446
2020-02-06vlib: add plugin override supportDave Barach1-31/+178
Allow a plugin to override (suppress loading of) other plugins. This mechanism allows a developer to prevent specific plugins from being loaded. To do so, provide an "overrides" list in the plugin definition: VLIB_PLUGIN_REGISTER () = { <snip> .overrides = "avf_plugin.so,ioam_plugin.so,dpdk_plugin.so", }; or some such. Simply list the plugins in question as shown above. The .overrides structure member is limited to 256 octets. The named .elf section mechanism used to discover the vlib_plugin_registration_t's precludes the use of a variable-length array of strings. Use the vlib log to eliminate plugin and built-in vat plugin loader console spew. Added vlib_log_register_class_rate_limit(...) to allow procedural configuration of the log rate-limit. We *never* want to rate-limit plugin loader messages. Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I0a9327b8cf5508482f057342783252112cb44170
2018-04-09plugins: unload plugin if early init failsDamjan Marion1-2/+4
Change-Id: I32f68e2ee8f5d32962acdefb0193583f71d342b3 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-03-26plugin: Add plugin 'default' disable/enableMohsin Kazmi1-0/+10
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>
2018-03-13Rationalize plugin symbol error reportingDave Barach1-1/+1
Change-Id: I64f2b2007f30fc1c6bd2990ba0d7ccbcd43cdb38 Signed-off-by: Dave Barach <dave@barachs.net>
2017-11-29Configure vat-plugin-path and vat-plugin-name-filterDave Barach1-0/+20
To facilitate in-tree plugin API testing, via the "binary-api..." debug CLI command. Change-Id: If7ee88a6a0dbc8e8f4555cb41e259db24e378a64 Signed-off-by: Dave Barach <dave@barachs.net>
2017-04-26Exit if plugin load attempt failDamjan Marion1-6/+2
This happens mainly if plugin contains unresolved symbol. Such situation typically leads on crash a bit later so it is better to exit immediatelly and display meaningful error message. Change-Id: I4abd9a9089a4863400bf609e8d3fd7cebab92913 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-03-22vlib: add description field in plugin registrationDamjan Marion1-5/+9
Change-Id: I88b322a5d602f3d6d3310e971479180a89430e0e Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-02-26Load plugins in alphabetical orderDave Barach1-9/+55
API traces contain absolute message numbers. Loading plugins in directory (vs. alphabetical) order makes trace replay fragile. Change-Id: I46b3a3b6a9843a383d42269fca0cf5a789486eaf Signed-off-by: Dave Barach <dave@barachs.net>
2017-02-07VPP-630: Null pointer dereferences in vlib/unix/plugin.cOle Troan1-1/+1
Change-Id: Iafb071c684a43e21925e3a43019cd86372347898 Signed-off-by: Ole Troan <ot@cisco.com>
2017-02-03Plugin infrastructure improvementsDamjan Marion1-57/+282
This patch replaces requirement for vlib_plugin_register function in the plugin so file and introduces new macro: VLIB_PLUGIN_REGISTER () = { .version = "version string", .version_required = "requred version", .default_disabled = 1, .early_init = "early_init_function_name", }; Plugin will nor be loaded if .default_disabled is set to 1 unless explicitely enabled in startup.conf. If .verstion_required is set, plugin will not be loaded if there is version mismatch between plugin and vpp. This can be bypassed by setting "skip-version-check" for specific plugin. If .early-init string is present, plugin loader will try to resolve this specific symbol in the plugin namespace and make a function call. Following startup.conf configuration is added: plugins { path /path/to/plugin/directory plugin ila_plugin.so { enable skip-version-check } plugin acl_plugin.so { disable } } Change-Id: I706c691dd34d94ffe9e02b59831af8859a95f061 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-01-23binary-api debug CLI works with pluginsDave Barach1-2/+7
Change-Id: I81f33f5153d5afac94b66b5a8cb91da77463af79 Signed-off-by: Dave Barach <dave@barachs.net>
2017-01-07plugin: add API to get pointer to symbol in different pluginDamjan Marion1-7/+24
Change-Id: Ic2fbbd8227d5d0c033e5d7b5f43b859a4889d2f3 Signed-off-by: Damjan Marion <damarion@cisco.com>
2016-12-28Reorganize source tree to use single autotools instanceDamjan Marion1-0/+260
Change-Id: I7b51f88292e057c6443b12224486f2d0c9f8ae23 Signed-off-by: Damjan Marion <damarion@cisco.com>