[strongSwan-dev] [PATCH 4/4] Use reqid from connection config if present.
Adrian-Ken Rueegsegger
rueegsegger at swiss-it.ch
Thu Apr 22 17:03:30 CEST 2010
From: Reto Buerki <buerki at swiss-it.ch>
---
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
More information about the Dev
mailing list