From: Antonio Quartulli <antonio@openvpn.net>
To: Sabrina Dubroca <sd@queasysnail.net>
Cc: netdev@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Donald Hunter <donald.hunter@gmail.com>,
Shuah Khan <shuah@kernel.org>,
ryazanov.s.a@gmail.com, Andrew Lunn <andrew+netdev@lunn.ch>,
Simon Horman <horms@kernel.org>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
Xiao Liang <shaw.leon@gmail.com>
Subject: Re: [PATCH net-next v20 09/25] ovpn: implement basic RX path (UDP)
Date: Mon, 3 Mar 2025 15:47:21 +0100 [thread overview]
Message-ID: <26dbc569-4566-4f6c-9294-5129befbc6ff@openvpn.net> (raw)
In-Reply-To: <Z8HVZm_eQwNR_r1A@hog>
On 28/02/2025 16:25, Sabrina Dubroca wrote:
> (I'm still reviewing how everything fits together, but one small thing
> here:)
>
> 2025-02-27, 02:21:34 +0100, Antonio Quartulli wrote:
>> +static void ovpn_udp_close(struct sock *sk, long timeout)
>> +{
>> + struct ovpn_socket *sock;
>> + struct ovpn_priv *ovpn;
>> +
>> + rcu_read_lock();
>> + sock = rcu_dereference_sk_user_data(sk);
>> + if (!sock || !sock->ovpn) {
>> + rcu_read_unlock();
>> + return;
>> + }
>> + ovpn = sock->ovpn;
>> + rcu_read_unlock();
>> +
>> + if (ovpn->mode == OVPN_MODE_P2P)
>> + ovpn_peer_release_p2p(ovpn, sk,
>> + OVPN_DEL_PEER_REASON_TRANSPORT_DISCONNECT);
>> + sock->udp_prot->close(sk, timeout);
>> +}
>> +
>> +static void ovpn_udp_build_protos(struct proto *new_prot,
>> + const struct proto *orig_prot)
>> +{
>> + memcpy(new_prot, orig_prot, sizeof(*new_prot));
>> + new_prot->close = ovpn_udp_close;
>> +}
>
> Could you set ->encap_destroy in udp_tunnel_sock_cfg, instead of
> making up your own struct proto? It should allow to do basically the
> same thing, but with less code in ovpn:
>
> ->close = udp_lib_close -> sk_common_release -> sk_prot->destroy = udp_destroy_sock -> encap_destroy
Oh, this is very nice.
I'll give it a go and stick to encap_destroy if no issue arise.
Cheers,
>
>
--
Antonio Quartulli
OpenVPN Inc.
next prev parent reply other threads:[~2025-03-03 14:47 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 1:21 [PATCH net-next v20 00/25] Introducing OpenVPN Data Channel Offload Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 01/25] mailmap: remove unwanted entry for Antonio Quartulli Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 02/25] net: introduce OpenVPN Data Channel Offload (ovpn) Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 03/25] ovpn: add basic netlink support Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 04/25] ovpn: add basic interface creation/destruction/management routines Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 05/25] ovpn: keep carrier always on for MP interfaces Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 06/25] ovpn: introduce the ovpn_peer object Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 07/25] ovpn: introduce the ovpn_socket object Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 08/25] ovpn: implement basic TX path (UDP) Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 09/25] ovpn: implement basic RX " Antonio Quartulli
2025-02-28 15:25 ` Sabrina Dubroca
2025-03-03 14:47 ` Antonio Quartulli [this message]
2025-02-27 1:21 ` [PATCH net-next v20 10/25] ovpn: implement packet processing Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 11/25] ovpn: store tunnel and transport statistics Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 12/25] ovpn: implement TCP transport Antonio Quartulli
2025-03-02 18:59 ` Sabrina Dubroca
2025-03-02 20:59 ` Antonio Quartulli
2025-03-03 15:08 ` Sabrina Dubroca
2025-03-03 15:48 ` Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 13/25] skb: implement skb_send_sock_locked_with_flags() Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 14/25] ovpn: add support for MSG_NOSIGNAL in tcp_sendmsg Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 15/25] ovpn: implement multi-peer support Antonio Quartulli
2025-03-03 13:08 ` Sabrina Dubroca
2025-03-03 14:45 ` Antonio Quartulli
2025-03-03 15:38 ` Sabrina Dubroca
2025-02-27 1:21 ` [PATCH net-next v20 16/25] ovpn: implement peer lookup logic Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 17/25] ovpn: implement keepalive mechanism Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 18/25] ovpn: add support for updating local UDP endpoint Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 19/25] ovpn: add support for peer floating Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 20/25] ovpn: implement peer add/get/dump/delete via netlink Antonio Quartulli
2025-03-02 18:24 ` Sabrina Dubroca
2025-03-02 21:00 ` Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 21/25] ovpn: implement key add/get/del/swap " Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 22/25] ovpn: kill key and notify userspace in case of IV exhaustion Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 23/25] ovpn: notify userspace when a peer is deleted Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 24/25] ovpn: add basic ethtool support Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 25/25] testing/selftests: add test tool and scripts for ovpn module Antonio Quartulli
2025-02-27 16:21 ` [PATCH net-next v20 00/25] Introducing OpenVPN Data Channel Offload Jakub Kicinski
2025-02-28 14:21 ` Antonio Quartulli
2025-02-28 1:40 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=26dbc569-4566-4f6c-9294-5129befbc6ff@openvpn.net \
--to=antonio@openvpn.net \
--cc=andrew+netdev@lunn.ch \
--cc=donald.hunter@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ryazanov.s.a@gmail.com \
--cc=sd@queasysnail.net \
--cc=shaw.leon@gmail.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox