Add ike_reestablish() event that is triggered when an IKE_SA is reestablished

This is particularly useful during reauthentication to get the new
IKE_SA.
This commit is contained in:
Tobias Brunner
2012-09-06 11:25:14 +02:00
parent 873b63b771
commit 4dbb193190
4 changed files with 49 additions and 0 deletions
+28
View File
@@ -659,6 +659,33 @@ METHOD(bus_t, ike_rekey, void,
this->mutex->unlock(this->mutex);
}
METHOD(bus_t, ike_reestablish, void,
private_bus_t *this, ike_sa_t *old, ike_sa_t *new)
{
enumerator_t *enumerator;
entry_t *entry;
bool keep;
this->mutex->lock(this->mutex);
enumerator = this->listeners->create_enumerator(this->listeners);
while (enumerator->enumerate(enumerator, &entry))
{
if (entry->calling || !entry->listener->ike_reestablish)
{
continue;
}
entry->calling++;
keep = entry->listener->ike_reestablish(entry->listener, old, new);
entry->calling--;
if (!keep)
{
unregister_listener(this, entry, enumerator);
}
}
enumerator->destroy(enumerator);
this->mutex->unlock(this->mutex);
}
METHOD(bus_t, authorize, bool,
private_bus_t *this, bool final)
{
@@ -770,6 +797,7 @@ bus_t *bus_create()
.child_keys = _child_keys,
.ike_updown = _ike_updown,
.ike_rekey = _ike_rekey,
.ike_reestablish = _ike_reestablish,
.child_updown = _child_updown,
.child_rekey = _child_rekey,
.authorize = _authorize,