implemented support of resolve plugin
[strongswan.git] / src / pluto / connections.c
index dd19304..d6c3851 100644 (file)
@@ -63,6 +63,7 @@
 #include "nat_traversal.h"
 #include "virtual.h"
 #include "whack_attribute.h"
+#include "modecfg.h"
 
 static void flush_pending_by_connection(connection_t *c);  /* forward */
 
@@ -294,8 +295,10 @@ void release_connection(connection_t *c, bool relations)
 
 void delete_connection(connection_t *c, bool relations)
 {
-       connection_t *old_cur_connection
-               = cur_connection == c? NULL : cur_connection;
+       modecfg_attribute_t *ca;
+       connection_t *old_cur_connection;
+
+       old_cur_connection = cur_connection == c? NULL : cur_connection;
 #ifdef DEBUG
        lset_t old_cur_debugging = cur_debugging;
 #endif
@@ -376,6 +379,25 @@ void delete_connection(connection_t *c, bool relations)
                vip->destroy(vip);
        }
 
+       /* release requested attributes if any */
+       if (c->requested)
+       {
+               c->requested->destroy_function(c->requested,
+                                                                         (void*)modecfg_attribute_destroy);
+       }
+
+       /* release other attributes if any */
+       if (c->attributes)
+       {
+               while (c->attributes->remove_last(c->attributes, (void **)&ca) == SUCCESS)
+               {
+                       hydra->attributes->release(hydra->attributes, ca->handler,
+                                                                          c->spd.that.id, ca->type, ca->value);
+                       modecfg_attribute_destroy(ca);
+               }
+               c->attributes->destroy(c->attributes);
+       }
+
        if (c->kind != CK_GOING_AWAY)
        {
                whack_attr->del_pool(whack_attr, c->name);