stroke: Remove external enumeration to unroute shunt policies
authorTobias Brunner <tobias@strongswan.org>
Fri, 3 Nov 2017 09:53:04 +0000 (10:53 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 22 Feb 2018 10:31:05 +0000 (11:31 +0100)
src/libcharon/plugins/stroke/stroke_control.c

index ee83067..beda864 100644 (file)
@@ -730,30 +730,15 @@ METHOD(stroke_control_t, route, void,
 METHOD(stroke_control_t, unroute, void,
        private_stroke_control_t *this, stroke_msg_t *msg, FILE *out)
 {
-       child_cfg_t *child_cfg;
        child_sa_t *child_sa;
        enumerator_t *enumerator;
-       char *ns, *found = NULL;
        uint32_t id = 0;
 
-       enumerator = charon->shunts->create_enumerator(charon->shunts);
-       while (enumerator->enumerate(enumerator, &ns, &child_cfg))
+       if (charon->shunts->uninstall(charon->shunts, NULL, msg->unroute.name))
        {
-               if (ns && streq(msg->unroute.name, child_cfg->get_name(child_cfg)))
-               {
-                       found = strdup(ns);
-                       break;
-               }
-       }
-       enumerator->destroy(enumerator);
-       if (found && charon->shunts->uninstall(charon->shunts, found,
-                                                                                  msg->unroute.name))
-       {
-               free(found);
                fprintf(out, "shunt policy '%s' uninstalled\n", msg->unroute.name);
                return;
        }
-       free(found);
 
        enumerator = charon->traps->create_enumerator(charon->traps);
        while (enumerator->enumerate(enumerator, NULL, &child_sa))