aboutsummaryrefslogtreecommitdiffstats
path: root/src/charon/sa/states/initiator_init.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2006-05-29 11:09:45 +0000
committerMartin Willi <martin@strongswan.org>2006-05-29 11:09:45 +0000
commit9fe14f4b8a3ae487134854eb8ebdfcb49cea4027 (patch)
treeefc4aa1a147e18e3b24b53e0d917e12e0b9a5cde /src/charon/sa/states/initiator_init.c
parent4c59264d9b73d8eb2b29189cacd9ff3b60e2ec13 (diff)
downloadstrongswan-9fe14f4b8a3ae487134854eb8ebdfcb49cea4027.tar.bz2
strongswan-9fe14f4b8a3ae487134854eb8ebdfcb49cea4027.tar.xz
- policies contain a connections name now
- used for initiate and delete - connections won't get initiated twice anymore - deleting of connections is now possible, which allows us to use ipsec update and ipsec reload
Diffstat (limited to 'src/charon/sa/states/initiator_init.c')
-rw-r--r--src/charon/sa/states/initiator_init.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/charon/sa/states/initiator_init.c b/src/charon/sa/states/initiator_init.c
index 4837ad1a1..8aa5bad98 100644
--- a/src/charon/sa/states/initiator_init.c
+++ b/src/charon/sa/states/initiator_init.c
@@ -113,30 +113,32 @@ static status_t initiate_connection (private_initiator_init_t *this, connection_
diffie_hellman_group_t dh_group;
host_t *my_host, *other_host;
identification_t *my_id, *other_id;
+ char *name;
- my_host = connection->get_my_host(connection);
- other_host = connection->get_other_host(connection);
- my_id = connection->get_my_id(connection);
- other_id = connection->get_other_id(connection);
-
- this->logger->log(this->logger, CONTROL, "initiating connection \"%s\": %s[%s]...%s[%s]",
- connection->get_name(connection),
- my_host->get_address(my_host),
- my_id->get_string(my_id),
- other_host->get_address(other_host),
- other_id->get_string(other_id));
-
+ name = connection->get_name(connection);
this->ike_sa->set_connection(this->ike_sa, connection);
/* get policy */
- policy = charon->policies->get_policy(charon->policies, my_id, other_id);
+ policy = charon->policies->get_policy_by_name(charon->policies, name);
if (policy == NULL)
{
- this->logger->log(this->logger, ERROR | LEVEL1, "could not get a policy for '%s...%s', aborting",
- my_id->get_string(my_id), other_id->get_string(other_id));
+ this->logger->log(this->logger, ERROR | LEVEL1,
+ "could not get a policy named '%s', aborting", name);
return DESTROY_ME;
}
- this->ike_sa->set_policy(this->ike_sa,policy);
+ this->ike_sa->set_policy(this->ike_sa, policy);
+
+ my_host = connection->get_my_host(connection);
+ other_host = connection->get_other_host(connection);
+ my_id = policy->get_my_id(policy);
+ other_id = policy->get_other_id(policy);
+
+ this->logger->log(this->logger, CONTROL, "initiating connection \"%s\": %s[%s]...%s[%s]",
+ name,
+ my_host->get_address(my_host),
+ my_id->get_string(my_id),
+ other_host->get_address(other_host),
+ other_id->get_string(other_id));
/* we must guess now a DH group. For that we choose our most preferred group */
dh_group = connection->get_dh_group(connection);