Support manually-set IPsec policy priorities
[strongswan.git] / src / libcharon / config / child_cfg.c
index 1a84d30..a7ec167 100644 (file)
@@ -1,4 +1,5 @@
 /*
+ * Copyright (C) 2016 Andreas Steffen
  * Copyright (C) 2008-2016 Tobias Brunner
  * Copyright (C) 2005-2007 Martin Willi
  * Copyright (C) 2005 Jan Hutter
@@ -133,6 +134,11 @@ struct private_child_cfg_t {
        uint32_t tfc;
 
        /**
+        * Optional manually-set IPsec policy priorities
+        */
+       uint32_t manual_prio;
+
+       /**
         * set up IPsec transport SA in MIPv6 proxy mode
         */
        bool proxy_mode;
@@ -500,6 +506,12 @@ METHOD(child_cfg_t, get_tfc, uint32_t,
        return this->tfc;
 }
 
+METHOD(child_cfg_t, get_manual_prio, uint32_t,
+       private_child_cfg_t *this)
+{
+       return this->manual_prio;
+}
+
 METHOD(child_cfg_t, get_replay_window, uint32_t,
        private_child_cfg_t *this)
 {
@@ -569,6 +581,7 @@ METHOD(child_cfg_t, equals, bool,
                this->mark_out.value == other->mark_out.value &&
                this->mark_out.mask == other->mark_out.mask &&
                this->tfc == other->tfc &&
+               this->manual_prio == other->manual_prio &&
                this->replay_window == other->replay_window &&
                this->proxy_mode == other->proxy_mode &&
                this->install_policy == other->install_policy &&
@@ -627,6 +640,7 @@ child_cfg_t *child_cfg_create(char *name, child_cfg_create_t *data)
                        .get_reqid = _get_reqid,
                        .get_mark = _get_mark,
                        .get_tfc = _get_tfc,
+                       .get_manual_prio = _get_manual_prio,
                        .get_replay_window = _get_replay_window,
                        .set_replay_window = _set_replay_window,
                        .use_proxy_mode = _use_proxy_mode,
@@ -650,6 +664,7 @@ child_cfg_t *child_cfg_create(char *name, child_cfg_create_t *data)
                .inactivity = data->inactivity,
                .use_ipcomp = data->ipcomp,
                .tfc = data->tfc,
+               .manual_prio = data->priority,
                .install_policy = !data->suppress_policies,
                .refcount = 1,
                .proposals = linked_list_create(),