some more changes to IKE_SA and CHILD_SA logging

This commit is contained in:
Andreas Steffen
2008-07-22 17:10:10 +00:00
parent f7198e7e8c
commit 51c8f8261f
6 changed files with 46 additions and 22 deletions
+3 -3
View File
@@ -645,8 +645,8 @@ static ike_sa_state_t get_state(private_ike_sa_t *this)
*/
static void set_state(private_ike_sa_t *this, ike_sa_state_t state)
{
DBG1(DBG_IKE, "IKE_SA '%s' state change: %N => %N",
get_name(this),
DBG1(DBG_IKE, "IKE_SA %s[%d] state change: %N => %N",
get_name(this), this->unique_id,
ike_sa_state_names, this->state,
ike_sa_state_names, state);
@@ -2037,7 +2037,7 @@ static status_t reestablish(private_ike_sa_t *this)
switch (action)
{
case ACTION_RESTART:
DBG1(DBG_IKE, "restarting CHILD_SA '%s'",
DBG1(DBG_IKE, "restarting CHILD_SA %s",
child_cfg->get_name(child_cfg));
child_cfg->get_ref(child_cfg);
status = new->initiate(new, child_cfg);
+18 -6
View File
@@ -590,8 +590,16 @@ static status_t build_i(private_child_create_t *this, message_t *message)
break;
}
SIG_CHD(UP_START, NULL, "establishing CHILD_SA '%s'",
this->config->get_name(this->config));
if (this->reqid)
{
SIG_CHD(UP_START, NULL, "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));
}
/* reuse virtual IP if we already have one */
me = this->ike_sa->get_virtual_ip(this->ike_sa, TRUE);
@@ -862,10 +870,12 @@ 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 ts %#R=== %#R",
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));
@@ -974,10 +984,12 @@ static status_t process_i(private_child_create_t *this, message_t *message)
if (select_and_install(this, no_dh) == SUCCESS)
{
SIG_CHD(UP_SUCCESS, this->child_sa, "CHILD_SA '%s{%d}' established "
"with ts %#R=== %#R",
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));
}
+13 -6
View File
@@ -54,16 +54,17 @@ struct private_child_delete_t {
*/
static void build_payloads(private_child_delete_t *this, message_t *message)
{
iterator_t *iterator;
delete_payload_t *ah = NULL, *esp = NULL;
u_int32_t spi;
iterator_t *iterator;
child_sa_t *child_sa;
iterator = this->child_sas->create_iterator(this->child_sas, TRUE);
while (iterator->iterate(iterator, (void**)&child_sa))
{
spi = child_sa->get_spi(child_sa, TRUE);
switch (child_sa->get_protocol(child_sa))
protocol_id_t protocol = child_sa->get_protocol(child_sa);
u_int32_t spi = child_sa->get_spi(child_sa, TRUE);
switch (protocol)
{
case PROTO_ESP:
if (esp == NULL)
@@ -72,6 +73,8 @@ static void build_payloads(private_child_delete_t *this, message_t *message)
message->add_payload(message, (payload_t*)esp);
}
esp->add_spi(esp, spi);
DBG1(DBG_IKE, "sending DELETE for %N CHILD_SA with SPI %.8x",
protocol_id_names, protocol, ntohl(spi));
break;
case PROTO_AH:
if (ah == NULL)
@@ -80,6 +83,8 @@ static void build_payloads(private_child_delete_t *this, message_t *message)
message->add_payload(message, (payload_t*)ah);
}
ah->add_spi(ah, spi);
DBG1(DBG_IKE, "sending DELETE for %N CHILD_SA with SPI %.8x",
protocol_id_names, protocol, ntohl(spi));
break;
default:
break;
@@ -207,10 +212,12 @@ 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 ts %#R=== %#R",
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));
}
+4 -4
View File
@@ -377,7 +377,7 @@ 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]",
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),
@@ -424,7 +424,7 @@ 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]",
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),
@@ -651,7 +651,7 @@ 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]",
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),
@@ -765,7 +765,7 @@ static status_t process_i(private_ike_auth_t *this, message_t *message)
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]",
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),
+6 -2
View File
@@ -60,7 +60,9 @@ static status_t build_i(private_ike_delete_t *this, message_t *message)
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));
return NEED_MORE;
}
@@ -83,7 +85,9 @@ static status_t process_r(private_ike_delete_t *this, message_t *message)
switch (this->ike_sa->get_state(this->ike_sa))
{
case IKE_ESTABLISHED:
DBG1(DBG_IKE, "deleting IKE_SA on request");
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));
this->ike_sa->set_state(this->ike_sa, IKE_DELETING);
this->ike_sa->reestablish(this->ike_sa);
break;
+2 -1
View File
@@ -230,8 +230,9 @@ 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' to %H",
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));
this->ike_sa->set_state(this->ike_sa, IKE_CONNECTING);