| Message ID | 20250902150848.14160-1-gert@greenie.muc.de |
|---|---|
| State | Superseded |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net>
Delivered-To: patchwork@openvpn.net
Received: by 2002:a05:7000:2a1c:b0:671:5a2c:6455 with SMTP id
k28csp1875446maz;
Tue, 2 Sep 2025 08:09:14 -0700 (PDT)
X-Forwarded-Encrypted: i=2;
AJvYcCUXZPCoefmQLxzbySXRrbVt4ly6rTeJXCNT195/kPPgyx2o1usC3UAFQGVsJW9bC0uiUckUMCmZvtA=@openvpn.net
X-Google-Smtp-Source:
AGHT+IGvl0nwRp68vJHS7wBEmliOwv86ibaTLxlideHxVHIF+Z+zoocKsGo379bcEFGKpTR/sncl
X-Received: by 2002:a05:6808:4fe7:b0:434:f1b:1a83 with SMTP id
5614622812f47-437f7d62838mr5080770b6e.31.1756825754179;
Tue, 02 Sep 2025 08:09:14 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1756825754; cv=none;
d=google.com; s=arc-20240605;
b=WP0U3yxYey429fCKCXIAdO8QXXMpSCLZcR4HP5BeVxANSOpasHjgMF/iRqU9XhUjkf
J5+O78V34+SvkCuB/FpG+/kc156w5dTmfafUOo+H1lro502VFgl5wkqJODL8VrYwe873
DDYHaAm44pMUX7o8GDabtX6casFrfBxaBTHzABgiMyLEzwfD+xi1jcjZAUJHwBfnG/+1
pw8LmGcKeJ1i6gvyEUL9sqFsypwHiFc8vYtbJLHtVVqkg+ZH1E5lOgoI7gDDDZyJsVzH
Tx6+Dsj7cEFOoDY5/4wonuLm3Goog6+HxNMduLpcmiITGPMvnzejAerDFmo89O1EqwCC
yWrA==
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=xPsPgt3VL45dxEfXe2L9j7KBcbrkgvR9bYkf72+aExM=;
fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=;
b=NCvARvLZ3NOOTysl+5QI9K3A/shwlOK/ihEy+q15837C1KmeCoynGd3dOvJ/dfs8VK
stZR7uk96lWblntoHNgtFiUWfB1V0R6XLwP+hHqS+q5bhWBOxIGynZnubRCMfVFlEq2+
vjkAHsJ0HgbD0tYVNXB5W94U8jaL9eTqExghdL/XjO3byBiz+OAwSVrnwroQUzkX6zzu
wJyOxg4NK0FqGgiDtCQWDMwvhJ5kLdGw566lbsz3M9bFT+Pt6b51hTHnjxRxCxHNFYlJ
PmHhr9F2ZZ5yyU7v/4aed47rHXooahlCeQV5ueMXtZrvcXgwA7MMz0kCZm5ZUitxrK8n
awcg==;
dara=google.com
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@lists.sourceforge.net header.s=beta
header.b="aO/CoRa+";
dkim=neutral (body hash did not verify) header.i=@sourceforge.net
header.s=x header.b=Ws+MEcar;
dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x
header.b=l0BWJ2yr;
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
5614622812f47-437ffec0760si1194193b6e.90.2025.09.02.08.09.13
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Tue, 02 Sep 2025 08:09:14 -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="aO/CoRa+";
dkim=neutral (body hash did not verify) header.i=@sourceforge.net
header.s=x header.b=Ws+MEcar;
dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x
header.b=l0BWJ2yr;
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=xPsPgt3VL45dxEfXe2L9j7KBcbrkgvR9bYkf72+aExM=; b=aO/CoRa+p7dIaJa7JHoulzpFSy
7084dziRVIMfoKbaivbCw/a+seXJYV5xhlV8rGzyACztZHD+0hBZAgbwSwtGagk5m6NtXGotGSgxg
hto/5a32qIUAkDbnVK7vO7A48eEvS9osi8dc2yg65naN6mbC8WA7vJmOOBbGheBJ0GuI=;
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.95)
(envelope-from <openvpn-devel-bounces@lists.sourceforge.net>)
id 1utSdB-0000tS-3k;
Tue, 02 Sep 2025 15:09:09 +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.95)
(envelope-from <gert@blue4.greenie.muc.de>) id 1utSd4-0000t9-FS
for openvpn-devel@lists.sourceforge.net;
Tue, 02 Sep 2025 15:09:02 +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=mUo82kX5a3z5p+NMYh2ie65tskvel1yMfY6SAB8JmEQ=; b=Ws+MEcarsYY1lwj/1zdzmHDXN3
lMjUOcu8Cf36MXIo3SXxGMJ0P0YHnS7EYp3RJnaSQRP7jHT4tmQiBmAERuIHPsHG5/9zUWmkZ5uUC
iQKCLWUlZLAYzYrItZU1+7RI/Vkfmwk2k/51gLlqskUBhdg+agCSspcoX9GouDTCOvDo=;
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=mUo82kX5a3z5p+NMYh2ie65tskvel1yMfY6SAB8JmEQ=; b=l0BWJ2yrMtJuOboSbXoy0utLy1
I+pgU7ihuvkJ7h/wHKqHxp4rbi5r2xAY+jLa+NViEKsoEkRO/Wba9x8Pwq3AHzAvUWNqETZ3ljjuM
cS+Cn/jx3nIWNZhrIYchWvoaXFHSFSYzR5YmxwlPTXChbI1p+qdwx68fc2t/+ft+hkO8=;
Received: from [193.149.48.143] (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 1utSd2-00026Z-93 for openvpn-devel@lists.sourceforge.net;
Tue, 02 Sep 2025 15:09:02 +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 582F8mt8014180
for <openvpn-devel@lists.sourceforge.net>; Tue, 2 Sep 2025 17:08:48 +0200
Received: (from gert@localhost)
by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 582F8mZZ014179
for openvpn-devel@lists.sourceforge.net; Tue, 2 Sep 2025 17:08:48 +0200
From: Gert Doering <gert@greenie.muc.de>
To: openvpn-devel@lists.sourceforge.net
Date: Tue, 2 Sep 2025 17:08:42 +0200
Message-ID: <20250902150848.14160-1-gert@greenie.muc.de>
X-Mailer: git-send-email 2.49.1
In-Reply-To:
<gerrit.1756824907000.I40c11864745cc1619cb9cbf490b168f90feb5eac@gerrit.openvpn.net>
References:
<gerrit.1756824907000.I40c11864745cc1619cb9cbf490b168f90feb5eac@gerrit.openvpn.net>
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 <ralf@mandelbit.com> If dco_get_peer_stats()
is called with an uninitialized c->c1.tuntap it results in a segfault. This
issue happens when a client who has not connected to any server: - has
--management and exits, - has [...]
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: 1utSd2-00026Z-93
Subject: [Openvpn-devel] [PATCH v1] dco_linux: validate tun interface before
fetching stats
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: =?utf-8?q?1842165322358718742?=
X-GMAIL-MSGID: =?utf-8?q?1842165322358718742?=
|
| Series |
[Openvpn-devel,v1] dco_linux: validate tun interface before fetching stats
|
|
Commit Message
Gert Doering
Sept. 2, 2025, 3:08 p.m. UTC
From: Ralf Lici <ralf@mandelbit.com> If dco_get_peer_stats() is called with an uninitialized c->c1.tuntap it results in a segfault. This issue happens when a client who has not connected to any server: - has --management and exits, - has --management and a management interface client issues either `bytecount` or `status` or - if SIGUSR2 is sent to it. Add a check to ensure the tun interface was set up before attempting to retrieve peer statistics. Change-Id: I40c11864745cc1619cb9cbf490b168f90feb5eac Signed-off-by: Ralf Lici <ralf@mandelbit.com> Acked-by: Gert Doering <gert@greenie.muc.de> --- 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/+/1166 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering <gert@greenie.muc.de>
diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c index a3907fe..6e629c1 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -1139,6 +1139,8 @@ static int dco_get_peer(dco_context_t *dco, int peer_id, const bool raise_sigusr1_on_err) { + ASSERT(dco); + /* peer_id == -1 means "dump all peers", but this is allowed in MP mode only. * If it happens in P2P mode it means that the DCO peer was deleted and we * can simply bail out @@ -1182,6 +1184,11 @@ int dco_get_peer_stats(struct context *c, const bool raise_sigusr1_on_err) { + if (!tuntap_defined(c->c1.tuntap)) + { + return -1; + } + return dco_get_peer(&c->c1.tuntap->dco, c->c2.tls_multi->dco_peer_id, raise_sigusr1_on_err); }