From patchwork Tue Nov 10 17:06:20 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralf Lici X-Patchwork-Id: 5661 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:20a6:b0:11a:a05e:cb97 with SMTP id 38csp1374543lad; Tue, 10 Nov 2026 09:07:08 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErHZ5jTVrFazjMEJpq4+EsAYsgiDWgFkJGg7fGX2/eXiGxT+jXuokuUiGQYq9fMgwlFUpET7MCGiPGE=@openvpn.net X-Received: by 2002:a05:7300:b088:b0:36a:2289:c599 with SMTP id 5a478bee46e88-3751f560fb2mr3875087eec.29.1794330412802; Tue, 10 Nov 2026 09:06:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794330412; cv=none; d=google.com; s=arc-20260327; b=f7psQgnV9hZfcJuuUamPzuu0Gsa17v7BDV1j2zgbMq/ek+V91XzX4PuzBMih1RkyzV YcgrvmAAG1zLNG021luM9gdwWjXloHeToRjeVLTjwP9p0JUkD92OYg1HlIJ88q+JWoqS 3bKym25r/yMbmHz59fU3hyIVBqQ7zKnFntP61DVlA6JsNG0FgyaBozQWkq2BcJI1hfNj ymlRPNdGTdruBQoQWOg1S5WBRHrfotJZUsHVLEUrULX9D627P4+1SJ8Y7/ll+aNAuE4U W8EfkWK7hHSuXquPhl4NmobHGhuioTVx4NFtR2sBCFAjIkK/VVXwEI7mcdpWCM4UppEy +xLQ== 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=D8/VcxK/emqD0ajxYonZQkqro+3Tm19wk10BOBk1SYQ=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=HAWYj9mJmrz86o44WLqBcobktmvM6eUXTKFZdRDVU92l7jgKnLkA1MtSz3j1MVBry1 IeTQklrXFmo3ZWe73B0y4qAdonePrZX/Ymat92XpwwSxoqTjFasxM3VW4/jwVzhfruUn nRtbAqcqYZvJR+tEAw1/lXxGZnpoRjjnrSUXjZqhowlvv11sTM83VBU/ZjpBcND6hNKV Py9uVbiwcEobCVedNPqxm4CLSQTx+XQVEntUC1jUajLuMjBkswChG24yaMmucbTFFD3f Mjk78cKRx3qcLwCcPbwJ6cu5Lwj14vAgoChlXrDTfL9iXhV1StMeXeAqXaDp5PpPopAs dcJw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=Tw+PUrzY; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="ZUXhx/C6"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=XkPJK8mD; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=MBO0001 header.b=sWtZZjqw; 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 5a478bee46e88-3751dce49a5si8959065eec.10.2026.11.10.09.06.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Nov 2026 09:06:52 -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=Tw+PUrzY; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="ZUXhx/C6"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=XkPJK8mD; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=MBO0001 header.b=sWtZZjqw; 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=D8/VcxK/emqD0ajxYonZQkqro+3Tm19wk10BOBk1SYQ=; b=Tw+PUrzYzPFeje yIhiVQ+89nvFpUdV4Z6NwsOwHhHgqMlLxdoLenGHwUWjkC7SRhvDKnM8Zi7dAo+GNa2LZMmLM2+YE eeO3xd37EUeB+m866817PEII+1mGup50GjYCiSsAtWT0vSea4tyxExgdKz8vxEHZPWlChlP9Jjxzm CEo=; Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.100.1) (envelope-from ) id 1xQpJ4-000000007gL-3yS2; Tue, 10 Nov 2026 17:06:50 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xQpJ0-000000007g9-0mXe for openvpn-devel@lists.sourceforge.net; Tue, 10 Nov 2026 17:06:46 +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=cXcyzr/XZayzcoifNZLbAB0Ma50LPnREs4z0RZ3grpY=; b=ZUXhx/C6SKI3KsLnqw5Dre7SRG haQAbz4rxh7nta8cOnHnBoeqdZuZbmY0rSF+DCVQrgYxQVDHUVPNXIcGtOq6ts/XG/VHcy6dV09Fx VqCFaVa8sDIY2YDfyJJlOzQgAhLddq4FJKtisKXrMSmCUyGcB+HCW9AmJGDGte5yEst0=; 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=cXcyzr/XZayzcoifNZLbAB0Ma50LPnREs4z0RZ3grpY=; b=XkPJK8mDt7Hb7OsSbMxcEZkfEg H5UrGWc1ZcLWFRysf5d5Xz01iSd60i6ojQT1JObs8z4tvI49uCJbxXxt2W7mkxdYB4w2Gufr5pI21 +PRhmZJB7JROo87Is95301seDlTsZpUgX2A8+7Z2mIkERsQgDlugHPdAv04uSLZxxNn4=; Received: from mout-b-210.mailbox.org ([195.10.208.40]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.100.1) id 1xQpIy-000000004PW-3Rea for openvpn-devel@lists.sourceforge.net; Tue, 10 Nov 2026 17:06:46 +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 4jPCjl5qZwzFqsV for ; Tue, 10 Nov 2026 18:06:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1794330395; 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=cXcyzr/XZayzcoifNZLbAB0Ma50LPnREs4z0RZ3grpY=; b=sWtZZjqwaHK10hdxtKQlHFgXnw33NSbmxlapSFM4X6zqIzThjOevX2Te9dJr8NCIa1jTyV MAyfkH2Mojql8syBJsKrWuGnHKdGM9iUQgBcvSCTg29CfrpkngorDJe+KiYFF1sAaahx0V fmOSgiSIq6ZHnzuqSDUC8gHS013BWOxm32MLJ6aPzGEuEFHq2PnMcCxN1MoBIovMv0f/eK 73bzwYAoMArQLDx4GaOhr+DnckYmjTs0GOZizagGpphWJfOyCXeypHPo5nESRnvAjC3/gD t2c2EHaTV1wmOwfweqZAL0Yj0j9iUj2mr9zKXIsGNDpHo2Jm2RxbPc88ihg4yQ== 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 To: openvpn-devel@lists.sourceforge.net Date: Tue, 10 Nov 2026 18:06:20 +0100 Message-ID: <26279b0076d6ad26368041341247897fc1e95f08.1794329430.git.ralf@mandelbit.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: 4jPCjl5qZwzFqsV X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-2.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_EF Message has a valid DKIM or DK signature from envelope-from domain -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 X-Headers-End: 1xQpIy-000000004PW-3Rea Subject: [Openvpn-devel] [PATCH ovpn net-next v2 4/6] 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: 1881491806810981672 X-GMAIL-MSGID: 1881491806810981672 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 --- No changes since v1 https://lore.kernel.org/openvpn-devel/99b9cccf9845899bc36e92165d9443499fe8a284.1794314969.git.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 d62452c0f663..2d16a220c42d 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -3019,6 +3019,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) @@ -3031,6 +3034,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;