Don't unset IKE_SA on bus before we released virtual IPs and attributes

This commit is contained in:
Martin Willi 2013-04-17 11:09:23 +02:00
parent 55321dcfb6
commit a3854d8371

View File

@ -2094,21 +2094,11 @@ METHOD(ike_sa_t, destroy, void,
free(entry->data.ptr); free(entry->data.ptr);
free(entry); free(entry);
} }
this->attributes->destroy(this->attributes);
this->child_sas->destroy_offset(this->child_sas, offsetof(child_sa_t, destroy));
/* unset SA after here to avoid usage by the listeners */
charon->bus->set_sa(charon->bus, NULL);
DESTROY_IF(this->keymat);
while (this->my_vips->remove_last(this->my_vips, (void**)&vip) == SUCCESS) while (this->my_vips->remove_last(this->my_vips, (void**)&vip) == SUCCESS)
{ {
hydra->kernel_interface->del_ip(hydra->kernel_interface, vip, -1, TRUE); hydra->kernel_interface->del_ip(hydra->kernel_interface, vip, -1, TRUE);
vip->destroy(vip); vip->destroy(vip);
} }
this->my_vips->destroy(this->my_vips);
if (this->other_vips->get_count(this->other_vips)) if (this->other_vips->get_count(this->other_vips))
{ {
charon->bus->assign_vips(charon->bus, &this->public, FALSE); charon->bus->assign_vips(charon->bus, &this->public, FALSE);
@ -2129,6 +2119,14 @@ METHOD(ike_sa_t, destroy, void,
} }
vip->destroy(vip); vip->destroy(vip);
} }
/* unset SA after here to avoid usage by the listeners */
charon->bus->set_sa(charon->bus, NULL);
this->child_sas->destroy_offset(this->child_sas, offsetof(child_sa_t, destroy));
DESTROY_IF(this->keymat);
this->attributes->destroy(this->attributes);
this->my_vips->destroy(this->my_vips);
this->other_vips->destroy(this->other_vips); this->other_vips->destroy(this->other_vips);
this->peer_addresses->destroy_offset(this->peer_addresses, this->peer_addresses->destroy_offset(this->peer_addresses,
offsetof(host_t, destroy)); offsetof(host_t, destroy));