]> git.ipfire.org Git - thirdparty/strongswan.git/commit
child-sa: Update status flags based on success of SA addition
authorThomas Egerer <thomas.egerer@secunet.com>
Mon, 25 Nov 2024 15:37:40 +0000 (15:37 +0000)
committerTobias Brunner <tobias@strongswan.org>
Fri, 29 Nov 2024 12:46:12 +0000 (13:46 +0100)
commitfefea487248c78b4dbb3c33ea0630ba74921758f
treed764801211a52159978f730f34803340f7d8d90e
parent8b69327ad26f08e09fcce1562254e6135b147cc4
child-sa: Update status flags based on success of SA addition

Both variables `inbound_installed` and `outbound_state` are used in
`child_sa_t::destroy()` to determine whether inbound and outbound state
have to be deleted. They are assigned prior to the call to
`kernel_interface_t::add_sa()`. As this call may fail, the destructor may
try to delete a state which it has not been added.
By making the assignment of these variables dependent on the success of
the state addition, we can make sure, a `child_sa_t::destroy()` only
deletes states it has added.

Also removed the redundant checks for `my_spi` and `other_spi` being set
along with the check for the above flags. It seems that when the flags
are set, the SPIs *must* be set.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
src/libcharon/sa/child_sa.c