Use the vararg list constructor in quick mode task
[strongswan.git] / src / libcharon / sa / shunt_manager.c
index f18c07c..5af43fb 100644 (file)
@@ -47,6 +47,7 @@ static bool install_shunt_policy(child_cfg_t *child)
        enumerator_t *e_my_ts, *e_other_ts;
        linked_list_t *my_ts_list, *other_ts_list;
        traffic_selector_t *my_ts, *other_ts;
+       host_t *host_any;
        policy_type_t policy_type;
        status_t status = SUCCESS;
        ipsec_sa_cfg_t sa = { .mode = MODE_TRANSPORT };
@@ -55,6 +56,7 @@ static bool install_shunt_policy(child_cfg_t *child)
                                                                                         POLICY_PASS : POLICY_DROP;
        my_ts_list =    child->get_traffic_selectors(child, TRUE,  NULL, NULL);
        other_ts_list = child->get_traffic_selectors(child, FALSE, NULL, NULL);
+       host_any = host_create_any(AF_INET);
 
        /* enumerate pairs of traffic selectors */
        e_my_ts = my_ts_list->create_enumerator(my_ts_list);
@@ -65,21 +67,24 @@ static bool install_shunt_policy(child_cfg_t *child)
                {
                        /* install out policy */
                        status |= hydra->kernel_interface->add_policy(
-                                                               hydra->kernel_interface, NULL, NULL,
+                                                               hydra->kernel_interface, host_any, host_any,
                                                                my_ts, other_ts, POLICY_OUT, policy_type,
-                                                               &sa, child->get_mark(child, FALSE), FALSE);
+                                                               &sa, child->get_mark(child, FALSE),
+                                                               POLICY_PRIORITY_DEFAULT);
 
                        /* install in policy */
                        status |= hydra->kernel_interface->add_policy(
-                                                               hydra->kernel_interface, NULL, NULL,
+                                                               hydra->kernel_interface, host_any, host_any,
                                                                other_ts, my_ts, POLICY_IN, policy_type,
-                                                               &sa, child->get_mark(child, TRUE), FALSE);
+                                                               &sa, child->get_mark(child, TRUE),
+                                                               POLICY_PRIORITY_DEFAULT);
 
                        /* install forward policy */
                        status |= hydra->kernel_interface->add_policy(
-                                                               hydra->kernel_interface, NULL, NULL,
+                                                               hydra->kernel_interface, host_any, host_any,
                                                                other_ts, my_ts, POLICY_FWD, policy_type,
-                                                               &sa, child->get_mark(child, TRUE), FALSE);
+                                                               &sa, child->get_mark(child, TRUE),
+                                                               POLICY_PRIORITY_DEFAULT);
                }
                e_other_ts->destroy(e_other_ts);
        }
@@ -89,6 +94,7 @@ static bool install_shunt_policy(child_cfg_t *child)
                                                           offsetof(traffic_selector_t, destroy));
        other_ts_list->destroy_offset(other_ts_list,
                                                           offsetof(traffic_selector_t, destroy));
+       host_any->destroy(host_any);
 
        return status == SUCCESS;
 }
@@ -147,19 +153,19 @@ static void uninstall_shunt_policy(child_cfg_t *child)
                        status |= hydra->kernel_interface->del_policy(
                                                        hydra->kernel_interface, my_ts, other_ts,
                                                        POLICY_OUT, 0, child->get_mark(child, FALSE),
-                                                       FALSE);
+                                                       POLICY_PRIORITY_DEFAULT);
 
                        /* uninstall in policy */
                        status |= hydra->kernel_interface->del_policy(
                                                        hydra->kernel_interface, other_ts, my_ts,
                                                        POLICY_IN, 0, child->get_mark(child, TRUE),
-                                                       FALSE);
+                                                       POLICY_PRIORITY_DEFAULT);
 
                        /* uninstall forward policy */
                        status |= hydra->kernel_interface->del_policy(
                                                        hydra->kernel_interface, other_ts, my_ts,
                                                        POLICY_FWD, 0, child->get_mark(child, TRUE),
-                                                       FALSE);
+                                                       POLICY_PRIORITY_DEFAULT);
                }
                e_other_ts->destroy(e_other_ts);
        }
@@ -200,6 +206,7 @@ METHOD(shunt_manager_t, uninstall, bool,
                return FALSE;
        }
        uninstall_shunt_policy(child);
+       child->destroy(child);
        return TRUE;
 }