bus: Add new hook called when IKEv1 CHILD_SAs are migrated to a new IKE_SA

The interface is currently not very nice, but if we ever were able to
safely checkout multiple SAs concurrently we could add something similar
to ike_rekey() and call that when we detect a reauthentication.
This commit is contained in:
Tobias Brunner
2015-05-21 15:38:31 +02:00
parent 8dbef6dac8
commit 072d9dc3c6
3 changed files with 58 additions and 3 deletions
+33 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2014 Tobias Brunner
* Copyright (C) 2011-2015 Tobias Brunner
* Copyright (C) 2006 Martin Willi
* Hochschule fuer Technik Rapperswil
*
@@ -687,6 +687,37 @@ METHOD(bus_t, child_rekey, void,
this->mutex->unlock(this->mutex);
}
METHOD(bus_t, children_migrate, void,
private_bus_t *this, ike_sa_id_t *new, u_int32_t unique)
{
enumerator_t *enumerator;
ike_sa_t *ike_sa;
entry_t *entry;
bool keep;
ike_sa = this->thread_sa->get(this->thread_sa);
this->mutex->lock(this->mutex);
enumerator = this->listeners->create_enumerator(this->listeners);
while (enumerator->enumerate(enumerator, &entry))
{
if (entry->calling || !entry->listener->children_migrate)
{
continue;
}
entry->calling++;
keep = entry->listener->children_migrate(entry->listener, ike_sa, new,
unique);
entry->calling--;
if (!keep)
{
unregister_listener(this, entry, enumerator);
}
}
enumerator->destroy(enumerator);
this->mutex->unlock(this->mutex);
}
METHOD(bus_t, ike_updown, void,
private_bus_t *this, ike_sa_t *ike_sa, bool up)
{
@@ -1038,6 +1069,7 @@ bus_t *bus_create()
.ike_reestablish_post = _ike_reestablish_post,
.child_updown = _child_updown,
.child_rekey = _child_rekey,
.children_migrate = _children_migrate,
.authorize = _authorize,
.narrow = _narrow,
.assign_vips = _assign_vips,