ike: Store unhandled attributes on IKE_SA as well

This commit is contained in:
Martin Willi
2014-06-16 15:59:16 +02:00
parent b16e177e06
commit 5ae3221075
4 changed files with 12 additions and 12 deletions
+3
View File
@@ -2149,9 +2149,12 @@ METHOD(ike_sa_t, destroy, void,
/* remove attributes first, as we pass the IKE_SA to the handler */ /* remove attributes first, as we pass the IKE_SA to the handler */
while (array_remove(this->attributes, ARRAY_TAIL, &entry)) while (array_remove(this->attributes, ARRAY_TAIL, &entry))
{
if (entry.handler)
{ {
hydra->attributes->release(hydra->attributes, entry.handler, hydra->attributes->release(hydra->attributes, entry.handler,
this->other_id, entry.type, entry.data); this->other_id, entry.type, entry.data);
}
free(entry.data.ptr); free(entry.data.ptr);
} }
/* uninstall CHILD_SAs before virtual IPs, otherwise we might kill /* uninstall CHILD_SAs before virtual IPs, otherwise we might kill
+3
View File
@@ -978,6 +978,9 @@ struct ike_sa_t {
* registered at the IKE_SA. Attributes are inherit()ed and get released * registered at the IKE_SA. Attributes are inherit()ed and get released
* when the IKE_SA is closed. * when the IKE_SA is closed.
* *
* Unhandled attributes are passed as well, but with a NULL handler. They
* do not get released.
*
* @param handler handler installed the attribute, use for release() * @param handler handler installed the attribute, use for release()
* @param type configuration attribute type * @param type configuration attribute type
* @param data associated attribute data * @param data associated attribute data
@@ -139,12 +139,9 @@ static void handle_attribute(private_mode_config_t *this,
handler = hydra->attributes->handle(hydra->attributes, handler = hydra->attributes->handle(hydra->attributes,
this->ike_sa->get_other_id(this->ike_sa), handler, this->ike_sa->get_other_id(this->ike_sa), handler,
ca->get_type(ca), ca->get_chunk(ca)); ca->get_type(ca), ca->get_chunk(ca));
if (handler)
{
this->ike_sa->add_configuration_attribute(this->ike_sa, this->ike_sa->add_configuration_attribute(this->ike_sa,
handler, ca->get_type(ca), ca->get_chunk(ca)); handler, ca->get_type(ca), ca->get_chunk(ca));
} }
}
/** /**
* process a single configuration attribute * process a single configuration attribute
@@ -130,12 +130,9 @@ static void handle_attribute(private_ike_config_t *this,
handler = hydra->attributes->handle(hydra->attributes, handler = hydra->attributes->handle(hydra->attributes,
this->ike_sa->get_other_id(this->ike_sa), handler, this->ike_sa->get_other_id(this->ike_sa), handler,
ca->get_type(ca), ca->get_chunk(ca)); ca->get_type(ca), ca->get_chunk(ca));
if (handler)
{
this->ike_sa->add_configuration_attribute(this->ike_sa, this->ike_sa->add_configuration_attribute(this->ike_sa,
handler, ca->get_type(ca), ca->get_chunk(ca)); handler, ca->get_type(ca), ca->get_chunk(ca));
} }
}
/** /**
* process a single configuration attribute * process a single configuration attribute