Add alerts for sent/received message retransmissions and timeout

This commit is contained in:
Martin Willi
2012-11-29 10:22:51 +01:00
parent 93ceaa7e64
commit 3c79b7b7db
3 changed files with 14 additions and 0 deletions
+6
View File
@@ -99,6 +99,12 @@ enum alert_t {
/** received IKE message with invalid body, argument is message_t*,
* followed by a status_t result returned by message_t.parse_body(). */
ALERT_PARSE_ERROR_BODY,
/** sending a retransmit for a message, argument is packet_t */
ALERT_RETRANSMIT_SEND,
/** sending retransmits timed out, argument is packet_t */
ALERT_RETRANSMIT_SEND_TIMEOUT,
/** received a retransmit for a message, argument is message_t */
ALERT_RETRANSMIT_RECEIVE,
};
/**
+3
View File
@@ -293,6 +293,7 @@ static status_t retransmit_packet(private_task_manager_t *this, u_int32_t seqnr,
if (retransmitted > this->retransmit_tries)
{
DBG1(DBG_IKE, "giving up after %u retransmits", retransmitted - 1);
charon->bus->alert(charon->bus, ALERT_RETRANSMIT_SEND_TIMEOUT, packet);
return DESTROY_ME;
}
t = (u_int32_t)(this->retransmit_timeout * 1000.0 *
@@ -302,6 +303,7 @@ static status_t retransmit_packet(private_task_manager_t *this, u_int32_t seqnr,
DBG1(DBG_IKE, "sending retransmit %u of %s message ID %u, seq %u",
retransmitted, seqnr < RESPONDING_SEQ ? "request" : "response",
mid, seqnr < RESPONDING_SEQ ? seqnr : seqnr - RESPONDING_SEQ);
charon->bus->alert(charon->bus, ALERT_RETRANSMIT_SEND, packet);
}
charon->sender->send(charon->sender, packet->clone(packet));
lib->scheduler->schedule_job_ms(lib->scheduler, (job_t*)
@@ -1167,6 +1169,7 @@ METHOD(task_manager_t, process_message, status_t,
DBG1(DBG_IKE, "received retransmit of request with ID %u, "
"but no response to retransmit", mid);
}
charon->bus->alert(charon->bus, ALERT_RETRANSMIT_RECEIVE, msg);
return SUCCESS;
}
if (msg->get_exchange_type(msg) == TRANSACTION &&
+5
View File
@@ -257,6 +257,8 @@ METHOD(task_manager_t, retransmit, status_t,
{
DBG1(DBG_IKE, "giving up after %d retransmits",
this->initiating.retransmitted - 1);
charon->bus->alert(charon->bus, ALERT_RETRANSMIT_SEND_TIMEOUT,
this->initiating.packet);
return DESTROY_ME;
}
@@ -264,6 +266,8 @@ METHOD(task_manager_t, retransmit, status_t,
{
DBG1(DBG_IKE, "retransmit %d of request with message ID %d",
this->initiating.retransmitted, message_id);
charon->bus->alert(charon->bus, ALERT_RETRANSMIT_SEND,
this->initiating.packet);
}
packet = this->initiating.packet->clone(this->initiating.packet);
charon->sender->send(charon->sender, packet);
@@ -1136,6 +1140,7 @@ METHOD(task_manager_t, process_message, status_t,
DBG1(DBG_IKE, "received retransmit of request with ID %d, "
"retransmitting response", mid);
charon->bus->alert(charon->bus, ALERT_RETRANSMIT_RECEIVE, msg);
clone = this->responding.packet->clone(this->responding.packet);
host = msg->get_destination(msg);
clone->set_source(clone, host->clone(host));