From 9fe14f4b8a3ae487134854eb8ebdfcb49cea4027 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Mon, 29 May 2006 11:09:45 +0000 Subject: - 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 --- src/charon/sa/states/initiator_init.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'src/charon/sa/states/initiator_init.c') 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); -- cgit v1.2.3