Re: [REGRESSION] Discussion on "xfrm: Duplicate SPI Handling"

Tobias Brunner
2026-02-10T10:24:19Z

Hi Yan,

>> To clarify, how are larval outbound SAs created in Android?
>> Are they created with zero or non-zero SPIs? Multiple zero SPIs (acquire states) are allowed.
>
> In Android, larval outbound SAs are created with non-zero SPIs because
> Android userspace uses XFRM_MSG_ALLOCSPI to manually reserve a unique
> value before the SA is fully finalized. These are not kernel-generated
> "acquire" states.

Could you clarify what exactly the reasoning is behind this? Do you use
this for every outbound SA or just for special use cases? Do you set
the same SPI for in- and outbound SA? (If so, what happens later when
the SPI of the outbound SA is received from the peer?) Or do you use
ALLOCSPI once you already know the peer's SPI? (And only run into the
issue if both allocate the same SPI by chance.) If so, why would you
use ALLOCSPI and not just install the outbound SA? Is it to avoid
differences for in- and outbound SAs (ALLOCSPI+UPDSA vs. NEWSA)?

Regards,
Tobias