]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
ike: Store unhandled attributes on IKE_SA as well
authorMartin Willi <martin@revosec.ch>
Tue, 11 Feb 2014 08:19:45 +0000 (09:19 +0100)
committerMartin Willi <martin@revosec.ch>
Mon, 16 Jun 2014 13:59:16 +0000 (15:59 +0200)
src/libcharon/sa/ike_sa.c
src/libcharon/sa/ike_sa.h
src/libcharon/sa/ikev1/tasks/mode_config.c
src/libcharon/sa/ikev2/tasks/ike_config.c

index 7b38e0268c764c5c0995290123fe910d816b2214..3ef9801e093cc48bb6590813f3b5f07497be3f46 100644 (file)
@@ -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
index d162539db1b0b788939f17099e4e457029a176ca..5dc7326a4c611308927c0b49b416d1303abf61c1 100644 (file)
@@ -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
index 55fb390ce0e192a7914afbad3742f353fa551248..d678f1942e6e3af4ff2f99a0a6e27bea698789cf 100644 (file)
@@ -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));
 }
 
 /**
index 1a4c21b5418bf7c163ee1ac9fc020059f0bf413f..89b15ea5f10364acb3af587c48d6b1679dec486e 100644 (file)
@@ -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));
 }
 
 /**