load-tester: Register kernel-ipsec implementation as plugin feature

Otherwise, libcharon's dependency on kernel-ipsec can't be satisfied.

This changed with db61c37690 ("kernel-interface: Return bool for
kernel interface registration") as the registration of further
kernel-ipsec implementations now fails and therefore even if other
plugins are loaded the dependency will not be satisfied anymore.

References #953.
This commit is contained in:
Tobias Brunner
2016-02-01 11:22:56 +01:00
parent 7f2a20a4f4
commit db57f5702b
@@ -240,16 +240,24 @@ METHOD(plugin_t, get_features, int,
PLUGIN_SDEPEND(PRIVKEY, KEY_RSA),
PLUGIN_SDEPEND(CERT_DECODE, CERT_ANY),
PLUGIN_SDEPEND(CERT_DECODE, CERT_X509),
PLUGIN_CALLBACK(kernel_ipsec_register, load_tester_ipsec_create),
PLUGIN_PROVIDE(CUSTOM, "kernel-ipsec"),
};
int count = countof(f);
*features = f;
return countof(f);
if (!lib->settings->get_bool(lib->settings,
"%s.plugins.load-tester.fake_kernel", FALSE, lib->ns))
{
count -= 2;
}
return count;
}
METHOD(plugin_t, destroy, void,
private_load_tester_plugin_t *this)
{
hydra->kernel_interface->remove_ipsec_interface(hydra->kernel_interface,
(kernel_ipsec_constructor_t)load_tester_ipsec_create);
this->mutex->destroy(this->mutex);
this->condvar->destroy(this->condvar);
free(this);
@@ -289,12 +297,5 @@ plugin_t *load_tester_plugin_create()
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
.condvar = condvar_create(CONDVAR_TYPE_DEFAULT),
);
if (lib->settings->get_bool(lib->settings,
"%s.plugins.load-tester.fake_kernel", FALSE, lib->ns))
{
hydra->kernel_interface->add_ipsec_interface(hydra->kernel_interface,
(kernel_ipsec_constructor_t)load_tester_ipsec_create);
}
return &this->public.plugin;
}