diff options
author | Tobias Brunner <tobias@strongswan.org> | 2011-05-19 17:27:32 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2011-07-06 09:43:45 +0200 |
commit | 4bbce1ef37d08f65084e14d4d30bfa512dd49767 (patch) | |
tree | 2ff300f2e66bf50e2dbd3bc0df842f02c76c776d /src/libcharon/sa/tasks/ike_reauth.c | |
parent | 4f9c691adbb0763d59b3f58f5bbd3dbb36748a76 (diff) | |
download | strongswan-4bbce1ef37d08f65084e14d4d30bfa512dd49767.tar.bz2 strongswan-4bbce1ef37d08f65084e14d4d30bfa512dd49767.tar.xz |
Replaced ike_sa_t.create_child_sa_iterator with enumerator.
This required two new methods on ike_sa_t. One returns the number of
CHILD_SAs and one allows to remove a CHILD_SA.
Diffstat (limited to 'src/libcharon/sa/tasks/ike_reauth.c')
-rw-r--r-- | src/libcharon/sa/tasks/ike_reauth.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/libcharon/sa/tasks/ike_reauth.c b/src/libcharon/sa/tasks/ike_reauth.c index ac89c358b..b3423f91e 100644 --- a/src/libcharon/sa/tasks/ike_reauth.c +++ b/src/libcharon/sa/tasks/ike_reauth.c @@ -57,7 +57,7 @@ static status_t process_i(private_ike_reauth_t *this, message_t *message) { ike_sa_t *new; host_t *host; - iterator_t *iterator; + enumerator_t *enumerator; child_sa_t *child_sa; peer_cfg_t *peer_cfg; @@ -67,8 +67,7 @@ static status_t process_i(private_ike_reauth_t *this, message_t *message) peer_cfg = this->ike_sa->get_peer_cfg(this->ike_sa); /* reauthenticate only if we have children */ - iterator = this->ike_sa->create_child_sa_iterator(this->ike_sa); - if (iterator->get_count(iterator) == 0 + if (this->ike_sa->get_child_count(this->ike_sa) == 0 #ifdef ME /* we allow peers to reauth mediation connections (without children) */ && !peer_cfg->is_mediation(peer_cfg) @@ -76,7 +75,6 @@ static status_t process_i(private_ike_reauth_t *this, message_t *message) ) { DBG1(DBG_IKE, "unable to reauthenticate IKE_SA, no CHILD_SA to recreate"); - iterator->destroy(iterator); return FAILED; } @@ -110,14 +108,15 @@ static status_t process_i(private_ike_reauth_t *this, message_t *message) } #endif /* ME */ - while (iterator->iterate(iterator, (void**)&child_sa)) + enumerator = this->ike_sa->create_child_sa_enumerator(this->ike_sa); + while (enumerator->enumerate(enumerator, (void**)&child_sa)) { switch (child_sa->get_state(child_sa)) { case CHILD_ROUTED: { /* move routed child directly */ - iterator->remove(iterator); + this->ike_sa->remove_child_sa(this->ike_sa, enumerator); new->add_child_sa(new, child_sa); break; } @@ -128,7 +127,7 @@ static status_t process_i(private_ike_reauth_t *this, message_t *message) child_cfg->get_ref(child_cfg); if (new->initiate(new, child_cfg, 0, NULL, NULL) == DESTROY_ME) { - iterator->destroy(iterator); + enumerator->destroy(enumerator); charon->ike_sa_manager->checkin_and_destroy( charon->ike_sa_manager, new); /* set threads active IKE_SA after checkin */ @@ -140,7 +139,7 @@ static status_t process_i(private_ike_reauth_t *this, message_t *message) } } } - iterator->destroy(iterator); + enumerator->destroy(enumerator); charon->ike_sa_manager->checkin(charon->ike_sa_manager, new); /* set threads active IKE_SA after checkin */ charon->bus->set_sa(charon->bus, this->ike_sa); |