]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
child-cfg: Add property for interface ID
authorTobias Brunner <tobias@strongswan.org>
Tue, 12 Feb 2019 09:19:36 +0000 (10:19 +0100)
committerTobias Brunner <tobias@strongswan.org>
Wed, 3 Apr 2019 10:00:08 +0000 (12:00 +0200)
src/libcharon/config/child_cfg.c
src/libcharon/config/child_cfg.h

index 14148ed0377edda418bc6d3155df79e542717dd8..73cb02bd9a4f57ebc0194bf3ec931e4c41569e8b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2018 Tobias Brunner
+ * Copyright (C) 2008-2019 Tobias Brunner
  * Copyright (C) 2016 Andreas Steffen
  * Copyright (C) 2005-2007 Martin Willi
  * Copyright (C) 2005 Jan Hutter
@@ -113,6 +113,16 @@ struct private_child_cfg_t {
         */
        uint32_t reqid;
 
+       /**
+        * Optionl interface ID to use for inbound CHILD_SA
+        */
+       uint32_t if_id_in;
+
+       /**
+        * Optionl interface ID to use for outbound CHILD_SA
+        */
+       uint32_t if_id_out;
+
        /**
         * Optional mark to install inbound CHILD_SA with
         */
@@ -551,6 +561,12 @@ METHOD(child_cfg_t, get_reqid, uint32_t,
        return this->reqid;
 }
 
+METHOD(child_cfg_t, get_if_id, uint32_t,
+       private_child_cfg_t *this, bool inbound)
+{
+       return inbound ? this->if_id_in : this->if_id_out;
+}
+
 METHOD(child_cfg_t, get_mark, mark_t,
        private_child_cfg_t *this, bool inbound)
 {
@@ -632,6 +648,8 @@ METHOD(child_cfg_t, equals, bool,
                LIFETIME_EQUALS(this->lifetime, other->lifetime) &&
                this->inactivity == other->inactivity &&
                this->reqid == other->reqid &&
+               this->if_id_in == other->if_id_in &&
+               this->if_id_out == other->if_id_out &&
                this->mark_in.value == other->mark_in.value &&
                this->mark_in.mask == other->mark_in.mask &&
                this->mark_out.value == other->mark_out.value &&
@@ -695,6 +713,7 @@ child_cfg_t *child_cfg_create(char *name, child_cfg_create_t *data)
                        .get_dh_group = _get_dh_group,
                        .get_inactivity = _get_inactivity,
                        .get_reqid = _get_reqid,
+                       .get_if_id = _get_if_id,
                        .get_mark = _get_mark,
                        .get_set_mark = _get_set_mark,
                        .get_tfc = _get_tfc,
@@ -713,6 +732,8 @@ child_cfg_t *child_cfg_create(char *name, child_cfg_create_t *data)
                .options = data->options,
                .updown = strdupnull(data->updown),
                .reqid = data->reqid,
+               .if_id_in = data->if_id_in,
+               .if_id_out = data->if_id_out,
                .mode = data->mode,
                .start_action = data->start_action,
                .dpd_action = data->dpd_action,
index e3b59e656a74c535b07064bbe0becec138ba7614..b80268513c1fd973c1fefaaa14647210b1a87a52 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2018 Tobias Brunner
+ * Copyright (C) 2008-2019 Tobias Brunner
  * Copyright (C) 2016 Andreas Steffen
  * Copyright (C) 2005-2007 Martin Willi
  * Copyright (C) 2005 Jan Hutter
@@ -226,6 +226,14 @@ struct child_cfg_t {
         */
        uint32_t (*get_reqid)(child_cfg_t *this);
 
+       /**
+        * Optional interface ID to set on policies/SAs.
+        *
+        * @param inbound               TRUE for inbound, FALSE for outbound
+        * @return                              interface ID
+        */
+       uint32_t (*get_if_id)(child_cfg_t *this, bool inbound);
+
        /**
         * Optional mark to set on policies/SAs.
         *
@@ -350,6 +358,10 @@ struct child_cfg_create_t {
        child_cfg_option_t options;
        /** Specific reqid to use for CHILD_SA, 0 for auto assignment */
        uint32_t reqid;
+       /** Optional inbound interface ID */
+       uint32_t if_id_in;
+       /** Optional outbound interface ID */
+       uint32_t if_id_out;
        /** Optional inbound mark */
        mark_t mark_in;
        /** Optional outbound mark */