]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
child-sa: Use non-static variable to store generated unique mark
authorTobias Brunner <tobias@strongswan.org>
Thu, 19 May 2016 09:56:44 +0000 (11:56 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 6 Jun 2016 12:17:11 +0000 (14:17 +0200)
If two CHILD_SAs with mark=%unique are created concurrently they could
otherwise end up with either the same mark or different marks in both
directions.

src/libcharon/sa/child_sa.c

index e75e399053148da9c93b756f0504cf6d2d21c4b5..8a405d93cefae037a6115d34f8c9a05c0c185b06 100644 (file)
@@ -1390,7 +1390,8 @@ child_sa_t * child_sa_create(host_t *me, host_t* other,
                                                         u_int mark_in, u_int mark_out)
 {
        private_child_sa_t *this;
-       static refcount_t unique_id = 0, unique_mark = 0, mark;
+       static refcount_t unique_id = 0, unique_mark = 0;
+       refcount_t mark;
 
        INIT(this,
                .public = {