Commit Graph
76 Commits
Author SHA1 Message Date
Martin Willi 20a0fd9255 plugin-loader: Do not unload libraries during dlclose(), if supported
Unloading libraries calls any library constructor/destructor functions. Some
libraries can't handle that in our excessive unit test use. GnuTLS leaks
a /dev/urandom file descriptor, letting unit tests fail with arbitrary
out-of-resources errors.
2015-02-24 12:25:01 +01:00
Martin Willi 5421092b75 plugin-loader: Support a reload() callback for static features 2014-09-22 13:55:12 +02:00
Martin Willi 2e6c203bad windows: Provide wrappers for dlopen() function family 2014-06-03 12:24:34 +02:00
Tobias Brunner 0ab7d5f1f9 plugin-loader: Properly initialize modular plugin list if no plugins are enabled 2014-03-18 10:56:39 +01:00
Tobias Brunner 190a278854 plugin-loader: Optionally use load option in each plugin section to load plugins
This now works because all plugins use the same config namespace.

If <ns>.load_modular is true, the list of plugins to load is determined
via the value of the <ns>.plugins.<name>.load options.

Using includes the following is possible:

charon {
  load_modular = yes
  plugins {
    include strongswan.d/charon/*.conf
  }
}

charon-cmd {
  load_modular = yes
  plugins {
    include strongswan.d/charon-cmd/*.conf
  }
}

Where each .conf file would contain something like:

<name> {
  load = yes
  <option> = <value>
}

To increase the priority of individual plugins load = <priority> can be
used (the default is 1).  For instance, to use openssl instead of the
built-in crypto plugins set in strongswan.d/charon/openssl.conf:

openssl {
  load = 10
}

If two plugins have the same priority their order in the default plugin
list is preserved.  Plugins not found in that list are ordered
alphabetically before other plugins with the same priority.
2014-02-12 14:34:33 +01:00
Tobias Brunner 8d2450d8b8 plugin-loader: Convenience function added to add plugin dirs in build tree 2013-11-06 10:31:07 +01:00
Tobias Brunner b18a531715 plugin-loader: Removed unused path argument of load() method
Multiple additional search paths can be added with the add_path()
method.
2013-06-28 10:44:15 +02:00
Tobias Brunner f2086e42ff plugin-loader: Method added to provide additional search paths for plugins 2013-06-27 10:27:24 +02:00
Tobias Brunner 0d25c4ef87 plugin-loader: Move logging of failed features to status()
Still log an error message if critical features fail, as loaded
plugins/features are not logged in that case.

This way loaded plugins are printed before failed features and
the relation is easier to make for users.  It also allows programs
to log this message on a different level.
2013-06-21 15:22:46 +02:00
Tobias Brunner 607f8e9906 plugin-loader: Add method to print loaded plugins on a given log level 2013-06-21 15:17:53 +02:00
Tobias Brunner 34ee14dd28 plugin-loader: Collect statistics while loading features, print them in case features failed to load
There is no need to explicitly search for failed features in critical
plugins as this is now detected while loading the features.
2013-06-21 15:13:25 +02:00
Tobias Brunner 681e53c70c plugin-loader: Use different log level if failed feature is in critical plugin 2013-06-21 15:13:25 +02:00
Tobias Brunner 13d2d8f634 plugin-loader: Log message when failing to load plugin 2013-06-21 15:13:25 +02:00
Tobias Brunner 51b9d7513d plugin-loader: Reduce verbosity while loading plugins 2013-06-21 15:13:25 +02:00
Martin Willi 2bedb0f270 Move test-runners has_feature() function to plugin loader 2013-06-21 10:53:22 +02:00
Tobias Brunner 49d7a98f47 Refactored plugin-loader with improved dependency resolution
With the new implementation the plugins don't have to be listed in any
special order, dependencies are properly resolved.  The order only
matters if two plugins provide the same feature.
2013-06-11 11:18:19 +02:00
Tobias Brunner 8a6cc1e35f plugin-feature: Function added to exactly compare plugin features 2013-06-11 11:18:17 +02:00
Tobias Brunner f05b427265 Moved debug.[ch] to utils folder 2012-10-24 16:00:51 +02:00
Tobias Brunner 08944b68ac Moved integrity_checker_t to utils folder 2012-10-24 16:00:50 +02:00
Tobias Brunner 12642a6831 Moved data structures to new collections subfolder 2012-10-24 16:00:49 +02:00
Tobias Brunner a9f169f699 Don't require PLUGINDIR to be defined.
If it is not available, we just load monolithically built plugins.
2012-08-08 15:07:42 +02:00
Tobias Brunner 18d21a57df Added a method to plugin_loader_t to add 'static' plugin features
This allows daemons and other components to register plugin features
like those provided by plugins (following the same lifecycle).

The added features are internally handled like they were added by a
plugin.
2012-06-25 17:03:07 +02:00
Tobias Brunner e07122436c Make sure that all features of critical plugins are loaded 2012-06-25 17:03:07 +02:00
Tobias Brunner 79d5c4f06b Fixed return values of several functions (e.g. return FALSE for pointer types). 2012-05-31 17:39:04 +02:00
Tobias Brunner fda9f104b4 Fixed check for loaded plugins with feature types that are not compared exactly.
Previously e.g. RNGs with weaker strength would have overwritten stronger
ones.
2012-05-24 15:15:34 +02:00
Tobias Brunner 9eac6106d0 Use a hashtable to check for already loaded plugin features. 2012-05-23 17:50:05 +02:00
Martin Willi 40ca363a8b If we load new features from a plugin, restart loading from first plugin 2012-05-03 11:08:09 +02:00
Martin Willi f14bf6345f Don't depend on a feature that has a dependency to the same feauture during unload 2012-05-02 14:05:52 +02:00
Tobias Brunner f1ba06c1c6 Cache list of plugin names to further simplify its usage.
Also helpful for ipsec statusall to avoid having to enumerate plugins.
2012-01-19 12:37:42 +01:00
Tobias Brunner ad1aaf4be3 Function added to plugin_loader to get a list of the names of loaded plugins. 2012-01-19 11:51:51 +01:00
Martin Willi 8b8fcfd631 Be less verbose if plugin dependecy not satisfied 2011-12-07 13:42:10 +01:00
Martin Willi 58fcdc4f06 Don't enforce features with soft dependencies before all plugins are loaded 2011-10-14 10:05:49 +02:00
Martin Willi a07f2a4b9b Don't try to load a feature again after failure 2011-10-14 10:05:49 +02:00
Martin Willi 59c4e88b16 Reset registration function for each plugin during feature loading 2011-10-14 10:05:49 +02:00
Martin Willi 61c1dec8d4 Fixed memleak in plugin unloading 2011-10-14 10:05:47 +02:00
Martin Willi 2feed2f3fe Load features after each plugin loaded until all plugins have feature support 2011-10-14 10:05:47 +02:00
Martin Willi d965872d66 Implemented feature unloading, moved feature registration plugin_features.c 2011-10-14 10:05:47 +02:00
Tobias Brunner c293c87761 Don't use union members directly in plugin_feature_t. 2011-10-14 10:05:47 +02:00
Tobias Brunner ef80de6010 Unload plugins which we were not able to load any features from. 2011-10-14 10:05:46 +02:00
Tobias Brunner 076aa51fc9 Easier to understand test for soft dependencies in dependencies_satisfied. 2011-10-14 10:05:46 +02:00
Martin Willi 3cd28acce0 Add aead plugin features 2011-10-14 10:05:46 +02:00
Martin Willi f85a4310cb Added database and fetcher plugin features 2011-10-14 10:05:45 +02:00
Martin Willi fa7c8338ca Plugin enumerator enumerates over loaded features, too 2011-10-14 10:05:44 +02:00
Martin Willi 62b9e2f938 Added support for plugin features 2011-10-14 10:05:44 +02:00
Tobias Brunner 629fd2f4f6 Finally removed deprecated iterator_t. 2011-07-06 09:43:46 +02:00
Martin Willi ed49e9a303 Added plugin_loader method to reload plugin configurations 2011-04-15 10:07:13 +02:00
Martin Willi 787b5884aa Added a get_name() function to plugin_t, create_plugin_enumerator enumerates over plugin_t 2011-04-15 10:07:12 +02:00
Martin Willi 6e2791715b Migrated remaining plugin_t implementations to INIT/METHOD macros 2011-04-15 10:07:12 +02:00
Martin Willi 2b36342551 Migrated plugin_loader to INIT/METHOD macros 2011-04-15 10:07:12 +02:00
Andreas Steffen 1a9f2443a2 prevent multiple debug outputs in case of non-monolithic plugins 2011-02-20 15:18:36 +01:00