| Message ID | 20251028113310.19921-1-gert@greenie.muc.de |
|---|---|
| State | New |
| Headers | show |
| Series | [Openvpn-devel,v1] dco-freebsd: fix peer stats storage on client instances | expand |
Marco, thanks for the review, and for finding the problem in the first
place :-)
I have tested this on FreeBSD 14 + DCO, and both the client and the server
side are now well-behaved and put the counter values in a nice place and
do not crash (I might have found a new bug - GH #881 - but that's not
directly related to the counter stuff).
Your patch has been applied to the master branch.
commit dc6b75788c626add84384ac121e11b65f9e02a6a
Author: Ralf Lici
Date: Tue Oct 28 12:33:05 2025 +0100
dco-freebsd: fix peer stats storage on client instances
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1290
Message-Id: <20251028113310.19921-1-gert@greenie.muc.de>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
--
kind regards,
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;