Re: [PATCH ipsec v2 1/2] xfrm: advance the route generation when policies are removed
From: Nicolas Dichtel
Date: Mon Nov 30 2026 - 05:08:37 EST
Le 27/11/2026 à 17:48, Ralf Lici a écrit :> Only xfrm_policy_insert and
xfrm_set_default advance the IPv4 and IPv6
> route generations. Deleting, flushing or expiring a policy does not, so
> a route that a socket cached while an allow policy without templates
> matched its flow keeps validating after that policy is removed, and the
> socket keeps sending in plaintext although a policy requiring IPsec now
> matches. xfrm_policy_insert also advances the generation before
> unlinking the policy that the new one replaces, which can still be
> matched until then, since the new policy can be linked behind it.
>
> Advance the generation once a policy is unlinked by a delete or by its
> expiry, once after all policies are unlinked by a flush, and after the
> replaced policy is unlinked by an insert. Socket policies only apply to
> their own socket and are left out.
>
> Fixes: ee8372dd1989 ("xfrm: invalidate dst on policy insertion/deletion")
> Signed-off-by: Ralf Lici <ralf@xxxxxxxxxxxxx>
Reviewed-by: Nicolas Dichtel <nicolas.dichtel@xxxxxxxxx>