diff options
author | Martin Willi <martin@revosec.ch> | 2013-05-08 15:18:50 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2013-06-11 15:54:27 +0200 |
commit | d64f6ef6ae3ff66b6aa775913952b637d60723f1 (patch) | |
tree | ab66575243c0482bf7f57a927401cbb250ab0e22 | |
parent | 3160b92adb396c5445b2f5b16b496c6fb5cec5b0 (diff) | |
download | strongswan-d64f6ef6ae3ff66b6aa775913952b637d60723f1.tar.bz2 strongswan-d64f6ef6ae3ff66b6aa775913952b637d60723f1.tar.xz |
Use ref_get() to make sure CHILD_SA reqids are unique
-rw-r--r-- | src/libcharon/sa/child_sa.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libcharon/sa/child_sa.c b/src/libcharon/sa/child_sa.c index 34435a140..a14b03949 100644 --- a/src/libcharon/sa/child_sa.c +++ b/src/libcharon/sa/child_sa.c @@ -1083,7 +1083,7 @@ METHOD(child_sa_t, destroy, void, 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; + static refcount_t reqid = 0; private_child_sa_t *this; INIT(this, @@ -1142,7 +1142,14 @@ child_sa_t * child_sa_create(host_t *me, host_t* other, if (!this->reqid) { /* reuse old reqid if we are rekeying an existing CHILD_SA */ - this->reqid = rekey ? rekey : ++reqid; + if (rekey) + { + this->reqid = rekey; + } + else + { + this->reqid = ref_get(&reqid); + } } if (this->mark_in.value == MARK_REQID) |