From patchwork Tue Dec 1 14:28:04 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5831 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:91c9:10b0:11b:d6c:f273 with SMTP id tl9-n1csp14776031lad; Tue, 1 Dec 2026 06:28:23 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErGxlO6KdE892WcnpgPxbw3gnf8CVDTPbyiz0FsI/goivLqihopV/pysqjJ6fDlmY7f9f0iccFOXN7w=@openvpn.net X-Received: by 2002:a05:6a21:139a:b0:3fe:81b:5194 with SMTP id adf61e73a8af0-4014e45f92cmr39946723637.62.1796135303230; Tue, 01 Dec 2026 06:28:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1796135303; cv=none; d=google.com; s=arc-20260327; b=Fu3WY6/gtt6BdyjOVuG9eR4iohTP0cO7qsb64kXTkZUZEhxdHP+WCPeF3EUdCfg1e7 ZKvdm+kbs3E445Kc1QWOarJI5WPnqnez455KCkvonDXiVV5RkVGRw/GIlZrT6SyG+x4W icP8S9El6dyTGaj2UldlKF2C7xsY1e2hvK80l0vOR0o3Jfo2UOOtHVAvM/KdnZhNNykq ymIovZ9QE3HGpQN8f0y5J1hVjmZfSoYhIcNplW4De5vaEHx8a4qAuaZBuAdgdTi00vUe NPKnQZQ/gpMHxakB5R+F5CLXxfK7w8Eg7wLhHg+S/RhzZeWR57OcdvuIKdwqS/b1f2Hv esEw== 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; bh=59eZkGp1g/GEVsTuDtAbY3l69c5Itc+lL3E/HZPcl14=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=IeeFwfb8VjcECRR1Io1owXX5mpT5J6uDAGWzhq8omNR9n0VvBRFJgGowNQBaulOv2s edWorYXQanyknktNBICvXsh3/bS+mwKZzoBMoP/ZVQtHgQAsFI3oZlR7FDVIxyQWap02 bDzhceEECilb5v7TOSlrMZMy0HVlkzvucq05OhMYoKqfsZqwZyth5hAA2IdG6Lojcxc7 StOeyW8zLEuISscWCGhbCsqfoOF470XqACKXzRYAS4votwVb8P/VCpkLANQdQUC933lT lSbbTbNOq823gbOp8AT6bhkrWf83Aj6bi85YOx1XA1/+2n0hO+qbArSQhl0ND2ZymYW2 Idyw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=NMdHFMHj; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=OFnus7m5; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=ftLmlvi6; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id d2e1a72fcca58-8cf660060f3si46536156b3a.141.2026.12.01.06.28.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Dec 2026 06:28:23 -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=NMdHFMHj; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=OFnus7m5; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=ftLmlvi6; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de 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=59eZkGp1g/GEVsTuDtAbY3l69c5Itc+lL3E/HZPcl14=; b=NMdHFMHjVZbdEI 2imFJrgIylXSXVqaxI7OrHvP7sqT5OMbTHMSyzyjpvBUlzkMskniqownjgDNZWYd50j67unyYYHEY 9JJ4zuJdlsh4wrXB4057/TEi35EMNV+ltRYSLsKdL5SmidEBHi9KO22B+jzUdcNfgJoXTsCv/fd6I XEE=; Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.100.1) (envelope-from ) id 1xYOqC-000000004Dg-3fBd; Tue, 01 Dec 2026 14:28:20 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xYOqB-000000004DY-252s for openvpn-devel@lists.sourceforge.net; Tue, 01 Dec 2026 14:28:19 +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=es/71Sn/HQwsyq3s0okFGcxiQDcjHqRVmoUTq9HZMoM=; b=OFnus7m5ceq6m0gMcC+VwLYK01 QlXzze+EDxSHpucdJ3XCY51aflgZg0nCzNWDGjEbGPVtmgCd38c0oVBpF2Q/eOJ3TewJfwZb5KdQB PqlccEDry0JAoKTMzwuMspuvhUX3Qfk23fIeZNMm4tqxutOe9Rc4p8L+8hq/7AAHTjcs=; 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=es/71Sn/HQwsyq3s0okFGcxiQDcjHqRVmoUTq9HZMoM=; b=ftLmlvi6Q0t1fgEYIT5FFmUcsH 9s8gJethmPZtYQ7ARQbbW9AIOU6F2msIR6IARbeLk4jYdJtsnP+g+CBBfL/GdngM6rZo2XzLKg/zS lasAmfbUCsvsbJiAvi6zEzvvahfZ4YF/VF3z0EJzv7Z/LG+m4Lb1PZEemtI8FkmQO+v0=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.100.1) id 1xYOq8-000000001P3-1g5z for openvpn-devel@lists.sourceforge.net; Tue, 01 Dec 2026 14:28:19 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 6B1ES9rq030826 for ; Tue, 1 Dec 2026 15:28:09 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 6B1ES9ED030825 for openvpn-devel@lists.sourceforge.net; Tue, 1 Dec 2026 15:28:09 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Tue, 1 Dec 2026 15:28:04 +0100 Message-ID: <20261201142809.30808-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.55.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) 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: From: Razvan Cojocaru A broadcast or multicast packet is queued once and shared by all recipients. With compress, compress stub or compress lz4 the byte swap framing rewrites the packet in place, so every recipient after t [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1xYOq8-000000001P3-1g5z Subject: [Openvpn-devel] [PATCH v2] multi: don't let compression corrupt queued broadcast packets 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: 1883384371907116057 X-GMAIL-MSGID: 1883384371907116057 From: Razvan Cojocaru A broadcast or multicast packet is queued once and shared by all recipients. With compress, compress stub or compress lz4 the byte swap framing rewrites the packet in place, so every recipient after the first got it with its first byte replaced by 0xFB. In TAP mode this broke ARP and DHCP broadcasts for all clients but one. In TUN mode the client's kernel rejected the packet, logged as "write to TUN/TAP: Invalid argument". When the recipient uses the byte swap, copy a buffer that is still queued for other recipients before handing it to encrypt_sign(). GitHub: closes OpenVPN/openvpn#461 Change-Id: I8d424804372707a23fdc6fe77163cffabf72ea00 Signed-off-by: Razvan Cojocaru Acked-by: Antonio Quartulli Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2377 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2377 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Antonio Quartulli diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index 900b5a3..a71a484 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -3757,6 +3757,20 @@ { unsigned int pip_flags = PIPV4_PASSTOS | PIPV6_ICMP_NOHOST_SERVER; +#ifdef USE_COMP + /* the compression byte swap changes the packet in place, so + * don't let it touch a buffer that other recipients still have + * queued */ + const struct compress_context *comp = item.instance->context.c2.comp_context; + if (item.buffer->refcount > 1 && comp && (comp->flags & COMP_F_SWAP)) + { + struct mbuf_buffer *mb = mbuf_alloc_buf(&item.buffer->buf); + mb->flags = item.buffer->flags; + mbuf_free_buf(item.buffer); + item.buffer = mb; + } +#endif + set_prefix(item.instance); item.instance->context.c2.buf = item.buffer->buf; if (item.buffer->flags