aboutsummaryrefslogtreecommitdiffstats
path: root/src/charon/queues/jobs/initiate_job.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/charon/queues/jobs/initiate_job.c')
-rw-r--r--src/charon/queues/jobs/initiate_job.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/charon/queues/jobs/initiate_job.c b/src/charon/queues/jobs/initiate_job.c
index 52877c424..8b943a3f1 100644
--- a/src/charon/queues/jobs/initiate_job.c
+++ b/src/charon/queues/jobs/initiate_job.c
@@ -45,6 +45,11 @@ struct private_initiate_job_t {
connection_t *connection;
/**
+ * host to connect to, use NULL to use connections one
+ */
+ host_t *other;
+
+ /**
* associated policy to initiate
*/
policy_t *policy;
@@ -71,6 +76,11 @@ static status_t execute(private_initiate_job_t *this)
this->policy->get_my_id(this->policy),
this->policy->get_other_id(this->policy));
+ if (this->other)
+ {
+ ike_sa->set_other_host(ike_sa, this->other->clone(this->other));
+ }
+
this->connection->get_ref(this->connection);
this->policy->get_ref(this->policy);
if (ike_sa->initiate(ike_sa, this->connection, this->policy) != SUCCESS)
@@ -91,13 +101,15 @@ static void destroy(private_initiate_job_t *this)
{
this->connection->destroy(this->connection);
this->policy->destroy(this->policy);
+ DESTROY_IF(this->other);
free(this);
}
/*
* Described in header
*/
-initiate_job_t *initiate_job_create(connection_t *connection, policy_t *policy)
+initiate_job_t *initiate_job_create(connection_t *connection, host_t *other,
+ policy_t *policy)
{
private_initiate_job_t *this = malloc_thing(private_initiate_job_t);
@@ -109,6 +121,7 @@ initiate_job_t *initiate_job_create(connection_t *connection, policy_t *policy)
/* private variables */
this->connection = connection;
this->policy = policy;
+ this->other = other;
return &this->public;
}