From: "ralf_lici (Code Review)" Date: Tue, 21 Oct 2025 08:09:24 +0000 References: Reply-To: ralf@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="mJ9C+bGS9jU="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: dco-freebsd: fix peer stats storage on client instances List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --mJ9C+bGS9jU= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1290?usp=3Demail to review the following change. Change subject: dco-freebsd: fix peer stats storage on client instances ...................................................................... dco-freebsd: fix peer stats storage on client instances 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 --- M src/openvpn/dco_freebsd.c 1 file changed, 11 insertions(+), 1 deletion(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/90/1290/1 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 =3D nvlist_get_nvlist(nvl, "bytes"); + + if (dco->c->mode =3D=3D CM_TOP) + { + dco_update_peer_stat(dco->c->multi, dco->dco_message_p= eer_id, bytes); + } + else + { + dco->c->c2.dco_read_bytes =3D nvlist_get_number(bytes,= "in"); + dco->c->c2.dco_write_bytes =3D nvlist_get_number(bytes= , "out"); + } } dco->dco_message_type =3D OVPN_CMD_DEL_PEER; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1290?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I92b5f3996f2a2180fa5e94719603078c1fc2f7f6 Gerrit-Change-Number: 1290 Gerrit-PatchSet: 1 Gerrit-Owner: ralf_lici Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld --mJ9C+bGS9jU= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: flichtenheld, plaisthos.

ralf_lici would like plaisthos and flichtenheld to review this change.

V= iew Change

dco-freebsd: fix peer stats storage on clie=
nt instances

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 m= ode the current instance is running in
and storing peer stats accordingl= y.

Fixes: https://github.com/OpenVPN/openvpn/issues/875
Change-Id= : I92b5f3996f2a2180fa5e94719603078c1fc2f7f6
Signed-off-by: Ralf Lici <= ;ralf@...2726...>
---
M src/openvpn/dco_freebsd.c
1 file change= d, 11 insertions(+), 1 deletion(-)

git pull ssh:=
//gerrit.openvpn.net:29418/openvpn refs/changes/90/1290/1
diff --=
git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c
index e51f8dd..3521fca 100644
--- a/src/openvpn/dco_freebs= d.c
+++ b/src/openvpn/dco_freebsd.c
@@ -634= ,7 +634,17 @@

if (nvlist_exi= sts_nvlist(nvl, "bytes"))
{- dco_update_pee= r_stat(dco->c->multi, dco->dco_message_peer_id, nvlist_get_nvlist(= nvl, "bytes"));
+ const nvlist_t *bytes =3D nvlist_get_nvlist(nvl, &quo= t;bytes");
+
+ if (dco= ->c->mode =3D=3D CM_TOP)
+ {
+ dco_update_peer_stat(dco->c->multi, dco-= >dco_message_peer_id, bytes);
+ }
+ else
+ {
+ dco->c->c2.dco_read_bytes =3D nvlist_ge= t_number(bytes, "in");
+ dco->c->c2.dco_write_bytes =3D nvlis= t_get_number(bytes, "out");
+ }
}
dco->dco_message_type =3D OVPN_CM= D_DEL_PEER;

To view, visit change 1290. To = unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I92b5f3996f2a2180fa5e9471960= 3078c1fc2f7f6
Gerrit-Change-Number: 1290
Gerrit-PatchSet: 1
Gerrit-Owner: ralf_lici <ralf@...2726...>= ;
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
= --mJ9C+bGS9jU=--