[Openvpn-devel,net-next,3/5] udp: detach tunnel GRO before changing UDP encapsulation
| Message ID | 99b9cccf9845899bc36e92165d9443499fe8a284.1794314969.git.ralf@mandelbit.com |
|---|---|
| State | Superseded |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net>
Delivered-To: patchwork@openvpn.net
Received: by 2002:a05:6022:20a6:b0:11a:a05e:cb97 with SMTP id 38csp991097lad;
Tue, 10 Nov 2026 04:54:44 -0800 (PST)
X-Forwarded-Encrypted: i=2;
AL+hErHW7OsLWY88U8SuZyT++ha5Uy5NV+4pZ/XDQAqtHYnWFEkM0Iiex6XIabf6gguFWC46NF0hnNZlEdQ=@openvpn.net
X-Received: by 2002:a05:7022:2514:b0:185:b157:f271 with SMTP id
a92af1059eb24-1b3b607af36mr4489368c88.23.1794315284383;
Tue, 10 Nov 2026 04:54:44 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1794315284; cv=none;
d=google.com; s=arc-20260327;
b=VBJdp1Akd6eU5N1kL89wUV/0tZhbsUNRyz58RZIcqG07dP+tZJo/pQLwvaDqgVfAj2
PYKqCF9u1IdlgDp/saQx1n5jkc1juf58HXxOJ4swb92V7fyEwQ3p6//ida/c2FdTUi4h
m9k06tLUPv2Z1B3Qw3KFcABy8I54XcKD7R/S/mV8+AcjEVz8uHtUJYRs94kxQLQkYr8x
JKeQz17tgOCtxNns/5LVJ5lrQv7Q3GtovwA3OSFTwYb3RA8lz8EJ72bDsemOVvlPkFc9
31i6wX4y1oofkVFpQSvaC6sqNrmos/vLRV5DD6vHSJWUMk4qLIlwVAeOT/Ktg6SQ4eac
l6pg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20260327;
h=errors-to:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:dkim-signature:dkim-signature:dkim-signature:dkim-signature;
bh=pKDVzIbX63cIS0nOOvLB4mNlrnKCP7Og2agKcJomO60=;
fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=;
b=OQGMf1yzfUpxXchjfEWVo5QBartJV7yA6io6RGV9vc9JmImyEu/dGHh3XQNVi5FzMF
f4j1xLBVI4EfREPnxrcKdG+ok33AWd8Hra6vm5JYtEiZA3VJ4rfd3EJEy/oJ6cu9P8Ev
d39KToTDZGngM38QG1J6L5UVs7MwPX7tn598qc0HlYRRZ5s8/R5v5eRbkclVEIYnFyic
xVPRBtStCTQ5ms340CtT+mTrioLSW5+nQtQoPl5eMeVxDbznfJSFFiQiZoDaasP3gzB9
nw0hhqvyLioXuMapA4KQKdIZds3HBvQG/+LDZorJm6cv/FzuXJhrrFNA13MK29kix0hA
oPfw==;
dara=google.com
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@lists.sourceforge.net header.s=beta
header.b=Z06Dc6rE;
dkim=neutral (body hash did not verify) header.i=@sourceforge.net
header.s=x header.b=W00m0oFE;
dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x
header.b=bTpfC3qc;
dkim=neutral (body hash did not verify) header.i=@mandelbit.com
header.s=MBO0001 header.b=vOV8xGAh;
spf=pass (google.com: domain of
openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as
permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net
Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7])
by mx.google.com with ESMTPS id
a92af1059eb24-1b3b5b818f5si6499162c88.40.2026.11.10.04.54.44
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Tue, 10 Nov 2026 04:54:44 -0800 (PST)
Received-SPF: pass (google.com: domain of
openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as
permitted sender) client-ip=216.105.38.7;
Authentication-Results: mx.google.com;
dkim=pass header.i=@lists.sourceforge.net header.s=beta
header.b=Z06Dc6rE;
dkim=neutral (body hash did not verify) header.i=@sourceforge.net
header.s=x header.b=W00m0oFE;
dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x
header.b=bTpfC3qc;
dkim=neutral (body hash did not verify) header.i=@mandelbit.com
header.s=MBO0001 header.b=vOV8xGAh;
spf=pass (google.com: domain of
openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as
permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:
List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:
Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender:
Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From:
Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post:
List-Owner; bh=pKDVzIbX63cIS0nOOvLB4mNlrnKCP7Og2agKcJomO60=; b=Z06Dc6rESRvIlB
c1Bna/GDH/mLVe1OQw2dWVOO7RQiXppwpgrDHjJIjGIMDfCCS4N/PJIP8MHWOCYiWamt9rSBF0zKy
XyRszcKQ0Ntvk16WYtgugYKRdErnIpC4veQZSNWek3/Jjy81RAxFBJZPQwyZ/QL0jqlKAsvdfGV5b
qOI=;
Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com)
by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.100.1)
(envelope-from <openvpn-devel-bounces@lists.sourceforge.net>)
id 1xQlN4-000000002Gl-3BbF;
Tue, 10 Nov 2026 12:54:42 +0000
Received: from [172.30.29.66] (helo=mx.sourceforge.net)
by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1)
(envelope-from <ralf@mandelbit.com>) id 1xQlN2-000000002GS-2B41
for openvpn-devel@lists.sourceforge.net;
Tue, 10 Nov 2026 12:54:40 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References:
In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:
Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
List-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive;
bh=8/3PaZn0SgeiLxN7L/OeSDL7Mc+IOLoQUhFbk+5cyVY=; b=W00m0oFEH08NfV97Wtz4A6JNDR
5GeA2NJA9Ao8CkaNbiCkugPcclop1PV7lz9J6OW7xyvTOrNv4EdQiRwAdxGnBSCU8SZwW3EX0YUHK
aM/Yon/oKURqojVXksx8V47YZAT3xCG6JLoTjyZULhUbO0VRqgpVu4GL55WHjiKOFd/4=;
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x
;
h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:
Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID:
Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Unsubscribe-Post:
List-Subscribe:List-Post:List-Owner:List-Archive;
bh=8/3PaZn0SgeiLxN7L/OeSDL7Mc+IOLoQUhFbk+5cyVY=; b=bTpfC3qcD5Ja8l5N+m1DEAJKHo
PXg/BJvfWLOq7jigPGe39aMZ9Of7YqQZ6E0a8b5NJhQ/vDXMnyZLvqkAav9Jp0sCGgaprmKEhTyJk
IpVzA/OMhNpu6rhMwdEF3KZmuVp4VQq83pO5t0lGy5iV9dYlKWb2VWTs4e9OYo9tiVok=;
Received: from mout-b-210.mailbox.org ([195.10.208.40])
by sfi-mx-1.v28.lw.sourceforge.com with esmtps
(TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.100.1)
id 1xQlN0-0000000069A-0x4o for openvpn-devel@lists.sourceforge.net;
Tue, 10 Nov 2026 12:54:40 +0000
Received: from smtp102.mailbox.org (smtp102.mailbox.org
[IPv6:2001:67c:2050:b231:465::102])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits)
server-digest
SHA256) (No client certificate requested)
by mout-b-210.mailbox.org (Postfix) with ESMTPS id 4jP66t2rSMzFphR
for <openvpn-devel@lists.sourceforge.net>;
Tue, 10 Nov 2026 13:54:30 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com;
s=MBO0001; t=1794315270;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=8/3PaZn0SgeiLxN7L/OeSDL7Mc+IOLoQUhFbk+5cyVY=;
b=vOV8xGAhVjA/R3MqiT5sG+Av69ztrGdf1VhJquhtOCLvNaMr7VFKaB2yj7e2wSJiQbVGBM
+3A4E3fHrmZX26VqIM8zDKJc9LkwX6vLmqWx1JoysRWRE28WWYYCby4sqJtM4l0AKTP1Pg
JVgi93i9UtZ1bD/yT7CDOkzWceYxcNcSdVPHHFfAc1cpLIdYGOmksS9Xm89RKRJaBecBqN
4Ot+47iWnNTkIUYtZpREUI/aNdUBTgLdyeUc27HzOeZbpvQ5U5B20abx/voXQ4BH/8z67X
l836hC/E9XTO6BpmGdFhKuBPXIogmZntjDa7WP4s5MaVzIzs+ap/mldo0MKORw==
Authentication-Results: outgoing_mbo_mout; dkim=none;
spf=pass (outgoing_mbo_mout: domain of ralf@mandelbit.com designates
2001:67c:2050:b231:465::102 as permitted sender)
smtp.mailfrom=ralf@mandelbit.com
From: Ralf Lici <ralf@mandelbit.com>
To: openvpn-devel@lists.sourceforge.net
Date: Tue, 10 Nov 2026 13:54:20 +0100
Message-ID:
<99b9cccf9845899bc36e92165d9443499fe8a284.1794314969.git.ralf@mandelbit.com>
X-Mailer: git-send-email 2.56.0
In-Reply-To: <cover.1794314969.git.ralf@mandelbit.com>
References: <cover.1794314969.git.ralf@mandelbit.com>
MIME-Version: 1.0
X-Rspamd-Queue-Id: 4jP66t2rSMzFphR
X-Spam-Score: -0.2 (/)
X-Spam-Report: Spam detection software,
running on the system "sfi-spamd-1.hosts.colo.sdot.me",
has NOT identified this incoming email as spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: A UDP socket may retain a detachable tunnel GRO callback
while
it remains visible to userspace. If userspace subsequently changes UDP_ENCAP,
replacing the encapsulation callbacks without first retirin [...]
Content analysis details: (-0.2 points, 5.0 required)
pts rule name description
---- ----------------------
--------------------------------------------------
-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's
domain
0.1 DKIM_SIGNED Message has a DKIM or DK signature,
not necessarily valid
-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
-0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from
envelope-from domain
X-Headers-End: 1xQlN0-0000000069A-0x4o
Subject: [Openvpn-devel] [PATCH ovpn net-next 3/5] udp: detach tunnel GRO
before changing UDP encapsulation
X-BeenThere: openvpn-devel@lists.sourceforge.net
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: <openvpn-devel.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/options/openvpn-devel>,
<mailto:openvpn-devel-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive:
<http://sourceforge.net/mailarchive/forum.php?forum_name=openvpn-devel>
List-Post: <mailto:openvpn-devel@lists.sourceforge.net>
List-Help: <mailto:openvpn-devel-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/openvpn-devel>,
<mailto:openvpn-devel-request@lists.sourceforge.net?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: openvpn-devel-bounces@lists.sourceforge.net
X-getmail-retrieved-from-mailbox: Inbox
X-GMAIL-THRID: 1881475943494250336
X-GMAIL-MSGID: 1881475943494250336
|
| Series |
ovpn: construct and process GRO batches
|
|
Commit Message
Ralf Lici
Nov. 10, 2026, 12:54 p.m. UTC
A UDP socket may retain a detachable tunnel GRO callback while it
remains visible to userspace. If userspace subsequently changes
UDP_ENCAP, replacing the encapsulation callbacks without first retiring
GRO leaves the old callback lifetime and frag-list acceptance state
active.
Validate the requested encapsulation type, then detach such a GRO
callback before installing the new encapsulation implementation.
Existing sockets are unaffected because no current user enables
detachable GRO callbacks.
UDP_ENCAP already permits userspace to change the encapsulation type of
a live socket even when driver state remains attached to it. Resolving
that pre-existing ownership issue is outside the scope of this change.
This only keeps detachable GRO state and callback lifetimes consistent
when the existing transition occurs; it does not make cross-encapsulator
ownership handoff supported.
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
---
net/ipv4/udp.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 9b17ae823e56..db0b60ae6859 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -2999,6 +2999,9 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, case 0: #ifdef CONFIG_XFRM case UDP_ENCAP_ESPINUDP: + if (udp_test_bit(GRO_RCV_DETACHABLE, sk)) + udp_tunnel_detach_gro(sk); + set_xfrm_gro_udp_encap_rcv(val, sk->sk_family, sk); #if IS_ENABLED(CONFIG_IPV6) if (sk->sk_family == AF_INET6) @@ -3011,6 +3014,9 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, #endif fallthrough; case UDP_ENCAP_L2TPINUDP: + if (udp_test_bit(GRO_RCV_DETACHABLE, sk)) + udp_tunnel_detach_gro(sk); + WRITE_ONCE(up->encap_type, val); udp_tunnel_encap_enable(sk); break;