]> git.ipfire.org Git - thirdparty/strongswan.git/commit
ike-sa-manager: Fix races when changing initiator SPI of an IKE_SA
authorTobias Brunner <tobias@strongswan.org>
Fri, 15 Jun 2018 10:34:15 +0000 (12:34 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 3 Jul 2018 09:31:38 +0000 (11:31 +0200)
commit89a88d7c56dcae9ce727ffa6a7787dbf2e615452
tree885072034a4eb99a16248bfa5b6a6efe6c701649
parentf23b1078576b1d26f8fd4729e6c3dad45140dbc6
ike-sa-manager: Fix races when changing initiator SPI of an IKE_SA

Removing and readding the entry to a potentially different row/segment,
while driving out waiting and new threads, could prevent threads from
acquiring the SA even if they were waiting to check it out by unique
ID (which doesn't change), or if they were just trying to enumerate it.
With this change the row and segment doesn't change anymore and waiting
threads may acquire the SA. However, those looking for an IKE_SA by SPIs
might get one back that has a different SPI (but that's probably not
something that happens very often this early).

This was noticed because we check out SAs by unique ID in the Android
app to terminate them after failed retransmits if we are not reestablishing
the SA (otherwise we continue), and this sometimes failed.

Fixes: eaedcf8c0054 ("ike-sa-manager: Add method to change the initiator SPI of an IKE_SA")
src/libcharon/sa/ike_sa_manager.c