reintegrated bus-refactoring branch
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user