From: Reto Buerki <[email protected]>

---
 src/libcharon/sa/child_sa.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/libcharon/sa/child_sa.c b/src/libcharon/sa/child_sa.c
index 3fdfb51..6fe87bc 100644
--- a/src/libcharon/sa/child_sa.c
+++ b/src/libcharon/sa/child_sa.c
@@ -897,7 +897,6 @@ static void destroy(private_child_sa_t *this)
 child_sa_t * child_sa_create(host_t *me, host_t* other,
                                                         child_cfg_t *config, 
u_int32_t rekey, bool encap)
 {
-       static u_int32_t reqid = 0;
        private_child_sa_t *this = malloc_thing(private_child_sa_t);
 
        /* public functions */
@@ -942,8 +941,17 @@ child_sa_t * child_sa_create(host_t *me, host_t* other,
        this->other_usetime = 0;
        this->my_usebytes = 0;
        this->other_usebytes = 0;
-       /* reuse old reqid if we are rekeying an existing CHILD_SA */
-       this->reqid = rekey ? rekey : ++reqid;
+
+       static u_int32_t reqid = 0;
+       if (!config->get_reqid(config)) {
+               /* reuse old reqid if we are rekeying an existing CHILD_SA */
+               this->reqid = rekey ? rekey : ++reqid;
+       } else {
+               this->reqid = config->get_reqid(config);
+               DBG1(DBG_CHD, "connection '%s' uses reqid %d from config",
+                               config->get_name(config), this->reqid);
+       }
+
        this->my_ts = linked_list_create();
        this->other_ts = linked_list_create();
        this->protocol = PROTO_NONE;
-- 
1.6.3.3


_______________________________________________
Dev mailing list
[email protected]
https://lists.strongswan.org/mailman/listinfo/dev

Reply via email to