ike-rekey: Add method to check if there was a rekey collision

This commit is contained in:
Tobias Brunner
2016-06-17 18:48:06 +02:00
parent 1cca20705a
commit 13da616118
2 changed files with 17 additions and 1 deletions
+8
View File
@@ -380,6 +380,13 @@ METHOD(task_t, get_type, task_type_t,
return TASK_IKE_REKEY;
}
METHOD(ike_rekey_t, did_collide, bool,
private_ike_rekey_t *this)
{
return this->collision &&
this->collision->get_type(this->collision) == TASK_IKE_REKEY;
}
METHOD(ike_rekey_t, collide, void,
private_ike_rekey_t* this, task_t *other)
{
@@ -444,6 +451,7 @@ ike_rekey_t *ike_rekey_create(ike_sa_t *ike_sa, bool initiator)
.migrate = _migrate,
.destroy = _destroy,
},
.did_collide = _did_collide,
.collide = _collide,
},
.ike_sa = ike_sa,
+9 -1
View File
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2016 Tobias Brunner
* Copyright (C) 2007 Martin Willi
* Hochschule fuer Technik Rapperswil
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -37,6 +38,13 @@ struct ike_rekey_t {
*/
task_t task;
/**
* Check if there was a rekey collision.
*
* @return TRUE if there was a rekey collision before
*/
bool (*did_collide)(ike_rekey_t *this);
/**
* Register a rekeying task which collides with this one.
*