(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 -- Sabrina