reintegrated bus-refactoring branch
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2006-2008 Tobias Brunner
|
||||
* Copyright (C) 2005-2007 Martin Willi
|
||||
* Copyright (C) 2005-2008 Martin Willi
|
||||
* Copyright (C) 2006 Daniel Roethlisberger
|
||||
* Copyright (C) 2005 Jan Hutter
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
@@ -26,12 +26,13 @@
|
||||
|
||||
#include <daemon.h>
|
||||
|
||||
ENUM(child_sa_state_names, CHILD_CREATED, CHILD_DELETING,
|
||||
ENUM(child_sa_state_names, CHILD_CREATED, CHILD_DESTROYING,
|
||||
"CREATED",
|
||||
"ROUTED",
|
||||
"INSTALLED",
|
||||
"REKEYING",
|
||||
"DELETING",
|
||||
"DESTROYING",
|
||||
);
|
||||
|
||||
typedef struct sa_policy_t sa_policy_t;
|
||||
@@ -453,11 +454,12 @@ static void updown(private_child_sa_t *this, bool up)
|
||||
*/
|
||||
static void set_state(private_child_sa_t *this, child_sa_state_t state)
|
||||
{
|
||||
this->state = state;
|
||||
if (state == CHILD_INSTALLED)
|
||||
{
|
||||
updown(this, TRUE);
|
||||
}
|
||||
charon->bus->child_state_change(charon->bus, &this->public, state);
|
||||
this->state = state;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -751,7 +753,7 @@ static status_t add_policies(private_child_sa_t *this,
|
||||
/* switch to routed state if no SAD entry set up */
|
||||
if (this->state == CHILD_CREATED)
|
||||
{
|
||||
this->state = CHILD_ROUTED;
|
||||
set_state(this, CHILD_ROUTED);
|
||||
}
|
||||
/* needed to update hosts */
|
||||
this->mode = mode;
|
||||
@@ -961,6 +963,8 @@ static void destroy(private_child_sa_t *this)
|
||||
updown(this, FALSE);
|
||||
}
|
||||
|
||||
set_state(this, CHILD_DESTROYING);
|
||||
|
||||
/* delete SAs in the kernel, if they are set up */
|
||||
if (this->me.spi)
|
||||
{
|
||||
|
||||
@@ -63,6 +63,11 @@ enum child_sa_state_t {
|
||||
* CHILD_SA in progress of delete
|
||||
*/
|
||||
CHILD_DELETING,
|
||||
|
||||
/**
|
||||
* CHILD_SA object gets destroyed
|
||||
*/
|
||||
CHILD_DESTROYING,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1160,7 +1160,7 @@ static job_requeue_t initiate_mediated(initiate_data_t *data)
|
||||
ike_sa_t *sa = charon->ike_sa_manager->checkout(charon->ike_sa_manager, waiting_sa);
|
||||
if (sa->initiate_mediated(sa, pair->local, pair->remote, checklist->connect_id) != SUCCESS)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "establishing the mediated connection failed");
|
||||
DBG1(DBG_IKE, "establishing mediated connection failed");
|
||||
charon->ike_sa_manager->checkin_and_destroy(charon->ike_sa_manager, sa);
|
||||
}
|
||||
charon->ike_sa_manager->checkin(charon->ike_sa_manager, sa);
|
||||
|
||||
+28
-34
@@ -72,12 +72,13 @@
|
||||
#define RESOLV_CONF "/etc/resolv.conf"
|
||||
#endif
|
||||
|
||||
ENUM(ike_sa_state_names, IKE_CREATED, IKE_DELETING,
|
||||
ENUM(ike_sa_state_names, IKE_CREATED, IKE_DESTROYING,
|
||||
"CREATED",
|
||||
"CONNECTING",
|
||||
"ESTABLISHED",
|
||||
"REKEYING",
|
||||
"DELETING",
|
||||
"DESTROYING",
|
||||
);
|
||||
|
||||
typedef struct private_ike_sa_t private_ike_sa_t;
|
||||
@@ -750,7 +751,7 @@ static void set_state(private_ike_sa_t *this, ike_sa_state_t state)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
charon->bus->ike_state_change(charon->bus, &this->public, state);
|
||||
this->state = state;
|
||||
}
|
||||
|
||||
@@ -1128,8 +1129,7 @@ static status_t initiate_with_reqid(private_ike_sa_t *this, child_cfg_t *child_c
|
||||
)
|
||||
{
|
||||
child_cfg->destroy(child_cfg);
|
||||
SIG_IKE(UP_START, "initiating IKE_SA");
|
||||
SIG_IKE(UP_FAILED, "unable to initiate to %%any");
|
||||
DBG1(DBG_IKE, "unable to initiate to %%any");
|
||||
return DESTROY_ME;
|
||||
}
|
||||
|
||||
@@ -1162,12 +1162,10 @@ static status_t initiate_with_reqid(private_ike_sa_t *this, child_cfg_t *child_c
|
||||
|
||||
#ifdef ME
|
||||
if (this->peer_cfg->is_mediation(this->peer_cfg))
|
||||
{
|
||||
/* mediation connection */
|
||||
if (this->state == IKE_ESTABLISHED)
|
||||
{ /* FIXME: we should try to find a better solution to this */
|
||||
SIG_CHD(UP_SUCCESS, NULL, "mediation connection is already up and running");
|
||||
}
|
||||
{ /* mediation connection is already established, retrigger state change
|
||||
* to notify bus listeners */
|
||||
DBG1(DBG_IKE, "mediation connection is already up");
|
||||
set_state(this, IKE_ESTABLISHED);
|
||||
DESTROY_IF(child_cfg);
|
||||
}
|
||||
else
|
||||
@@ -1216,9 +1214,8 @@ static status_t acquire(private_ike_sa_t *this, u_int32_t reqid)
|
||||
|
||||
if (this->state == IKE_DELETING)
|
||||
{
|
||||
SIG_CHD(UP_START, NULL, "acquiring CHILD_SA on kernel request");
|
||||
SIG_CHD(UP_FAILED, NULL, "acquiring CHILD_SA {reqid %d} failed: "
|
||||
"IKE_SA is deleting", reqid);
|
||||
DBG1(DBG_IKE, "acquiring CHILD_SA {reqid %d} failed: "
|
||||
"IKE_SA is deleting", reqid);
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
@@ -1235,9 +1232,8 @@ static status_t acquire(private_ike_sa_t *this, u_int32_t reqid)
|
||||
iterator->destroy(iterator);
|
||||
if (!child_sa)
|
||||
{
|
||||
SIG_CHD(UP_START, NULL, "acquiring CHILD_SA on kernel request");
|
||||
SIG_CHD(UP_FAILED, NULL, "acquiring CHILD_SA {reqid %d} failed: "
|
||||
"CHILD_SA not found", reqid);
|
||||
DBG1(DBG_IKE, "acquiring CHILD_SA {reqid %d} failed: "
|
||||
"CHILD_SA not found", reqid);
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
@@ -1258,8 +1254,6 @@ static status_t route(private_ike_sa_t *this, child_cfg_t *child_cfg)
|
||||
host_t *me, *other;
|
||||
status_t status;
|
||||
|
||||
SIG_CHD(ROUTE_START, NULL, "routing CHILD_SA");
|
||||
|
||||
/* check if not already routed*/
|
||||
iterator = this->child_sas->create_iterator(this->child_sas, TRUE);
|
||||
while (iterator->iterate(iterator, (void**)&child_sa))
|
||||
@@ -1268,7 +1262,7 @@ static status_t route(private_ike_sa_t *this, child_cfg_t *child_cfg)
|
||||
streq(child_sa->get_name(child_sa), child_cfg->get_name(child_cfg)))
|
||||
{
|
||||
iterator->destroy(iterator);
|
||||
SIG_CHD(ROUTE_FAILED, child_sa, "CHILD_SA with such a config already routed");
|
||||
DBG1(DBG_IKE, "routing CHILD_SA failed: already routed");
|
||||
return FAILED;
|
||||
}
|
||||
}
|
||||
@@ -1278,8 +1272,8 @@ static status_t route(private_ike_sa_t *this, child_cfg_t *child_cfg)
|
||||
{
|
||||
case IKE_DELETING:
|
||||
case IKE_REKEYING:
|
||||
SIG_CHD(ROUTE_FAILED, NULL,
|
||||
"unable to route CHILD_SA, as its IKE_SA gets deleted");
|
||||
DBG1(DBG_IKE, "routing CHILD_SA failed: IKE_SA is %N",
|
||||
ike_sa_state_names, this->state);
|
||||
return FAILED;
|
||||
case IKE_CREATED:
|
||||
case IKE_CONNECTING:
|
||||
@@ -1313,11 +1307,11 @@ static status_t route(private_ike_sa_t *this, child_cfg_t *child_cfg)
|
||||
if (status == SUCCESS)
|
||||
{
|
||||
this->child_sas->insert_last(this->child_sas, child_sa);
|
||||
SIG_CHD(ROUTE_SUCCESS, child_sa, "CHILD_SA routed");
|
||||
DBG1(DBG_IKE, "CHILD_SA routed");
|
||||
}
|
||||
else
|
||||
{
|
||||
SIG_CHD(ROUTE_FAILED, child_sa, "routing CHILD_SA failed");
|
||||
DBG1(DBG_IKE, "routing CHILD_SA failed");
|
||||
}
|
||||
return status;
|
||||
}
|
||||
@@ -1331,8 +1325,6 @@ static status_t unroute(private_ike_sa_t *this, u_int32_t reqid)
|
||||
child_sa_t *child_sa;
|
||||
bool found = FALSE;
|
||||
|
||||
SIG_CHD(UNROUTE_START, NULL, "unrouting CHILD_SA");
|
||||
|
||||
/* find CHILD_SA in ROUTED state */
|
||||
iterator = this->child_sas->create_iterator(this->child_sas, TRUE);
|
||||
while (iterator->iterate(iterator, (void**)&child_sa))
|
||||
@@ -1341,7 +1333,7 @@ static status_t unroute(private_ike_sa_t *this, u_int32_t reqid)
|
||||
child_sa->get_reqid(child_sa) == reqid)
|
||||
{
|
||||
iterator->remove(iterator);
|
||||
SIG_CHD(UNROUTE_SUCCESS, child_sa, "CHILD_SA unrouted");
|
||||
DBG1(DBG_IKE, "CHILD_SA unrouted");
|
||||
child_sa->destroy(child_sa);
|
||||
found = TRUE;
|
||||
break;
|
||||
@@ -1351,7 +1343,7 @@ static status_t unroute(private_ike_sa_t *this, u_int32_t reqid)
|
||||
|
||||
if (!found)
|
||||
{
|
||||
SIG_CHD(UNROUTE_FAILED, NULL, "CHILD_SA to unroute not found");
|
||||
DBG1(DBG_IKE, "unrouting CHILD_SA failed: reqid %d not found", reqid);
|
||||
return FAILED;
|
||||
}
|
||||
/* if we are not established, and we have no more routed childs, remove whole SA */
|
||||
@@ -1939,10 +1931,10 @@ static status_t delete_(private_ike_sa_t *this)
|
||||
this->task_manager->queue_task(this->task_manager, &ike_delete->task);
|
||||
return this->task_manager->initiate(this->task_manager);
|
||||
case IKE_CREATED:
|
||||
SIG_IKE(DOWN_SUCCESS, "deleting unestablished IKE_SA");
|
||||
DBG1(DBG_IKE, "deleting unestablished IKE_SA");
|
||||
break;
|
||||
default:
|
||||
SIG_IKE(DOWN_SUCCESS, "destroying IKE_SA in state %N "
|
||||
DBG1(DBG_IKE, "destroying IKE_SA in state %N "
|
||||
"without notification", ike_sa_state_names, this->state);
|
||||
break;
|
||||
}
|
||||
@@ -2146,19 +2138,19 @@ static status_t retransmit(private_ike_sa_t *this, u_int32_t message_id)
|
||||
this->keyingtry++;
|
||||
if (tries == 0 || tries > this->keyingtry)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "peer not responding, trying again "
|
||||
"(%d/%d) in background ", this->keyingtry + 1, tries);
|
||||
DBG1(DBG_IKE, "peer not responding, trying again (%d/%d)",
|
||||
this->keyingtry + 1, tries);
|
||||
reset(this);
|
||||
return this->task_manager->initiate(this->task_manager);
|
||||
}
|
||||
SIG_IKE(UP_FAILED, "establishing IKE_SA failed, peer not responding");
|
||||
DBG1(DBG_IKE, "establishing IKE_SA failed, peer not responding");
|
||||
break;
|
||||
}
|
||||
case IKE_DELETING:
|
||||
SIG_IKE(DOWN_FAILED, "proper IKE_SA delete failed, peer not responding");
|
||||
DBG1(DBG_IKE, "proper IKE_SA delete failed, peer not responding");
|
||||
break;
|
||||
case IKE_REKEYING:
|
||||
SIG_IKE(REKEY_FAILED, "rekeying IKE_SA failed, peer not responding");
|
||||
DBG1(DBG_IKE, "rekeying IKE_SA failed, peer not responding");
|
||||
/* FALL */
|
||||
default:
|
||||
reestablish(this);
|
||||
@@ -2485,6 +2477,8 @@ static void add_dns_server(private_ike_sa_t *this, host_t *dns)
|
||||
*/
|
||||
static void destroy(private_ike_sa_t *this)
|
||||
{
|
||||
set_state(this, IKE_DESTROYING);
|
||||
|
||||
this->child_sas->destroy_offset(this->child_sas, offsetof(child_sa_t, destroy));
|
||||
|
||||
this->task_manager->destroy(this->task_manager);
|
||||
|
||||
@@ -201,6 +201,11 @@ enum ike_sa_state_t {
|
||||
* IKE_SA is in progress of deletion
|
||||
*/
|
||||
IKE_DELETING,
|
||||
|
||||
/**
|
||||
* IKE_SA object gets destroyed
|
||||
*/
|
||||
IKE_DESTROYING,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -151,38 +151,11 @@ static void flush(private_task_manager_t *this)
|
||||
offsetof(task_t, destroy));
|
||||
this->passive_tasks->destroy_offset(this->passive_tasks,
|
||||
offsetof(task_t, destroy));
|
||||
|
||||
/* emmit outstanding signals for tasks */
|
||||
while (this->active_tasks->remove_last(this->active_tasks,
|
||||
(void**)&task) == SUCCESS)
|
||||
{
|
||||
switch (task->get_type(task))
|
||||
{
|
||||
case IKE_AUTH:
|
||||
SIG_IKE(UP_FAILED, "establishing IKE_SA failed");
|
||||
break;
|
||||
case IKE_DELETE:
|
||||
SIG_IKE(DOWN_FAILED, "IKE_SA deleted");
|
||||
break;
|
||||
case IKE_REKEY:
|
||||
SIG_IKE(REKEY_FAILED, "rekeying IKE_SA failed");
|
||||
break;
|
||||
case CHILD_CREATE:
|
||||
SIG_CHD(UP_FAILED, NULL, "establishing CHILD_SA failed");
|
||||
break;
|
||||
case CHILD_DELETE:
|
||||
SIG_CHD(DOWN_FAILED, NULL, "deleting CHILD_SA failed");
|
||||
break;
|
||||
case CHILD_REKEY:
|
||||
SIG_IKE(REKEY_FAILED, "rekeying CHILD_SA failed");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
task->destroy(task);
|
||||
}
|
||||
this->active_tasks->destroy_offset(this->active_tasks,
|
||||
offsetof(task_t, destroy));
|
||||
this->queued_tasks = linked_list_create();
|
||||
this->passive_tasks = linked_list_create();
|
||||
this->active_tasks = linked_list_create();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -648,6 +621,7 @@ static status_t build_response(private_task_manager_t *this, message_t *request)
|
||||
DESTROY_IF(this->responding.packet);
|
||||
status = this->ike_sa->generate_message(this->ike_sa, message,
|
||||
&this->responding.packet);
|
||||
charon->bus->message(charon->bus, message, FALSE);
|
||||
message->destroy(message);
|
||||
if (status != SUCCESS)
|
||||
{
|
||||
@@ -867,6 +841,7 @@ static status_t process_message(private_task_manager_t *this, message_t *msg)
|
||||
{
|
||||
if (mid == this->responding.mid)
|
||||
{
|
||||
charon->bus->message(charon->bus, msg, TRUE);
|
||||
if (process_request(this, msg) != SUCCESS)
|
||||
{
|
||||
flush(this);
|
||||
|
||||
@@ -199,12 +199,12 @@ static status_t select_and_install(private_child_create_t *this, bool no_dh)
|
||||
|
||||
if (this->proposals == NULL)
|
||||
{
|
||||
SIG_CHD(UP_FAILED, this->child_sa, "SA payload missing in message");
|
||||
DBG1(DBG_IKE, "SA payload missing in message");
|
||||
return FAILED;
|
||||
}
|
||||
if (this->tsi == NULL || this->tsr == NULL)
|
||||
{
|
||||
SIG_CHD(UP_FAILED, this->child_sa, "TS payloads missing in message");
|
||||
DBG1(DBG_IKE, "TS payloads missing in message");
|
||||
return NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ static status_t select_and_install(private_child_create_t *this, bool no_dh)
|
||||
no_dh);
|
||||
if (this->proposal == NULL)
|
||||
{
|
||||
SIG_CHD(UP_FAILED, this->child_sa, "no acceptable proposal found");
|
||||
DBG1(DBG_IKE, "no acceptable proposal found");
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
@@ -243,15 +243,15 @@ static status_t select_and_install(private_child_create_t *this, bool no_dh)
|
||||
if (this->proposal->get_algorithm(this->proposal, DIFFIE_HELLMAN_GROUP,
|
||||
&group, NULL))
|
||||
{
|
||||
SIG_CHD(UP_FAILED, this->child_sa, "DH group %N inacceptable, "
|
||||
"requesting %N", diffie_hellman_group_names, this->dh_group,
|
||||
diffie_hellman_group_names, group);
|
||||
DBG1(DBG_IKE, "DH group %N inacceptable, requesting %N",
|
||||
diffie_hellman_group_names, this->dh_group,
|
||||
diffie_hellman_group_names, group);
|
||||
this->dh_group = group;
|
||||
return INVALID_ARG;
|
||||
}
|
||||
else
|
||||
{
|
||||
SIG_CHD(UP_FAILED, this->child_sa, "no acceptable proposal found");
|
||||
DBG1(DBG_IKE, "no acceptable proposal found");
|
||||
return FAILED;
|
||||
}
|
||||
}
|
||||
@@ -279,7 +279,7 @@ static status_t select_and_install(private_child_create_t *this, bool no_dh)
|
||||
{
|
||||
my_ts->destroy_offset(my_ts, offsetof(traffic_selector_t, destroy));
|
||||
other_ts->destroy_offset(other_ts, offsetof(traffic_selector_t, destroy));
|
||||
SIG_CHD(UP_FAILED, this->child_sa, "no acceptable traffic selectors found");
|
||||
DBG1(DBG_IKE, "no acceptable traffic selectors found");
|
||||
return NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ static status_t select_and_install(private_child_create_t *this, bool no_dh)
|
||||
{
|
||||
if (this->dh->get_shared_secret(this->dh, &secret) != SUCCESS)
|
||||
{
|
||||
SIG_CHD(UP_FAILED, this->child_sa, "DH exchange incomplete");
|
||||
DBG1(DBG_IKE, "DH exchange incomplete");
|
||||
return FAILED;
|
||||
}
|
||||
DBG3(DBG_IKE, "DH secret %B", &secret);
|
||||
@@ -352,8 +352,7 @@ static status_t select_and_install(private_child_create_t *this, bool no_dh)
|
||||
this->mode, this->proposal->get_protocol(this->proposal));
|
||||
if (status != SUCCESS)
|
||||
{
|
||||
SIG_CHD(UP_FAILED, this->child_sa,
|
||||
"unable to install IPsec policies (SPD) in kernel");
|
||||
DBG1(DBG_IKE, "unable to install IPsec policies (SPD) in kernel");
|
||||
return NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -372,8 +371,7 @@ static status_t select_and_install(private_child_create_t *this, bool no_dh)
|
||||
|
||||
if (status != SUCCESS)
|
||||
{
|
||||
SIG_CHD(UP_FAILED, this->child_sa,
|
||||
"unable to install IPsec SA (SAD) in kernel");
|
||||
DBG1(DBG_IKE, "unable to install IPsec SA (SAD) in kernel");
|
||||
return FAILED;
|
||||
}
|
||||
/* add to IKE_SA, and remove from task */
|
||||
@@ -592,13 +590,13 @@ static status_t build_i(private_child_create_t *this, message_t *message)
|
||||
|
||||
if (this->reqid)
|
||||
{
|
||||
SIG_CHD(UP_START, NULL, "establishing CHILD_SA %s{%d}",
|
||||
this->config->get_name(this->config), this->reqid);
|
||||
DBG1(DBG_IKE, "establishing CHILD_SA %s{%d}",
|
||||
this->config->get_name(this->config), this->reqid);
|
||||
}
|
||||
else
|
||||
{
|
||||
SIG_CHD(UP_START, NULL, "establishing CHILD_SA %s",
|
||||
this->config->get_name(this->config));
|
||||
DBG1(DBG_IKE, "establishing CHILD_SA %s",
|
||||
this->config->get_name(this->config));
|
||||
}
|
||||
|
||||
/* reuse virtual IP if we already have one */
|
||||
@@ -650,8 +648,7 @@ static status_t build_i(private_child_create_t *this, message_t *message)
|
||||
|
||||
if (this->child_sa->alloc(this->child_sa, this->proposals) != SUCCESS)
|
||||
{
|
||||
SIG_CHD(UP_FAILED, this->child_sa,
|
||||
"unable to allocate SPIs from kernel");
|
||||
DBG1(DBG_IKE, "unable to allocate SPIs from kernel");
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
@@ -785,16 +782,15 @@ static status_t build_r(private_child_create_t *this, message_t *message)
|
||||
|
||||
if (this->ike_sa->get_state(this->ike_sa) == IKE_REKEYING)
|
||||
{
|
||||
SIG_CHD(UP_FAILED, NULL,
|
||||
"unable to create CHILD_SA while rekeying IKE_SA");
|
||||
DBG1(DBG_IKE, "unable to create CHILD_SA while rekeying IKE_SA");
|
||||
message->add_notify(message, TRUE, NO_ADDITIONAL_SAS, chunk_empty);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (this->config == NULL)
|
||||
{
|
||||
SIG_CHD(UP_FAILED, NULL, "traffic selectors %#R=== %#R inacceptable",
|
||||
this->tsr, this->tsi);
|
||||
DBG1(DBG_IKE, "traffic selectors %#R=== %#R inacceptable",
|
||||
this->tsr, this->tsi);
|
||||
message->add_notify(message, FALSE, TS_UNACCEPTABLE, chunk_empty);
|
||||
handle_child_sa_failure(this, message);
|
||||
return SUCCESS;
|
||||
@@ -813,8 +809,8 @@ static status_t build_r(private_child_create_t *this, message_t *message)
|
||||
case INTERNAL_ADDRESS_FAILURE:
|
||||
case FAILED_CP_REQUIRED:
|
||||
{
|
||||
SIG_CHD(UP_FAILED, NULL, "configuration payload negotation "
|
||||
"failed, no CHILD_SA built");
|
||||
DBG1(DBG_IKE,"configuration payload negotation "
|
||||
"failed, no CHILD_SA built");
|
||||
iterator->destroy(iterator);
|
||||
handle_child_sa_failure(this, message);
|
||||
return SUCCESS;
|
||||
@@ -870,14 +866,14 @@ static status_t build_r(private_child_create_t *this, message_t *message)
|
||||
|
||||
build_payloads(this, message);
|
||||
|
||||
SIG_CHD(UP_SUCCESS, this->child_sa, "CHILD_SA %s{%d} established "
|
||||
"with SPIs %.8x_i %.8x_o and TS %#R=== %#R",
|
||||
this->child_sa->get_name(this->child_sa),
|
||||
this->child_sa->get_reqid(this->child_sa),
|
||||
ntohl(this->child_sa->get_spi(this->child_sa, TRUE)),
|
||||
ntohl(this->child_sa->get_spi(this->child_sa, FALSE)),
|
||||
this->child_sa->get_traffic_selectors(this->child_sa, TRUE),
|
||||
this->child_sa->get_traffic_selectors(this->child_sa, FALSE));
|
||||
DBG0(DBG_IKE, "CHILD_SA %s{%d} established "
|
||||
"with SPIs %.8x_i %.8x_o and TS %#R=== %#R",
|
||||
this->child_sa->get_name(this->child_sa),
|
||||
this->child_sa->get_reqid(this->child_sa),
|
||||
ntohl(this->child_sa->get_spi(this->child_sa, TRUE)),
|
||||
ntohl(this->child_sa->get_spi(this->child_sa, FALSE)),
|
||||
this->child_sa->get_traffic_selectors(this->child_sa, TRUE),
|
||||
this->child_sa->get_traffic_selectors(this->child_sa, FALSE));
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -929,8 +925,8 @@ static status_t process_i(private_child_create_t *this, message_t *message)
|
||||
case TS_UNACCEPTABLE:
|
||||
case INVALID_SELECTORS:
|
||||
{
|
||||
SIG_CHD(UP_FAILED, this->child_sa, "received %N notify, "
|
||||
"no CHILD_SA built", notify_type_names, type);
|
||||
DBG1(DBG_IKE, "received %N notify, no CHILD_SA built",
|
||||
notify_type_names, type);
|
||||
iterator->destroy(iterator);
|
||||
handle_child_sa_failure(this, message);
|
||||
/* an error in CHILD_SA creation is not critical */
|
||||
@@ -963,35 +959,35 @@ static status_t process_i(private_child_create_t *this, message_t *message)
|
||||
|
||||
if (this->ipcomp == IPCOMP_NONE && this->ipcomp_received != IPCOMP_NONE)
|
||||
{
|
||||
SIG_CHD(UP_FAILED, this->child_sa, "received an IPCOMP_SUPPORTED notify"
|
||||
" but we did not send one previously, no CHILD_SA built");
|
||||
DBG1(DBG_IKE, "received an IPCOMP_SUPPORTED notify without requesting"
|
||||
" one, no CHILD_SA built");
|
||||
handle_child_sa_failure(this, message);
|
||||
return SUCCESS;
|
||||
}
|
||||
else if (this->ipcomp != IPCOMP_NONE && this->ipcomp_received == IPCOMP_NONE)
|
||||
{
|
||||
DBG1(DBG_IKE, "peer didn't accept our proposed IPComp transforms, "
|
||||
"IPComp is disabled");
|
||||
"IPComp is disabled");
|
||||
this->ipcomp = IPCOMP_NONE;
|
||||
}
|
||||
else if (this->ipcomp != IPCOMP_NONE && this->ipcomp != this->ipcomp_received)
|
||||
{
|
||||
SIG_CHD(UP_FAILED, this->child_sa, "received an IPCOMP_SUPPORTED notify"
|
||||
" for a transform we did not propose, no CHILD_SA built");
|
||||
DBG1(DBG_IKE, "received an IPCOMP_SUPPORTED notify we didn't propose, "
|
||||
"no CHILD_SA built");
|
||||
handle_child_sa_failure(this, message);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (select_and_install(this, no_dh) == SUCCESS)
|
||||
{
|
||||
SIG_CHD(UP_SUCCESS, this->child_sa, "CHILD_SA %s{%d} established "
|
||||
"with SPIs %.8x_i %.8x_o and TS %#R=== %#R",
|
||||
this->child_sa->get_name(this->child_sa),
|
||||
this->child_sa->get_reqid(this->child_sa),
|
||||
ntohl(this->child_sa->get_spi(this->child_sa, TRUE)),
|
||||
ntohl(this->child_sa->get_spi(this->child_sa, FALSE)),
|
||||
this->child_sa->get_traffic_selectors(this->child_sa, TRUE),
|
||||
this->child_sa->get_traffic_selectors(this->child_sa, FALSE));
|
||||
DBG0(DBG_IKE, "CHILD_SA %s{%d} established "
|
||||
"with SPIs %.8x_i %.8x_o and TS %#R=== %#R",
|
||||
this->child_sa->get_name(this->child_sa),
|
||||
this->child_sa->get_reqid(this->child_sa),
|
||||
ntohl(this->child_sa->get_spi(this->child_sa, TRUE)),
|
||||
ntohl(this->child_sa->get_spi(this->child_sa, FALSE)),
|
||||
this->child_sa->get_traffic_selectors(this->child_sa, TRUE),
|
||||
this->child_sa->get_traffic_selectors(this->child_sa, FALSE));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -222,14 +222,13 @@ static void log_children(private_child_delete_t *this)
|
||||
iterator = this->child_sas->create_iterator(this->child_sas, TRUE);
|
||||
while (iterator->iterate(iterator, (void**)&child_sa))
|
||||
{
|
||||
SIG_CHD(DOWN_START, child_sa, "closing CHILD_SA %s{%d} "
|
||||
"with SPIs %.8x_i %.8x_o and TS %#R=== %#R",
|
||||
child_sa->get_name(child_sa),
|
||||
child_sa->get_reqid(child_sa),
|
||||
ntohl(child_sa->get_spi(child_sa, TRUE)),
|
||||
ntohl(child_sa->get_spi(child_sa, FALSE)),
|
||||
child_sa->get_traffic_selectors(child_sa, TRUE),
|
||||
child_sa->get_traffic_selectors(child_sa, FALSE));
|
||||
DBG0(DBG_IKE, "closing CHILD_SA %s{%d} "
|
||||
"with SPIs %.8x_i %.8x_o and TS %#R=== %#R",
|
||||
child_sa->get_name(child_sa), child_sa->get_reqid(child_sa),
|
||||
ntohl(child_sa->get_spi(child_sa, TRUE)),
|
||||
ntohl(child_sa->get_spi(child_sa, FALSE)),
|
||||
child_sa->get_traffic_selectors(child_sa, TRUE),
|
||||
child_sa->get_traffic_selectors(child_sa, FALSE));
|
||||
}
|
||||
iterator->destroy(iterator);
|
||||
}
|
||||
@@ -254,7 +253,7 @@ static status_t process_i(private_child_delete_t *this, message_t *message)
|
||||
this->child_sas = linked_list_create();
|
||||
|
||||
process_payloads(this, message);
|
||||
SIG_CHD(DOWN_SUCCESS, NULL, "CHILD_SA closed");
|
||||
DBG1(DBG_IKE, "CHILD_SA closed");
|
||||
return destroy_and_reestablish(this);
|
||||
}
|
||||
|
||||
@@ -278,7 +277,7 @@ static status_t build_r(private_child_delete_t *this, message_t *message)
|
||||
{
|
||||
build_payloads(this, message);
|
||||
}
|
||||
SIG_CHD(DOWN_SUCCESS, NULL, "CHILD_SA closed");
|
||||
DBG1(DBG_IKE, "CHILD_SA closed");
|
||||
return destroy_and_reestablish(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -201,15 +201,15 @@ static status_t build_auth(private_ike_auth_t *this, message_t *message)
|
||||
config = this->ike_sa->get_peer_cfg(this->ike_sa);
|
||||
if (!config)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "unable to authenticate, no peer config found");
|
||||
DBG1(DBG_IKE, "unable to authenticate, no peer config found");
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
auth = authenticator_create_from_class(this->ike_sa, get_auth_class(config));
|
||||
if (auth == NULL)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "configured authentication class %N not supported",
|
||||
auth_class_names, get_auth_class(config));
|
||||
DBG1(DBG_IKE, "configured authentication class %N not supported",
|
||||
auth_class_names, get_auth_class(config));
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ static status_t build_auth(private_ike_auth_t *this, message_t *message)
|
||||
auth->destroy(auth);
|
||||
if (status != SUCCESS)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "generating authentication data failed");
|
||||
DBG1(DBG_IKE, "generating authentication data failed");
|
||||
return FAILED;
|
||||
}
|
||||
message->add_payload(message, (payload_t*)auth_payload);
|
||||
@@ -243,7 +243,7 @@ static status_t build_id(private_ike_auth_t *this, message_t *message)
|
||||
me = config->get_my_id(config);
|
||||
if (me->contains_wildcards(me))
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "negotiation of own ID failed");
|
||||
DBG1(DBG_IKE, "negotiation of own ID failed");
|
||||
return FAILED;
|
||||
}
|
||||
this->ike_sa->set_my_id(this->ike_sa, me->clone(me));
|
||||
@@ -284,8 +284,8 @@ static status_t process_auth(private_ike_auth_t *this, message_t *message)
|
||||
auth_payload->get_auth_method(auth_payload));
|
||||
if (auth == NULL)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "authentication method %N used by '%D' not "
|
||||
"supported", auth_method_names, auth_method,
|
||||
DBG1(DBG_IKE, "authentication method %N used by '%D' not supported",
|
||||
auth_method_names, auth_method,
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
return NOT_SUPPORTED;
|
||||
}
|
||||
@@ -294,7 +294,7 @@ static status_t process_auth(private_ike_auth_t *this, message_t *message)
|
||||
auth->destroy(auth);
|
||||
if (status != SUCCESS)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "authentication of '%D' with %N failed",
|
||||
DBG0(DBG_IKE, "authentication of '%D' with %N failed",
|
||||
this->ike_sa->get_other_id(this->ike_sa),
|
||||
auth_method_names, auth_method);
|
||||
return FAILED;
|
||||
@@ -315,7 +315,7 @@ static status_t process_id(private_ike_auth_t *this, message_t *message)
|
||||
|
||||
if ((this->initiator && idr == NULL) || (!this->initiator && idi == NULL))
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "ID payload missing in message");
|
||||
DBG1(DBG_IKE, "ID payload missing in message");
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ static status_t process_id(private_ike_auth_t *this, message_t *message)
|
||||
req = this->ike_sa->get_other_id(this->ike_sa);
|
||||
if (!id->matches(id, req))
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "peer ID '%D' unacceptable, '%D' required", id, req);
|
||||
DBG0(DBG_IKE, "peer ID '%D' unacceptable, '%D' required", id, req);
|
||||
id->destroy(id);
|
||||
return FAILED;
|
||||
}
|
||||
@@ -402,7 +402,7 @@ static status_t build_auth_eap(private_ike_auth_t *this, message_t *message)
|
||||
if (auth->build(auth, this->my_packet->get_data(this->my_packet),
|
||||
this->other_nonce, &auth_payload) != SUCCESS)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "generating authentication data failed");
|
||||
DBG1(DBG_IKE, "generating authentication data failed");
|
||||
if (!this->initiator)
|
||||
{
|
||||
message->add_notify(message, TRUE, AUTHENTICATION_FAILED, chunk_empty);
|
||||
@@ -413,13 +413,13 @@ static status_t build_auth_eap(private_ike_auth_t *this, message_t *message)
|
||||
if (!this->initiator)
|
||||
{
|
||||
this->ike_sa->set_state(this->ike_sa, IKE_ESTABLISHED);
|
||||
SIG_IKE(UP_SUCCESS, "IKE_SA %s[%d] established between %H[%D]...%H[%D]",
|
||||
this->ike_sa->get_name(this->ike_sa),
|
||||
this->ike_sa->get_unique_id(this->ike_sa),
|
||||
this->ike_sa->get_my_host(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_host(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
DBG0(DBG_IKE, "IKE_SA %s[%d] established between %H[%D]...%H[%D]",
|
||||
this->ike_sa->get_name(this->ike_sa),
|
||||
this->ike_sa->get_unique_id(this->ike_sa),
|
||||
this->ike_sa->get_my_host(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_host(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
return SUCCESS;
|
||||
}
|
||||
return NEED_MORE;
|
||||
@@ -448,7 +448,7 @@ static status_t process_auth_eap(private_ike_auth_t *this, message_t *message)
|
||||
|
||||
if (!this->peer_authenticated)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "authentication of '%D' with %N failed",
|
||||
DBG0(DBG_IKE, "authentication of '%D' with %N failed",
|
||||
this->ike_sa->get_other_id(this->ike_sa),
|
||||
auth_class_names, AUTH_CLASS_EAP);
|
||||
if (this->initiator)
|
||||
@@ -460,13 +460,13 @@ static status_t process_auth_eap(private_ike_auth_t *this, message_t *message)
|
||||
if (this->initiator)
|
||||
{
|
||||
this->ike_sa->set_state(this->ike_sa, IKE_ESTABLISHED);
|
||||
SIG_IKE(UP_SUCCESS, "IKE_SA %s[%d] established between %H[%D]...%H[%D]",
|
||||
this->ike_sa->get_name(this->ike_sa),
|
||||
this->ike_sa->get_unique_id(this->ike_sa),
|
||||
this->ike_sa->get_my_host(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_host(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
DBG0(DBG_IKE, "IKE_SA %s[%d] established between %H[%D]...%H[%D]",
|
||||
this->ike_sa->get_name(this->ike_sa),
|
||||
this->ike_sa->get_unique_id(this->ike_sa),
|
||||
this->ike_sa->get_my_host(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_host(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
return SUCCESS;
|
||||
}
|
||||
return NEED_MORE;
|
||||
@@ -482,7 +482,7 @@ static status_t process_eap_i(private_ike_auth_t *this, message_t *message)
|
||||
eap = (eap_payload_t*)message->get_payload(message, EXTENSIBLE_AUTHENTICATION);
|
||||
if (eap == NULL)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "EAP payload missing");
|
||||
DBG1(DBG_IKE, "EAP payload missing");
|
||||
return FAILED;
|
||||
}
|
||||
switch (this->eap_auth->process(this->eap_auth, eap, &eap))
|
||||
@@ -498,7 +498,7 @@ static status_t process_eap_i(private_ike_auth_t *this, message_t *message)
|
||||
return NEED_MORE;
|
||||
default:
|
||||
this->eap_payload = NULL;
|
||||
SIG_IKE(UP_FAILED, "failed to authenticate against '%D' using EAP",
|
||||
DBG0(DBG_IKE, "failed to authenticate against '%D' using EAP",
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
return FAILED;
|
||||
}
|
||||
@@ -533,7 +533,7 @@ static status_t build_eap_r(private_ike_auth_t *this, message_t *message)
|
||||
|
||||
if (this->eap_payload == NULL)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "EAP payload missing");
|
||||
DBG1(DBG_IKE, "EAP payload missing");
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
@@ -548,9 +548,9 @@ static status_t build_eap_r(private_ike_auth_t *this, message_t *message)
|
||||
this->public.task.process = (status_t(*)(task_t*,message_t*))process_auth_eap;
|
||||
break;
|
||||
default:
|
||||
SIG_IKE(UP_FAILED, "authentication of '%D' with %N failed",
|
||||
this->ike_sa->get_other_id(this->ike_sa),
|
||||
auth_class_names, AUTH_CLASS_EAP);
|
||||
DBG0(DBG_IKE, "authentication of '%D' with %N failed",
|
||||
this->ike_sa->get_other_id(this->ike_sa),
|
||||
auth_class_names, AUTH_CLASS_EAP);
|
||||
status = FAILED;
|
||||
break;
|
||||
}
|
||||
@@ -665,9 +665,9 @@ static status_t build_r(private_ike_auth_t *this, message_t *message)
|
||||
config = this->ike_sa->get_peer_cfg(this->ike_sa);
|
||||
if (config == NULL)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "no matching config found for '%D'...'%D'",
|
||||
this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
DBG1(DBG_IKE, "no matching config found for '%D'...'%D'",
|
||||
this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
message->add_notify(message, TRUE, AUTHENTICATION_FAILED, chunk_empty);
|
||||
return FAILED;
|
||||
}
|
||||
@@ -689,13 +689,13 @@ static status_t build_r(private_ike_auth_t *this, message_t *message)
|
||||
if (this->peer_authenticated)
|
||||
{
|
||||
this->ike_sa->set_state(this->ike_sa, IKE_ESTABLISHED);
|
||||
SIG_IKE(UP_SUCCESS, "IKE_SA %s[%d] established between %H[%D]...%H[%D]",
|
||||
this->ike_sa->get_name(this->ike_sa),
|
||||
this->ike_sa->get_unique_id(this->ike_sa),
|
||||
this->ike_sa->get_my_host(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_host(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
DBG0(DBG_IKE, "IKE_SA %s[%d] established between %H[%D]...%H[%D]",
|
||||
this->ike_sa->get_name(this->ike_sa),
|
||||
this->ike_sa->get_unique_id(this->ike_sa),
|
||||
this->ike_sa->get_my_host(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_host(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -706,7 +706,7 @@ static status_t build_r(private_ike_auth_t *this, message_t *message)
|
||||
message->add_payload(message, (payload_t*)eap_payload);
|
||||
if (status != NEED_MORE)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "unable to initiate EAP authentication");
|
||||
DBG1(DBG_IKE, "unable to initiate EAP authentication");
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
@@ -766,7 +766,7 @@ static status_t process_i(private_ike_auth_t *this, message_t *message)
|
||||
{
|
||||
if (type < 16383)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "received %N notify error",
|
||||
DBG1(DBG_IKE, "received %N notify error",
|
||||
notify_type_names, type);
|
||||
iterator->destroy(iterator);
|
||||
return FAILED;
|
||||
@@ -798,18 +798,18 @@ static status_t process_i(private_ike_auth_t *this, message_t *message)
|
||||
auth = this->ike_sa->get_other_auth(this->ike_sa);
|
||||
if (!auth->complies(auth, config->get_auth(config)))
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "authorization of '%D' for config %s failed",
|
||||
DBG0(DBG_IKE, "authorization of '%D' for config %s failed",
|
||||
this->ike_sa->get_other_id(this->ike_sa), config->get_name(config));
|
||||
return FAILED;
|
||||
}
|
||||
this->ike_sa->set_state(this->ike_sa, IKE_ESTABLISHED);
|
||||
SIG_IKE(UP_SUCCESS, "IKE_SA %s[%d] established between %H[%D]...%H[%D]",
|
||||
this->ike_sa->get_name(this->ike_sa),
|
||||
this->ike_sa->get_unique_id(this->ike_sa),
|
||||
this->ike_sa->get_my_host(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_host(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
DBG0(DBG_IKE, "IKE_SA %s[%d] established between %H[%D]...%H[%D]",
|
||||
this->ike_sa->get_name(this->ike_sa),
|
||||
this->ike_sa->get_unique_id(this->ike_sa),
|
||||
this->ike_sa->get_my_host(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_host(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,21 +56,21 @@ static status_t build_i(private_ike_delete_t *this, message_t *message)
|
||||
{
|
||||
delete_payload_t *delete_payload;
|
||||
|
||||
SIG_IKE(DOWN_START, "deleting IKE_SA %s[%d] between %H[%D]...%H[%D]",
|
||||
this->ike_sa->get_name(this->ike_sa),
|
||||
this->ike_sa->get_unique_id(this->ike_sa),
|
||||
this->ike_sa->get_my_host(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_host(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
DBG0(DBG_IKE, "deleting IKE_SA %s[%d] between %H[%D]...%H[%D]",
|
||||
this->ike_sa->get_name(this->ike_sa),
|
||||
this->ike_sa->get_unique_id(this->ike_sa),
|
||||
this->ike_sa->get_my_host(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_host(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
|
||||
delete_payload = delete_payload_create(PROTO_IKE);
|
||||
message->add_payload(message, (payload_t*)delete_payload);
|
||||
this->ike_sa->set_state(this->ike_sa, IKE_DELETING);
|
||||
|
||||
DBG1(DBG_IKE, "sending DELETE for IKE_SA %s[%d]",
|
||||
this->ike_sa->get_name(this->ike_sa),
|
||||
this->ike_sa->get_unique_id(this->ike_sa));
|
||||
this->ike_sa->get_name(this->ike_sa),
|
||||
this->ike_sa->get_unique_id(this->ike_sa));
|
||||
|
||||
return NEED_MORE;
|
||||
}
|
||||
@@ -92,15 +92,15 @@ static status_t process_r(private_ike_delete_t *this, message_t *message)
|
||||
/* we don't even scan the payloads, as the message wouldn't have
|
||||
* come so far without being correct */
|
||||
DBG1(DBG_IKE, "received DELETE for IKE_SA %s[%d]",
|
||||
this->ike_sa->get_name(this->ike_sa),
|
||||
this->ike_sa->get_unique_id(this->ike_sa));
|
||||
SIG_IKE(DOWN_START, "deleting IKE_SA %s[%d] between %H[%D]...%H[%D]",
|
||||
this->ike_sa->get_name(this->ike_sa),
|
||||
this->ike_sa->get_unique_id(this->ike_sa),
|
||||
this->ike_sa->get_my_host(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_host(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
this->ike_sa->get_name(this->ike_sa),
|
||||
this->ike_sa->get_unique_id(this->ike_sa));
|
||||
DBG1(DBG_IKE, "deleting IKE_SA %s[%d] between %H[%D]...%H[%D]",
|
||||
this->ike_sa->get_name(this->ike_sa),
|
||||
this->ike_sa->get_unique_id(this->ike_sa),
|
||||
this->ike_sa->get_my_host(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_host(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
|
||||
switch (this->ike_sa->get_state(this->ike_sa))
|
||||
{
|
||||
@@ -123,7 +123,7 @@ static status_t process_r(private_ike_delete_t *this, message_t *message)
|
||||
*/
|
||||
static status_t build_r(private_ike_delete_t *this, message_t *message)
|
||||
{
|
||||
SIG_IKE(DOWN_SUCCESS, "IKE_SA deleted");
|
||||
DBG1(DBG_IKE, "IKE_SA deleted");
|
||||
|
||||
if (this->simultaneous)
|
||||
{
|
||||
|
||||
@@ -230,15 +230,15 @@ static status_t build_i(private_ike_init_t *this, message_t *message)
|
||||
rng_t *rng;
|
||||
|
||||
this->config = this->ike_sa->get_ike_cfg(this->ike_sa);
|
||||
SIG_IKE(UP_START, "initiating IKE_SA %s[%d] to %H",
|
||||
this->ike_sa->get_name(this->ike_sa),
|
||||
this->ike_sa->get_unique_id(this->ike_sa),
|
||||
this->ike_sa->get_other_host(this->ike_sa));
|
||||
DBG1(DBG_IKE, "initiating IKE_SA %s[%d] to %H",
|
||||
this->ike_sa->get_name(this->ike_sa),
|
||||
this->ike_sa->get_unique_id(this->ike_sa),
|
||||
this->ike_sa->get_other_host(this->ike_sa));
|
||||
this->ike_sa->set_state(this->ike_sa, IKE_CONNECTING);
|
||||
|
||||
if (this->retry++ >= MAX_RETRIES)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "giving up after %d retries", MAX_RETRIES);
|
||||
DBG1(DBG_IKE, "giving up after %d retries", MAX_RETRIES);
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ static status_t build_i(private_ike_init_t *this, message_t *message)
|
||||
this->dh = lib->crypto->create_dh(lib->crypto, this->dh_group);
|
||||
if (this->dh == NULL)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "configured DH group %N not supported",
|
||||
DBG1(DBG_IKE, "configured DH group %N not supported",
|
||||
diffie_hellman_group_names, this->dh_group);
|
||||
return FAILED;
|
||||
}
|
||||
@@ -261,7 +261,7 @@ static status_t build_i(private_ike_init_t *this, message_t *message)
|
||||
rng = lib->crypto->create_rng(lib->crypto, RNG_WEAK);
|
||||
if (!rng)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "error generating nonce");
|
||||
DBG1(DBG_IKE, "error generating nonce");
|
||||
return FAILED;
|
||||
}
|
||||
rng->allocate_bytes(rng, NONCE_SIZE, &this->my_nonce);
|
||||
@@ -296,8 +296,7 @@ static status_t process_r(private_ike_init_t *this, message_t *message)
|
||||
rng_t *rng;
|
||||
|
||||
this->config = this->ike_sa->get_ike_cfg(this->ike_sa);
|
||||
SIG_IKE(UP_START, "%H is initiating an IKE_SA",
|
||||
message->get_source(message));
|
||||
DBG1(DBG_IKE, "%H is initiating an IKE_SA", message->get_source(message));
|
||||
this->ike_sa->set_state(this->ike_sa, IKE_CONNECTING);
|
||||
|
||||
rng = lib->crypto->create_rng(lib->crypto, RNG_WEAK);
|
||||
@@ -376,7 +375,7 @@ static status_t build_r(private_ike_init_t *this, message_t *message)
|
||||
if (this->proposal == NULL ||
|
||||
this->other_nonce.len == 0 || this->my_nonce.len == 0)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "received proposals inacceptable");
|
||||
DBG1(DBG_IKE, "received proposals inacceptable");
|
||||
message->add_notify(message, TRUE, NO_PROPOSAL_CHOSEN, chunk_empty);
|
||||
return FAILED;
|
||||
}
|
||||
@@ -390,9 +389,9 @@ static status_t build_r(private_ike_init_t *this, message_t *message)
|
||||
if (this->proposal->get_algorithm(this->proposal, DIFFIE_HELLMAN_GROUP,
|
||||
&group, NULL))
|
||||
{
|
||||
SIG_CHD(UP_FAILED, NULL, "DH group %N inacceptable, requesting %N",
|
||||
diffie_hellman_group_names, this->dh_group,
|
||||
diffie_hellman_group_names, group);
|
||||
DBG1(DBG_IKE, "DH group %N inacceptable, requesting %N",
|
||||
diffie_hellman_group_names, this->dh_group,
|
||||
diffie_hellman_group_names, group);
|
||||
this->dh_group = group;
|
||||
group = htons(group);
|
||||
message->add_notify(message, FALSE, INVALID_KE_PAYLOAD,
|
||||
@@ -400,7 +399,7 @@ static status_t build_r(private_ike_init_t *this, message_t *message)
|
||||
}
|
||||
else
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "no acceptable proposal found");
|
||||
DBG1(DBG_IKE, "no acceptable proposal found");
|
||||
}
|
||||
return FAILED;
|
||||
}
|
||||
@@ -430,7 +429,7 @@ static status_t build_r(private_ike_init_t *this, message_t *message)
|
||||
}
|
||||
if (status != SUCCESS)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "key derivation failed");
|
||||
DBG1(DBG_IKE, "key derivation failed");
|
||||
message->add_notify(message, TRUE, NO_PROPOSAL_CHOSEN, chunk_empty);
|
||||
return FAILED;
|
||||
}
|
||||
@@ -505,7 +504,7 @@ static status_t process_i(private_ike_init_t *this, message_t *message)
|
||||
{
|
||||
if (type < 16383)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "received %N notify error",
|
||||
DBG1(DBG_IKE, "received %N notify error",
|
||||
notify_type_names, type);
|
||||
iterator->destroy(iterator);
|
||||
return FAILED;
|
||||
@@ -525,7 +524,7 @@ static status_t process_i(private_ike_init_t *this, message_t *message)
|
||||
if (this->proposal == NULL ||
|
||||
this->other_nonce.len == 0 || this->my_nonce.len == 0)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "peer's proposal selection invalid");
|
||||
DBG1(DBG_IKE, "peers proposal selection invalid");
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
@@ -533,7 +532,7 @@ static status_t process_i(private_ike_init_t *this, message_t *message)
|
||||
!this->proposal->has_dh_group(this->proposal, this->dh_group) ||
|
||||
this->dh->get_shared_secret(this->dh, &secret) != SUCCESS)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "peer's DH group selection invalid");
|
||||
DBG1(DBG_IKE, "peer DH group selection invalid");
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
@@ -562,7 +561,7 @@ static status_t process_i(private_ike_init_t *this, message_t *message)
|
||||
}
|
||||
if (status != SUCCESS)
|
||||
{
|
||||
SIG_IKE(UP_FAILED, "key derivation failed");
|
||||
DBG1(DBG_IKE, "key derivation failed");
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
|
||||
@@ -461,8 +461,7 @@ static status_t process_i(private_ike_me_t *this, message_t *message)
|
||||
this->ike_sa->set_server_reflexive_host(this->ike_sa, endpoint->clone(endpoint));
|
||||
}
|
||||
/* FIXME: what if it failed? e.g. AUTH failure */
|
||||
SIG_CHD(UP_SUCCESS, NULL, "established mediation connection "
|
||||
"without CHILD_SA successfully");
|
||||
DBG1(DBG_IKE, "established mediation connection successfully");
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -642,8 +641,7 @@ static status_t build_r_ms(private_ike_me_t *this, message_t *message)
|
||||
/* FIXME: we actually must delete any existing IKE_SAs with the same remote id */
|
||||
this->ike_sa->act_as_mediation_server(this->ike_sa);
|
||||
|
||||
SIG_CHD(UP_SUCCESS, NULL, "established mediation connection "
|
||||
"without CHILD_SA successfully");
|
||||
DBG1(DBG_IKE, "established mediation connection successfully");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,6 @@ static status_t process_i(private_ike_reauth_t *this, message_t *message)
|
||||
|
||||
/* process delete response first */
|
||||
this->ike_delete->task.process(&this->ike_delete->task, message);
|
||||
SIG_IKE(DOWN_SUCCESS, "IKE_SA deleted");
|
||||
|
||||
peer_cfg = this->ike_sa->get_peer_cfg(this->ike_sa);
|
||||
|
||||
|
||||
@@ -152,13 +152,13 @@ static status_t build_r(private_ike_rekey_t *this, message_t *message)
|
||||
|
||||
this->ike_sa->set_state(this->ike_sa, IKE_REKEYING);
|
||||
this->new_sa->set_state(this->new_sa, IKE_ESTABLISHED);
|
||||
SIG_IKE(UP_SUCCESS, "IKE_SA %s[%d] established between %H[%D]...%H[%D]",
|
||||
this->new_sa->get_name(this->new_sa),
|
||||
this->new_sa->get_unique_id(this->new_sa),
|
||||
this->ike_sa->get_my_host(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_host(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
DBG0(DBG_IKE, "IKE_SA %s[%d] established between %H[%D]...%H[%D]",
|
||||
this->new_sa->get_name(this->new_sa),
|
||||
this->new_sa->get_unique_id(this->new_sa),
|
||||
this->ike_sa->get_my_host(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_host(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -198,13 +198,13 @@ static status_t process_i(private_ike_rekey_t *this, message_t *message)
|
||||
}
|
||||
|
||||
this->new_sa->set_state(this->new_sa, IKE_ESTABLISHED);
|
||||
SIG_IKE(UP_SUCCESS, "IKE_SA %s[%d] established between %H[%D]...%H[%D]",
|
||||
this->new_sa->get_name(this->new_sa),
|
||||
this->new_sa->get_unique_id(this->new_sa),
|
||||
this->ike_sa->get_my_host(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_host(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
DBG0(DBG_IKE, "IKE_SA %s[%d] established between %H[%D]...%H[%D]",
|
||||
this->new_sa->get_name(this->new_sa),
|
||||
this->new_sa->get_unique_id(this->new_sa),
|
||||
this->ike_sa->get_my_host(this->ike_sa),
|
||||
this->ike_sa->get_my_id(this->ike_sa),
|
||||
this->ike_sa->get_other_host(this->ike_sa),
|
||||
this->ike_sa->get_other_id(this->ike_sa));
|
||||
|
||||
to_delete = this->ike_sa->get_id(this->ike_sa);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user