Re: [PATCH v14 net-next 09/23] net/tcp: Add TCP-AO sign to twsk
From: Eric Dumazet <edumazet@google.com>
Date: 2023-10-11 18:10:37
Also in:
lkml
On Tue, Oct 10, 2023 at 1:07 AM Dmitry Safonov [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Add support for sockets in time-wait state. ao_info as well as all keys are inherited on transition to time-wait socket. The lifetime of ao_info is now protected by ref counter, so that tcp_ao_destroy_sock() will destruct it only when the last user is gone. Co-developed-by: Francesco Ruggeri <redacted> Signed-off-by: Francesco Ruggeri <redacted> Co-developed-by: Salam Noureddine <redacted> Signed-off-by: Salam Noureddine <redacted> Signed-off-by: Dmitry Safonov <redacted> Acked-by: David Ahern <dsahern@kernel.org> --- include/linux/tcp.h | 3 ++ include/net/tcp_ao.h | 11 ++++- net/ipv4/tcp_ao.c | 46 +++++++++++++++++--- net/ipv4/tcp_ipv4.c | 92 +++++++++++++++++++++++++++++++--------- net/ipv4/tcp_minisocks.c | 4 +- net/ipv4/tcp_output.c | 2 +- net/ipv6/tcp_ipv6.c | 72 ++++++++++++++++++++++--------- 7 files changed, 181 insertions(+), 49 deletions(-)diff --git a/include/linux/tcp.h b/include/linux/tcp.h index c38778b0baa0..51458219be4e 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h@@ -512,6 +512,9 @@ struct tcp_timewait_sock { #ifdef CONFIG_TCP_MD5SIG struct tcp_md5sig_key *tw_md5_key; #endif +#ifdef CONFIG_TCP_AO + struct tcp_ao_info __rcu *ao_info; +#endif }; static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk)diff --git a/include/net/tcp_ao.h b/include/net/tcp_ao.h index 629ab0365b83..af2caf7e76fc 100644 --- a/include/net/tcp_ao.h +++ b/include/net/tcp_ao.h@@ -85,6 +85,7 @@ struct tcp_ao_info { __unused :31; __be32 lisn; __be32 risn; + atomic_t refcnt; /* Protects twsk destruction */
This needs to be a refcount_t