plugin-loader: Add option to change log message if plugin is not found

Distributions like Debian/Ubuntu ship the plugins in multiple packages
that are not all installed by default.  When running tools like pki or
swanctl, which don't use modular loading with config snippets by default,
there are errors in the output if these packages and plugins are
currently not available.  In order to not alarm users, this change adds
a configure option that package maintainers can use.  It causes the log
level of the message to increase and also adds a note that mentions that
plugins are potentially available in other packages (which should be the
case unless the user tried to load a plugin, e.g. via load statement,
that is not actually built and shipped by the package maintainers).
This commit is contained in:
Tobias Brunner
2026-02-06 11:21:34 +01:00
parent 5b0d506215
commit dd7b0283ef
2 changed files with 10 additions and 0 deletions
+5
View File
@@ -68,6 +68,7 @@ ARG_WITH_SET([dev-headers], [no], [install strongSwan development heade
ARG_WITH_SET([printf-hooks], [auto], [force the use of a specific printf hook implementation (auto, builtin, glibc, vstr).])
ARG_WITH_SET([rubygemdir], ["gem environment gemdir"], [path to install ruby gems to])
ARG_WITH_SET([testable-ke], [yes], [make key exchange implementations testable by providing a set_seed() method])
ARG_WITH_SET([plugins-packaged-seperately], [no], [changes e.g. log messages for distributions that package plugins seperately])
if test -n "$PKG_CONFIG"; then
systemdsystemunitdir_default=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
@@ -1944,6 +1945,10 @@ fi
if test x$imc_swima = xtrue -o x$imv_swima = xtrue; then
AC_DEFINE([USE_JSON], [], [build code for JSON])
fi
if test "x$plugins_packaged_seperately" != xno; then
AC_DEFINE([PLUGINS_PACKAGED_SEPARATELY], [], [distribution ships plugins in multiple packages])
fi
# ====================================================
# options for enabled modules (see conf/Makefile.am)
@@ -477,8 +477,13 @@ static plugin_entry_t *load_plugin(private_plugin_loader_t *this, char *name,
{ /* try to load the plugin from a file */
break;
}
#ifndef PLUGINS_PACKAGED_SEPARATELY
DBG1(DBG_LIB, "plugin '%s': failed to load - %s not found and no "
"plugin file available", name, create);
#else
DBG2(DBG_LIB, "plugin '%s': failed to load - %s not found, plugin "
"may be shipped in a separate package", name, create);
#endif
/* fall-through */
default:
return NULL;