From patchwork Tue Oct 28 11:33:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4532 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:2995:b0:72f:f16c:e055 with SMTP id f21csp1973140max; Tue, 28 Oct 2025 04:33:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVatnJFEaqJhkn/H8JFTN/qlYas49j4nfx78o2PWoTGJ7Z3RSHWM6evIrVtAxYXAK5JNwXNea6VgcY=@openvpn.net X-Google-Smtp-Source: AGHT+IEY+TGuigYM4bFWC47xNJ9W3mMJ/QLf7IhKgNz1FzQdcQ/91Q7BuRTUGVFIJOr4mqHck9cJ X-Received: by 2002:a05:6830:3743:b0:771:5ae2:fce0 with SMTP id 46e09a7af769-7c67813917dmr1861950a34.20.1761651213803; Tue, 28 Oct 2025 04:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1761651213; cv=none; d=google.com; s=arc-20240605; b=c9oeQSd4iasCx6VCASKqs+gs5K7SmSZJExZ0QKtimiLFZ08XJBhwo7yGoxKqeYbuw+ L9/Dq05VRI6/rOqu0sATPBigx5kJwnZ8q0cCNQP1Q2R33xW2AJZrW21ztdfmdS18Isss 02crKF3+eAQgN0PtsgeAwxfKLJ3/nNw8hdfUyHeZdDsSR1uqWpkJtxyWuHQYpnOjShSD Asx2vccUgeqPO6gDYK4Zn2Q85FXZPLludLdkHlyOVgPDgb5qGnnsye5tVSEuMWpdjadQ SreVZJEkqwbqv8nBh8uY6mNnMzTgkzhfqg2tKZVEJ7Z4vBlURnv0wYK6RaHSoCC7oLEI TQNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=AnvlAc/+qwC70+AsFrwY+gCaGvQNlYYpA3CbTxDxgTU=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=FT530MwAC1FJKQ6SD2C1ihNRDVigawjBpV8Ls0WlCib/KTBwcCe8yum1vMRHfIToH2 JWdZKLLSOhcSlYXhsgr+VZwfVL6uYcXE+KV7L6+VV5lAacb6oPagQgyb69ZYBABhDgrG EmeHeJU1xIaiYRfFGCdlnfDr5ZgpBT2pgIFBTssJTg9P7Y6LSClLnwIygPfAZqeVefc+ ld9v0EelCxaeCOxijWo12hOW91h4lvmuTWO7AeMTnzlKDO9iUFMk4eXtBGnUZOCDpTx6 69oMix/lixC8HUJ5mjJFMIMQzIwbHBiBlc3U/4hEvzGlbWk/ourLFJIhkL+gvaLiQ2LE VmTA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=giXpPqzx; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=OG98QvFi; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=QMLJZC+c; 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 46e09a7af769-7c530be0318si2513956a34.100.2025.10.28.04.33.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Oct 2025 04:33:33 -0700 (PDT) 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=giXpPqzx; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=OG98QvFi; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=QMLJZC+c; 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-Owner; bh=AnvlAc/+qwC70+AsFrwY+gCaGvQNlYYpA3CbTxDxgTU=; b=giXpPqzxzkCRzuQYHDP+Nr8B+j 8H0fzM28jflKioGnTvwSgbqS/uer7E9BBc3VS3BJas7P2GKQAd/5Gc8ZSXp8qRCjNeGCCrrLjzEZv JtPIoytz5XnWz2FNoLMXU5OT/Krw/LOF3QVKL6shOGGxOHY9ACykKJFjt/uwBr5ESwMw=; 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.95) (envelope-from ) id 1vDhxD-0006BX-8i; Tue, 28 Oct 2025 11:33:31 +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.95) (envelope-from ) id 1vDhxB-0006BL-4Y for openvpn-devel@lists.sourceforge.net; Tue, 28 Oct 2025 11:33:29 +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-Subscribe:List-Post:List-Owner:List-Archive; bh=pwo9fotLLzIuaAjiYp+qIoyNVQAvdhjr4R7do7Xid3c=; b=OG98QvFis3itJL6BYbyCp0xj7E wfs88EFPRqKLtc3uj9GlLc20sFU/Fa7gBVjYBO4TsKzHrwV7C/TdX/OURewc8UdX+re/7Ihj768SU taAWQLjds+xecTuTuxMSvHbgbuW9ZS3wYGGa1mxCRJzi7+Gue34WwMX6sMwjoJ2k/nHg=; 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-Subscribe: List-Post:List-Owner:List-Archive; bh=pwo9fotLLzIuaAjiYp+qIoyNVQAvdhjr4R7do7Xid3c=; b=QMLJZC+cOjvj8/FrP13FhSQdXy 3hQRT7p/zOJgD4nLowKuHnmMmsZcI0EBDGdHH+yjzyX12/8fy3djRaUWZP3iSe0WrVyA/wxfB+bT3 aqV5z0OuEy8c7PGU1vS26lqQ6Q65kB3zrqE/whIzSUSMg+QTLJSiOXFe9L/w1OohdGrA=; Received: from [193.149.48.134] (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.95) id 1vDhx5-0007rC-2z for openvpn-devel@lists.sourceforge.net; Tue, 28 Oct 2025 11:33:24 +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 59SBXBqv019939 for ; Tue, 28 Oct 2025 12:33:11 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 59SBXBtB019938 for openvpn-devel@lists.sourceforge.net; Tue, 28 Oct 2025 12:33:11 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Tue, 28 Oct 2025 12:33:05 +0100 Message-ID: <20251028113310.19921-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.49.1 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: Ralf Lici Commit bf01a96 introduced a bug in the dco-freebsd path by attempting to store peer statistics in a structure that only exists on server instances. This leads to a SIGSEGV on non-server instances due [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URI: openvpn.net] 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1vDhx5-0007rC-2z Subject: [Openvpn-devel] [PATCH v1] dco-freebsd: fix peer stats storage on client instances 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: =?utf-8?q?1847225182971013026?= X-GMAIL-MSGID: =?utf-8?q?1847225182971013026?= From: Ralf Lici Commit bf01a96 introduced a bug in the dco-freebsd path by attempting to store peer statistics in a structure that only exists on server instances. This leads to a SIGSEGV on non-server instances due to a NULL multi_context pointer. Resolve this by checking what mode the current instance is running in and storing peer stats accordingly. Fixes: https://github.com/OpenVPN/openvpn/issues/875 Change-Id: I92b5f3996f2a2180fa5e94719603078c1fc2f7f6 Signed-off-by: Ralf Lici Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1290 --- 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/+/1290 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c index e51f8dd..3521fca 100644 --- a/src/openvpn/dco_freebsd.c +++ b/src/openvpn/dco_freebsd.c @@ -634,7 +634,17 @@ if (nvlist_exists_nvlist(nvl, "bytes")) { - dco_update_peer_stat(dco->c->multi, dco->dco_message_peer_id, nvlist_get_nvlist(nvl, "bytes")); + const nvlist_t *bytes = nvlist_get_nvlist(nvl, "bytes"); + + if (dco->c->mode == CM_TOP) + { + dco_update_peer_stat(dco->c->multi, dco->dco_message_peer_id, bytes); + } + else + { + dco->c->c2.dco_read_bytes = nvlist_get_number(bytes, "in"); + dco->c->c2.dco_write_bytes = nvlist_get_number(bytes, "out"); + } } dco->dco_message_type = OVPN_CMD_DEL_PEER;