ike-sa-manager: Remove IKE_SA checkout by CHILD_SA reqid
authorMartin Willi <martin@revosec.ch>
Mon, 27 Oct 2014 15:08:59 +0000 (16:08 +0100)
committerMartin Willi <martin@revosec.ch>
Fri, 20 Feb 2015 12:34:51 +0000 (13:34 +0100)
src/frontends/android/jni/libandroidbridge/backend/android_service.c
src/libcharon/control/controller.c
src/libcharon/plugins/unity/unity_handler.c
src/libcharon/sa/ike_sa_manager.c
src/libcharon/sa/ike_sa_manager.h

index fad070d..64a7907 100644 (file)
@@ -426,8 +426,7 @@ CALLBACK(reestablish, job_requeue_t,
 {
        ike_sa_t *ike_sa;
 
-       ike_sa = charon->ike_sa_manager->checkout_by_id(charon->ike_sa_manager,
-                                                                                                       *id, FALSE);
+       ike_sa = charon->ike_sa_manager->checkout_by_id(charon->ike_sa_manager, *id);
        if (ike_sa)
        {
                if (ike_sa->reauth(ike_sa) == DESTROY_ME)
index 418b247..fd8349e 100644 (file)
@@ -449,7 +449,7 @@ METHOD(job_t, terminate_ike_execute, job_requeue_t,
        ike_sa_t *ike_sa;
 
        ike_sa = charon->ike_sa_manager->checkout_by_id(charon->ike_sa_manager,
-                                                                                                       unique_id, FALSE);
+                                                                                                       unique_id);
        if (!ike_sa)
        {
                DBG1(DBG_IKE, "unable to terminate IKE_SA: ID %d not found", unique_id);
index bcef0dc..ff386c3 100644 (file)
@@ -210,7 +210,7 @@ static job_requeue_t add_exclude_async(entry_t *entry)
        host_t *host;
 
        ike_sa = charon->ike_sa_manager->checkout_by_id(charon->ike_sa_manager,
-                                                                                                       entry->sa, FALSE);
+                                                                                                       entry->sa);
        if (ike_sa)
        {
                create_shunt_name(ike_sa, entry->ts, name, sizeof(name));
index 144cd7d..7ca72f3 100644 (file)
@@ -1383,54 +1383,35 @@ METHOD(ike_sa_manager_t, checkout_by_config, ike_sa_t*,
 }
 
 METHOD(ike_sa_manager_t, checkout_by_id, ike_sa_t*,
-       private_ike_sa_manager_t *this, u_int32_t id, bool child)
+       private_ike_sa_manager_t *this, u_int32_t id)
 {
-       enumerator_t *enumerator, *children;
+       enumerator_t *enumerator;
        entry_t *entry;
        ike_sa_t *ike_sa = NULL;
-       child_sa_t *child_sa;
        u_int segment;
 
-       DBG2(DBG_MGR, "checkout IKE_SA by ID");
+       DBG2(DBG_MGR, "checkout IKE_SA by ID %u", id);
 
        enumerator = create_table_enumerator(this);
        while (enumerator->enumerate(enumerator, &entry, &segment))
        {
                if (wait_for_entry(this, entry, segment))
                {
-                       /* look for a child with such a reqid ... */
-                       if (child)
-                       {
-                               children = entry->ike_sa->create_child_sa_enumerator(entry->ike_sa);
-                               while (children->enumerate(children, (void**)&child_sa))
-                               {
-                                       if (child_sa->get_reqid(child_sa) == id)
-                                       {
-                                               ike_sa = entry->ike_sa;
-                                               break;
-                                       }
-                               }
-                               children->destroy(children);
-                       }
-                       else /* ... or for a IKE_SA with such a unique id */
-                       {
-                               if (entry->ike_sa->get_unique_id(entry->ike_sa) == id)
-                               {
-                                       ike_sa = entry->ike_sa;
-                               }
-                       }
-                       /* got one, return */
-                       if (ike_sa)
+                       if (entry->ike_sa->get_unique_id(entry->ike_sa) == id)
                        {
+                               ike_sa = entry->ike_sa;
                                entry->checked_out = TRUE;
-                               DBG2(DBG_MGR, "IKE_SA %s[%u] successfully checked out",
-                                               ike_sa->get_name(ike_sa), ike_sa->get_unique_id(ike_sa));
                                break;
                        }
                }
        }
        enumerator->destroy(enumerator);
 
+       if (ike_sa)
+       {
+               DBG2(DBG_MGR, "IKE_SA %s[%u] successfully checked out",
+                        ike_sa->get_name(ike_sa), ike_sa->get_unique_id(ike_sa));
+       }
        charon->bus->set_sa(charon->bus, ike_sa);
        return ike_sa;
 }
index a68ae77..f259d8e 100644 (file)
@@ -129,19 +129,15 @@ struct ike_sa_manager_t {
        /**
         * Check out an IKE_SA a unique ID.
         *
-        * Every IKE_SA and every CHILD_SA is uniquely identified by an ID.
-        * These checkout function uses, depending
-        * on the child parameter, the unique ID of the IKE_SA or the reqid
-        * of one of a IKE_SAs CHILD_SA.
+        * Every IKE_SA is uniquely identified by a numerical ID. This checkout
+        * function uses the unique ID of the IKE_SA to check it out.
         *
         * @param id                            unique ID of the object
-        * @param child                         TRUE to use CHILD, FALSE to use IKE_SA
         * @return
         *                                                      - checked out IKE_SA, if found
         *                                                      - NULL, if not found
         */
-       ike_sa_t* (*checkout_by_id) (ike_sa_manager_t* this, u_int32_t id,
-                                                                bool child);
+       ike_sa_t* (*checkout_by_id) (ike_sa_manager_t* this, u_int32_t id);
 
        /**
         * Check out an IKE_SA by the policy/connection name.