From patchwork Wed Nov 11 09:22:36 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralf Lici X-Patchwork-Id: 5665 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:529c:b0:11a:a05e:cb97 with SMTP id x28csp179311lax; Wed, 11 Nov 2026 01:23:07 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErHf1yDRY+3o9g+hGJDapa4JCeIlITygnDLIRZ33dkg1EcH+in7xVSwEno9wCV19L7oWX3vZ+L29Guc=@openvpn.net X-Received: by 2002:a05:701b:42c7:20b0:149:1b5b:1f25 with SMTP id a92af1059eb24-1b3c02f369dmr1840799c88.15.1794388987490; Wed, 11 Nov 2026 01:23:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794388987; cv=none; d=google.com; s=arc-20260327; b=eZa5fYIsrcKKLk35z3tQxgbKnSvOTEKp/XBmAzJ6Xn0Gg09MHE2fwXWQK2EeujkV0/ DOFpqBIPY4VqgsSxru6giKxWq64svkbrsr0GLZN2HaOXQsfpaFlMfSNd/BsA6Uk64kjc NQp0oMw3qQw7NnqGD9NdKgTB4JEQ45RvLnu5IG/18E+PBspFcHwXsoqwNtGWY/s+Pf8k dQ7jFRlqRqxgtrXmNNtvdRgapzbKnrGz9or3cIw273mS1c/WtJ0TMLWj43Mri7xvy4FS mIEfaVC6caAh6cdnlVMrEMO9BHr0DFdRkUSJCCcL8QmBBHIVSTqklT1BjSEJRrrOtPtT woVA== 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=O3vyv5ihnOqPjNs/wWsASCyZZy4BWA3V/ecolNEBnbk=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=FiokmA9p55cHZRELI2nNPFKc35Yekcxi+/W2B3/pTKsS8yujl7Pnyvxc6MZBn9KF90 wJTfvbeiro+1Za5a2sQUdaeBxtj84sQlJoI/tQvFdGRh/GVScOaSFP9kEe/kckWO9T/7 9vS3VXi+P/jMgkt92kfxgroNeE0e5BV9LcUaTz4vbZtUInnYuqdDWq506RvGjCN7N0QG XUjZNohD928hRMErmxF8jeazm0ltpN+8dxFs+Yp/pgPeBqeiogUPftbQKvdUfSxOD5By VVb/3Picu0sc8HcJyEDVZo3urLE7KJZVaqdPFLDA97Vp78k55O+3KoMRzoMgwKC9Cqa/ 8sZA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=HoDiIX3V; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=lj6BLI2g; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=GspAkH5J; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=MBO0001 header.b=LV5QsXdy; 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-1b3b5b85c2dsi11861202c88.52.2026.11.11.01.23.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Nov 2026 01:23:07 -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=HoDiIX3V; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=lj6BLI2g; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=GspAkH5J; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=MBO0001 header.b=LV5QsXdy; 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=O3vyv5ihnOqPjNs/wWsASCyZZy4BWA3V/ecolNEBnbk=; b=HoDiIX3VnupInW P1NfnT/rxYKEcZvWhqXU+AlSTHjmkjk6spi/v1EN/rlT6BnOHw0RmXOtTrPd63WvtIPQ/K0y2f8Ky 3mZc9A6n6lpSiNJEtKMkTuWkZ3r1jxqKP6BA8+nunW+r1UxeIItHe7bLLeoMn4rQzF6m8KrcWq1AT ehI=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.100.1) (envelope-from ) id 1xR4Xq-000000005FC-1lsd; Wed, 11 Nov 2026 09:23:06 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xR4Xo-000000005En-49l9 for openvpn-devel@lists.sourceforge.net; Wed, 11 Nov 2026 09:23:05 +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=NWxzyACZrjKlNEi9Ekvf5Xkk8zf9Lmdth5Lz3f1rzZg=; b=lj6BLI2gsyCDttpm7rRKcIV67U UInArHMLlWzYM7Pwa2YCBubm48dYptFuAYc8gpGxU68To77lLVOQhqZfklRi5bm9Qwa6owYqZvZYt 7UefIkYcz+i30L8HoUc0fDmTmXtIAqcg+M6L1hrgJIzmVXBRikzj7QDqXf4Fsoj5ViOE=; 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=NWxzyACZrjKlNEi9Ekvf5Xkk8zf9Lmdth5Lz3f1rzZg=; b=GspAkH5J+zLnA9B+hycKWfElV2 tGVH7lbeqQNHpbjxDLLN1tOeUZ7IVR2EbGk7ycn5QMtjIydCD9QgJkywHufSiduiKaaOCIws2xYLe fFVmCcfKZhpvSv/m8hDeYtU1GkElQQL0oBbJhmkUKjVLJ537/DwliWs628Z3OxZkHbPo=; Received: from mout-b-202.mailbox.org ([195.10.208.62]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.100.1) id 1xR4Xk-000000000H0-2YtM for openvpn-devel@lists.sourceforge.net; Wed, 11 Nov 2026 09:23:04 +0000 Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (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-202.mailbox.org (Postfix) with ESMTPS id 4jPdND48DMzKnht for ; Wed, 11 Nov 2026 10:22:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1794388972; 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=NWxzyACZrjKlNEi9Ekvf5Xkk8zf9Lmdth5Lz3f1rzZg=; b=LV5QsXdyFO7btNoGrWvglJlSwg5JVvY9RluYO6xybS++lnvA0uI0jFdQj/J2kQRLeqV/mo U7fGIoLN0JXjsvxEui4pZSnaYkMiQQstQZ5jLJv3Fr8xy+kzGzbJ6O/lud+6RdEU/3t+d7 U8r9KpvZrNiMqYHENbvpbLRwf5+yKDDVZtMRSFIf9cjPh5ogfDz1HtuX25PaiqV01NA5G8 CFhVz5Ld608JiuTukz6uxmCumsOatqhElySMjKEHNf+4RmLeWVXHD2K0tuQOMWGciM1WtI U538R24LYGwYJ3tDp479JBIQ3IqhSC54qvaaH0mf0asYscst5ukGrUHe+0mcMw== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of ralf@mandelbit.com designates 2001:67c:2050:b231:465::202 as permitted sender) smtp.mailfrom=ralf@mandelbit.com From: Ralf Lici To: openvpn-devel@lists.sourceforge.net Date: Wed, 11 Nov 2026 10:22:36 +0100 Message-ID: <2efa96ff65307b419ee319e91eccd064db50aa27.1794388607.git.ralf@mandelbit.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: 4jPdND48DMzKnht 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_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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1xR4Xk-000000000H0-2YtM Subject: [Openvpn-devel] [PATCH ovpn net-next v3 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: 1881553227034091383 X-GMAIL-MSGID: 1881553227034091383 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 v2 https://lore.kernel.org/openvpn-devel/26279b0076d6ad26368041341247897fc1e95f08.1794329430.git.ralf@mandelbit.com/ 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 cd209298012d..913897888bbb 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -3023,6 +3023,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) @@ -3035,6 +3038,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;