* Public part of stroke_t object.
*/
controller_t public;
-
- /**
- * should we reuse established IKE_SAs when setting up CHILD_SAs?
- */
- bool reuse_ikesa;
};
* associated listener
*/
interface_bus_listener_t listener;
-
- /**
- * back reference to controller
- */
- private_controller_t *controller;
};
/**
interface_bus_listener_t *listener = &job->listener;
peer_cfg_t *peer_cfg = listener->peer_cfg;
- if (job->controller->reuse_ikesa)
- {
- ike_sa = charon->ike_sa_manager->checkout_by_config(
- charon->ike_sa_manager, peer_cfg);
- }
- else
- {
- ike_sa = charon->ike_sa_manager->checkout_new(
- charon->ike_sa_manager, TRUE);
- }
+ ike_sa = charon->ike_sa_manager->checkout_by_config(charon->ike_sa_manager,
+ peer_cfg);
listener->ike_sa = ike_sa;
if (ike_sa->get_peer_cfg(ike_sa) == NULL)
job.listener.status = FAILED;
job.listener.child_cfg = child_cfg;
job.listener.peer_cfg = peer_cfg;
- job.controller = this;
job.public.execute = (void*)initiate_execute;
job.public.destroy = nop;
/**
* Implementation of controller_t.terminate_ike.
*/
-static status_t terminate_ike(private_controller_t *this, u_int32_t unique_id,
+static status_t terminate_ike(controller_t *this, u_int32_t unique_id,
controller_cb_t callback, void *param)
{
interface_job_t job;
job.listener.param = param;
job.listener.status = FAILED;
job.listener.id = unique_id;
- job.controller = this;
job.public.execute = (void*)terminate_ike_execute;
job.public.destroy = nop;
/**
* Implementation of controller_t.terminate_child.
*/
-static status_t terminate_child(private_controller_t *this, u_int32_t reqid,
+static status_t terminate_child(controller_t *this, u_int32_t reqid,
controller_cb_t callback, void *param)
{
interface_job_t job;
job.listener.param = param;
job.listener.status = FAILED;
job.listener.id = reqid;
- job.controller = this;
job.public.execute = (void*)terminate_child_execute;
job.public.destroy = nop;
ike_sa_t *ike_sa;
interface_bus_listener_t *listener = &job->listener;
peer_cfg_t *peer_cfg = listener->peer_cfg;
-
- if (job->controller->reuse_ikesa)
- {
- ike_sa = charon->ike_sa_manager->checkout_by_config(
- charon->ike_sa_manager, peer_cfg);
- }
- else
- {
- ike_sa = charon->ike_sa_manager->checkout_new(
- charon->ike_sa_manager, TRUE);
- }
+ ike_sa = charon->ike_sa_manager->checkout_by_config(charon->ike_sa_manager,
+ peer_cfg);
listener->ike_sa = ike_sa;
if (ike_sa->get_peer_cfg(ike_sa) == NULL)
/**
* Implementation of controller_t.route.
*/
-static status_t route(private_controller_t *this,
+static status_t route(controller_t *this,
peer_cfg_t *peer_cfg, child_cfg_t *child_cfg,
controller_cb_t callback, void *param)
{
job.listener.status = FAILED;
job.listener.peer_cfg = peer_cfg;
job.listener.child_cfg = child_cfg;
- job.controller = this;
job.public.execute = (void*)route_execute;
job.public.destroy = nop;
/**
* Implementation of controller_t.unroute.
*/
-static status_t unroute(private_controller_t *this, u_int32_t reqid,
+static status_t unroute(controller_t *this, u_int32_t reqid,
controller_cb_t callback, void *param)
{
interface_job_t job;
job.listener.param = param;
job.listener.status = FAILED;
job.listener.id = reqid;
- job.controller = this;
job.public.execute = (void*)unroute_execute;
job.public.destroy = nop;
this->public.unroute = (status_t(*)(controller_t*,u_int32_t,controller_cb_t,void*))unroute;
this->public.destroy = (void (*)(controller_t*))destroy;
- this->reuse_ikesa = lib->settings->get_bool(lib->settings,
- "charon.reuse_ikesa", TRUE);
return &this->public;
}
* SHA1 hasher for IKE_SA_INIT retransmit detection
*/
hasher_t *hasher;
+
+ /**
+ * reuse existing IKE_SAs in checkout_by_config
+ */
+ bool reuse_ikesa;
};
/**
pthread_mutex_unlock(&this->mutex);
DBG2(DBG_MGR, "created IKE_SA, %d IKE_SAs in manager",
this->ike_sa_list->get_count(this->ike_sa_list));
- charon->bus->set_sa(charon->bus, entry->ike_sa);
return entry->ike_sa;
}
pthread_mutex_lock(&(this->mutex));
- if (my_host && other_host)
+ if (my_host && other_host && this->reuse_ikesa)
{
enumerator = this->ike_sa_list->create_enumerator(this->ike_sa_list);
while (enumerator->enumerate(enumerator, &entry))
}
this->ike_sa_list = linked_list_create();
pthread_mutex_init(&this->mutex, NULL);
+ this->reuse_ikesa = lib->settings->get_bool(lib->settings,
+ "charon.reuse_ikesa", TRUE);
return &this->public;
}