diff options
author | Martin Willi <martin@revosec.ch> | 2014-02-11 09:19:45 +0100 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2014-06-16 15:59:16 +0200 |
commit | 5ae3221075f65dead61374e67193468bb7437209 (patch) | |
tree | 5f421c33ad70a55e289b113f9e0e6b90e9488af0 /src | |
parent | b16e177e06c2fac06a59134558af39eeaa984ce7 (diff) | |
download | strongswan-5ae3221075f65dead61374e67193468bb7437209.tar.bz2 strongswan-5ae3221075f65dead61374e67193468bb7437209.tar.xz |
ike: Store unhandled attributes on IKE_SA as well
Diffstat (limited to 'src')
-rw-r--r-- | src/libcharon/sa/ike_sa.c | 7 | ||||
-rw-r--r-- | src/libcharon/sa/ike_sa.h | 3 | ||||
-rw-r--r-- | src/libcharon/sa/ikev1/tasks/mode_config.c | 7 | ||||
-rw-r--r-- | src/libcharon/sa/ikev2/tasks/ike_config.c | 7 |
4 files changed, 12 insertions, 12 deletions
diff --git a/src/libcharon/sa/ike_sa.c b/src/libcharon/sa/ike_sa.c index 7b38e0268..3ef9801e0 100644 --- a/src/libcharon/sa/ike_sa.c +++ b/src/libcharon/sa/ike_sa.c @@ -2150,8 +2150,11 @@ METHOD(ike_sa_t, destroy, void, /* remove attributes first, as we pass the IKE_SA to the handler */ while (array_remove(this->attributes, ARRAY_TAIL, &entry)) { - hydra->attributes->release(hydra->attributes, entry.handler, - this->other_id, entry.type, entry.data); + if (entry.handler) + { + hydra->attributes->release(hydra->attributes, entry.handler, + this->other_id, entry.type, entry.data); + } free(entry.data.ptr); } /* uninstall CHILD_SAs before virtual IPs, otherwise we might kill diff --git a/src/libcharon/sa/ike_sa.h b/src/libcharon/sa/ike_sa.h index d162539db..5dc7326a4 100644 --- a/src/libcharon/sa/ike_sa.h +++ b/src/libcharon/sa/ike_sa.h @@ -978,6 +978,9 @@ struct ike_sa_t { * registered at the IKE_SA. Attributes are inherit()ed and get released * 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 type configuration attribute type * @param data associated attribute data diff --git a/src/libcharon/sa/ikev1/tasks/mode_config.c b/src/libcharon/sa/ikev1/tasks/mode_config.c index 55fb390ce..d678f1942 100644 --- a/src/libcharon/sa/ikev1/tasks/mode_config.c +++ b/src/libcharon/sa/ikev1/tasks/mode_config.c @@ -139,11 +139,8 @@ static void handle_attribute(private_mode_config_t *this, handler = hydra->attributes->handle(hydra->attributes, this->ike_sa->get_other_id(this->ike_sa), handler, ca->get_type(ca), ca->get_chunk(ca)); - if (handler) - { - this->ike_sa->add_configuration_attribute(this->ike_sa, - handler, ca->get_type(ca), ca->get_chunk(ca)); - } + this->ike_sa->add_configuration_attribute(this->ike_sa, + handler, ca->get_type(ca), ca->get_chunk(ca)); } /** diff --git a/src/libcharon/sa/ikev2/tasks/ike_config.c b/src/libcharon/sa/ikev2/tasks/ike_config.c index 1a4c21b54..89b15ea5f 100644 --- a/src/libcharon/sa/ikev2/tasks/ike_config.c +++ b/src/libcharon/sa/ikev2/tasks/ike_config.c @@ -130,11 +130,8 @@ static void handle_attribute(private_ike_config_t *this, handler = hydra->attributes->handle(hydra->attributes, this->ike_sa->get_other_id(this->ike_sa), handler, ca->get_type(ca), ca->get_chunk(ca)); - if (handler) - { - this->ike_sa->add_configuration_attribute(this->ike_sa, - handler, ca->get_type(ca), ca->get_chunk(ca)); - } + this->ike_sa->add_configuration_attribute(this->ike_sa, + handler, ca->get_type(ca), ca->get_chunk(ca)); } /** |