Use a dedicated message hash to detect IKEv1 retransmissions
This commit is contained in:
@@ -69,6 +69,11 @@ struct private_task_manager_t {
|
|||||||
*/
|
*/
|
||||||
u_int32_t mid;
|
u_int32_t mid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hash of a previously received message
|
||||||
|
*/
|
||||||
|
u_int32_t hash;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* packet for retransmission
|
* packet for retransmission
|
||||||
*/
|
*/
|
||||||
@@ -85,6 +90,11 @@ struct private_task_manager_t {
|
|||||||
*/
|
*/
|
||||||
u_int32_t mid;
|
u_int32_t mid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hash of a previously received message
|
||||||
|
*/
|
||||||
|
u_int32_t hash;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* how many times we have retransmitted so far
|
* how many times we have retransmitted so far
|
||||||
*/
|
*/
|
||||||
@@ -577,7 +587,6 @@ METHOD(task_manager_t, process_message, status_t,
|
|||||||
host_t *me, *other;
|
host_t *me, *other;
|
||||||
|
|
||||||
mid = msg->get_message_id(msg);
|
mid = msg->get_message_id(msg);
|
||||||
hash = chunk_hash(msg->get_packet_data(msg));
|
|
||||||
|
|
||||||
/* TODO-IKEv1: update hosts more selectively */
|
/* TODO-IKEv1: update hosts more selectively */
|
||||||
me = msg->get_destination(msg);
|
me = msg->get_destination(msg);
|
||||||
@@ -597,8 +606,8 @@ METHOD(task_manager_t, process_message, status_t,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((mid && mid == this->responding.mid) ||
|
hash = chunk_hash(msg->get_packet_data(msg));
|
||||||
hash == this->responding.mid)
|
if (hash == this->responding.hash)
|
||||||
{
|
{
|
||||||
DBG1(DBG_IKE, "received retransmit of request with ID %d, "
|
DBG1(DBG_IKE, "received retransmit of request with ID %d, "
|
||||||
"retransmitting response", mid);
|
"retransmitting response", mid);
|
||||||
@@ -614,11 +623,8 @@ METHOD(task_manager_t, process_message, status_t,
|
|||||||
return DESTROY_ME;
|
return DESTROY_ME;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mid)
|
|
||||||
{
|
|
||||||
mid = hash;
|
|
||||||
}
|
|
||||||
this->responding.mid = mid;
|
this->responding.mid = mid;
|
||||||
|
this->responding.hash = hash;
|
||||||
}
|
}
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user