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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user