Properly compare CHILD_SAs during rekey collision

The previous code did not properly check for the situation when the
DELETE for a redundant CHILD_SA created by a responder during a
CHILD_SA rekey collision arrives before the responder's answer to the
initiator's winning CREATE_CHILD_SA request.
This commit is contained in:
Tobias Brunner
2013-06-11 14:00:02 +02:00
parent 5744226e92
commit 3873526f3e
+8 -1
View File
@@ -399,13 +399,20 @@ METHOD(child_rekey_t, collide, void,
else if (other->get_type(other) == TASK_CHILD_DELETE) else if (other->get_type(other) == TASK_CHILD_DELETE)
{ {
child_delete_t *del = (child_delete_t*)other; child_delete_t *del = (child_delete_t*)other;
if (del->get_child(del) == this->child_create->get_child(this->child_create)) if (this->collision &&
this->collision->get_type(this->collision) == TASK_CHILD_REKEY)
{
private_child_rekey_t *rekey;
rekey = (private_child_rekey_t*)this->collision;
if (del->get_child(del) == rekey->child_create->get_child(rekey->child_create))
{ {
/* peer deletes redundant child created in collision */ /* peer deletes redundant child created in collision */
this->other_child_destroyed = TRUE; this->other_child_destroyed = TRUE;
other->destroy(other); other->destroy(other);
return; return;
} }
}
if (del->get_child(del) != this->child_sa) if (del->get_child(del) != this->child_sa)
{ {
/* not the same child => no collision */ /* not the same child => no collision */