]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Merge branch 'ref-overflows'
authorTobias Brunner <tobias@strongswan.org>
Fri, 16 Feb 2024 13:04:45 +0000 (14:04 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 16 Feb 2024 13:06:17 +0000 (14:06 +0100)
Different users in the strongSwan code base use the refcount helpers to
allocate incrementing unique values. So far the risk of overflows for
these unsigned 32-bit values has been considered mostly theoretical, as
it requires a longer uptime and a lot of activity to hit such an overflow.

At least for the Netlink sequence numbers, this is not only theoretical,
though, and an overflow has been hit on a productive setup. Unfortunately,
the consequences are rather unpleasant, as the response with a zero
sequence number can't be matched to the request. This results in the
offending thread to block indefinitely while holding the Netlink mutex.

So add a helper to allocate incrementing unique identifiers that checks
for overflows and never returns 0. Use it for Netlink sequence numbers
and some other potential users affected, namely those allocating
IKE_SA/CHILD_SA unique identifiers, marks and interface identifiers.

Closes strongswan/strongswan#2062


Trivial merge