consistent logging of IKE and CHILD SAs

This commit is contained in:
Andreas Steffen
2008-07-21 12:47:59 +00:00
parent 0a625fde3e
commit fb34475b5c
5 changed files with 42 additions and 26 deletions
+3 -3
View File
@@ -577,7 +577,7 @@ static void process_acquire(private_kernel_interface_t *this, struct nlmsghdr *h
return; return;
} }
DBG2(DBG_KNL, "received a XFRM_MSG_ACQUIRE"); DBG2(DBG_KNL, "received a XFRM_MSG_ACQUIRE");
DBG1(DBG_KNL, "creating acquire job for CHILD_SA with reqid %d", reqid); DBG1(DBG_KNL, "creating acquire job for CHILD_SA with {reqid %d}", reqid);
job = (job_t*)acquire_job_create(reqid); job = (job_t*)acquire_job_create(reqid);
charon->processor->queue_job(charon->processor, job); charon->processor->queue_job(charon->processor, job);
} }
@@ -601,12 +601,12 @@ static void process_expire(private_kernel_interface_t *this, struct nlmsghdr *hd
if (protocol != PROTO_ESP && protocol != PROTO_AH) if (protocol != PROTO_ESP && protocol != PROTO_AH)
{ {
DBG2(DBG_KNL, "ignoring XFRM_MSG_EXPIRE for SA 0x%x (reqid %d) which is " DBG2(DBG_KNL, "ignoring XFRM_MSG_EXPIRE for SA 0x%x {reqid %d} which is "
"not a CHILD_SA", ntohl(spi), reqid); "not a CHILD_SA", ntohl(spi), reqid);
return; return;
} }
DBG1(DBG_KNL, "creating %s job for %N CHILD_SA 0x%x (reqid %d)", DBG1(DBG_KNL, "creating %s job for %N CHILD_SA 0x%x {reqid %d}",
expire->hard ? "delete" : "rekey", protocol_id_names, expire->hard ? "delete" : "rekey", protocol_id_names,
protocol, ntohl(spi), reqid); protocol, ntohl(spi), reqid);
if (expire->hard) if (expire->hard)
+3 -3
View File
@@ -1176,7 +1176,7 @@ static status_t acquire(private_ike_sa_t *this, u_int32_t reqid)
if (this->state == IKE_DELETING) if (this->state == IKE_DELETING)
{ {
SIG_CHD(UP_START, NULL, "acquiring CHILD_SA on kernel request"); SIG_CHD(UP_START, NULL, "acquiring CHILD_SA on kernel request");
SIG_CHD(UP_FAILED, NULL, "acquiring CHILD_SA (reqid %d) failed: " SIG_CHD(UP_FAILED, NULL, "acquiring CHILD_SA {reqid %d} failed: "
"IKE_SA is deleting", reqid); "IKE_SA is deleting", reqid);
return FAILED; return FAILED;
} }
@@ -1195,7 +1195,7 @@ static status_t acquire(private_ike_sa_t *this, u_int32_t reqid)
if (!child_sa) if (!child_sa)
{ {
SIG_CHD(UP_START, NULL, "acquiring CHILD_SA on kernel request"); SIG_CHD(UP_START, NULL, "acquiring CHILD_SA on kernel request");
SIG_CHD(UP_FAILED, NULL, "acquiring CHILD_SA (reqid %d) failed: " SIG_CHD(UP_FAILED, NULL, "acquiring CHILD_SA {reqid %d} failed: "
"CHILD_SA not found", reqid); "CHILD_SA not found", reqid);
return FAILED; return FAILED;
} }
@@ -2037,7 +2037,7 @@ static status_t reestablish(private_ike_sa_t *this)
switch (action) switch (action)
{ {
case ACTION_RESTART: 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_name(child_cfg));
child_cfg->get_ref(child_cfg); child_cfg->get_ref(child_cfg);
status = new->initiate(new, child_cfg); status = new->initiate(new, child_cfg);
+14 -5
View File
@@ -590,7 +590,8 @@ static status_t build_i(private_child_create_t *this, message_t *message)
break; break;
} }
SIG_CHD(UP_START, NULL, "establishing CHILD_SA"); SIG_CHD(UP_START, NULL, "establishing CHILD_SA '%s'",
this->config->get_name(this->config));
/* reuse virtual IP if we already have one */ /* reuse virtual IP if we already have one */
me = this->ike_sa->get_virtual_ip(this->ike_sa, TRUE); me = this->ike_sa->get_virtual_ip(this->ike_sa, TRUE);
@@ -861,8 +862,12 @@ static status_t build_r(private_child_create_t *this, message_t *message)
build_payloads(this, message); build_payloads(this, message);
SIG_CHD(UP_SUCCESS, this->child_sa, "CHILD_SA '%s' established successfully", SIG_CHD(UP_SUCCESS, this->child_sa, "CHILD_SA '%s{%d}' established "
this->child_sa->get_name(this->child_sa)); "with ts %#R=== %#R",
this->child_sa->get_name(this->child_sa),
this->child_sa->get_reqid(this->child_sa),
this->child_sa->get_traffic_selectors(this->child_sa, TRUE),
this->child_sa->get_traffic_selectors(this->child_sa, FALSE));
return SUCCESS; return SUCCESS;
} }
@@ -969,8 +974,12 @@ static status_t process_i(private_child_create_t *this, message_t *message)
if (select_and_install(this, no_dh) == SUCCESS) if (select_and_install(this, no_dh) == SUCCESS)
{ {
SIG_CHD(UP_SUCCESS, this->child_sa, "CHILD_SA '%s' established " SIG_CHD(UP_SUCCESS, this->child_sa, "CHILD_SA '%s{%d}' established "
"successfully", this->child_sa->get_name(this->child_sa)); "with ts %#R=== %#R",
this->child_sa->get_name(this->child_sa),
this->child_sa->get_reqid(this->child_sa),
this->child_sa->get_traffic_selectors(this->child_sa, TRUE),
this->child_sa->get_traffic_selectors(this->child_sa, FALSE));
} }
else else
{ {
+6 -3
View File
@@ -207,9 +207,12 @@ static void log_children(private_child_delete_t *this)
iterator = this->child_sas->create_iterator(this->child_sas, TRUE); iterator = this->child_sas->create_iterator(this->child_sas, TRUE);
while (iterator->iterate(iterator, (void**)&child_sa)) while (iterator->iterate(iterator, (void**)&child_sa))
{ {
SIG_CHD(DOWN_START, child_sa, "closing CHILD_SA %#R=== %#R", SIG_CHD(DOWN_START, child_sa, "closing CHILD_SA '%s{%d}' "
child_sa->get_traffic_selectors(child_sa, TRUE), "with ts %#R=== %#R",
child_sa->get_traffic_selectors(child_sa, FALSE)); child_sa->get_name(child_sa),
child_sa->get_reqid(child_sa),
child_sa->get_traffic_selectors(child_sa, TRUE),
child_sa->get_traffic_selectors(child_sa, FALSE));
} }
iterator->destroy(iterator); iterator->destroy(iterator);
} }
+16 -12
View File
@@ -377,12 +377,13 @@ static status_t build_auth_eap(private_ike_auth_t *this, message_t *message)
if (!this->initiator) if (!this->initiator)
{ {
this->ike_sa->set_state(this->ike_sa, IKE_ESTABLISHED); this->ike_sa->set_state(this->ike_sa, IKE_ESTABLISHED);
SIG_IKE(UP_SUCCESS, "IKE_SA '%s' established between %H[%D]...[%D]%H", 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_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_host(this->ike_sa),
this->ike_sa->get_my_id(this->ike_sa), this->ike_sa->get_my_id(this->ike_sa),
this->ike_sa->get_other_id(this->ike_sa), this->ike_sa->get_other_host(this->ike_sa),
this->ike_sa->get_other_host(this->ike_sa)); this->ike_sa->get_other_id(this->ike_sa));
return SUCCESS; return SUCCESS;
} }
return NEED_MORE; return NEED_MORE;
@@ -423,12 +424,13 @@ static status_t process_auth_eap(private_ike_auth_t *this, message_t *message)
if (this->initiator) if (this->initiator)
{ {
this->ike_sa->set_state(this->ike_sa, IKE_ESTABLISHED); this->ike_sa->set_state(this->ike_sa, IKE_ESTABLISHED);
SIG_IKE(UP_SUCCESS, "IKE_SA '%s' established between %H[%D]...[%D]%H", 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_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_host(this->ike_sa),
this->ike_sa->get_my_id(this->ike_sa), this->ike_sa->get_my_id(this->ike_sa),
this->ike_sa->get_other_id(this->ike_sa), this->ike_sa->get_other_host(this->ike_sa),
this->ike_sa->get_other_host(this->ike_sa)); this->ike_sa->get_other_id(this->ike_sa));
return SUCCESS; return SUCCESS;
} }
return NEED_MORE; return NEED_MORE;
@@ -649,12 +651,13 @@ static status_t build_r(private_ike_auth_t *this, message_t *message)
if (this->peer_authenticated) if (this->peer_authenticated)
{ {
this->ike_sa->set_state(this->ike_sa, IKE_ESTABLISHED); this->ike_sa->set_state(this->ike_sa, IKE_ESTABLISHED);
SIG_IKE(UP_SUCCESS, "IKE_SA '%s' established between %H[%D]...[%D]%H", 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_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_host(this->ike_sa),
this->ike_sa->get_my_id(this->ike_sa), this->ike_sa->get_my_id(this->ike_sa),
this->ike_sa->get_other_id(this->ike_sa), this->ike_sa->get_other_host(this->ike_sa),
this->ike_sa->get_other_host(this->ike_sa)); this->ike_sa->get_other_id(this->ike_sa));
return SUCCESS; return SUCCESS;
} }
@@ -762,12 +765,13 @@ static status_t process_i(private_ike_auth_t *this, message_t *message)
return FAILED; return FAILED;
} }
this->ike_sa->set_state(this->ike_sa, IKE_ESTABLISHED); this->ike_sa->set_state(this->ike_sa, IKE_ESTABLISHED);
SIG_IKE(UP_SUCCESS, "IKE_SA '%s' established between %H[%D]...[%D]%H", 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_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_host(this->ike_sa),
this->ike_sa->get_my_id(this->ike_sa), this->ike_sa->get_my_id(this->ike_sa),
this->ike_sa->get_other_id(this->ike_sa), this->ike_sa->get_other_host(this->ike_sa),
this->ike_sa->get_other_host(this->ike_sa)); this->ike_sa->get_other_id(this->ike_sa));
return SUCCESS; return SUCCESS;
} }