Re: [PATCH v2 08/17] net: psp: add socket security association code

Willem de Bruijn
2025-06-26T02:09:48Z

Daniel Zahka wrote:
> From: Jakub Kicinski <kuba@kernel.org>
>
> Add the ability to install PSP Rx and Tx crypto keys on TCP
> connections. Netlink ops are provided for both operations.
> Rx side combines allocating a new Rx key and installing it
> on the socket. Theoretically these are separate actions,
> but in practice they will always be used one after the
> other. We can add distinct "alloc" and "install" ops later.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com>
> Co-developed-by: Daniel Zahka <daniel.zahka@gmail.com>

> +static inline bool psp_is_nondata(struct sk_buff *skb, struct psp_assoc *pas)
> +{
> + bool fin = !!(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN);
> + u32 end_seq = TCP_SKB_CB(skb)->end_seq;
> + u32 seq = TCP_SKB_CB(skb)->seq;
> + bool pure_fin;
> +
> + pure_fin = fin && end_seq - seq == 1;
> +
> + return seq == end_seq || (pure_fin && seq == pas->upgrade_seq);
> +}

Minor: with that test against pas->upgrade_seq this function does more
than its name implies. Maybe psp_is_allowed_nondata_at_upgrade or so.