Change in openvpn[master]: dco-freebsd: fix peer stats storage on client instances
A message that is not in the archive (sent off-list or not yet received): gerrit.1761034162000.I92b5f3996f2a2180fa5e94719603078c1fc2f7f6@...2715...
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=email
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.
---
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
src/openvpn/dco_freebsd.c +11 -1
@@ -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 ;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1290?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I92b5f3996f2a2180fa5e94719603078c1fc2f7f6
Gerrit-Change-Number: 1290
Gerrit-PatchSet: 1
Gerrit-Owner: ralf_lici <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos, ralf_lici.
mrbff has posted comments on this change by ralf_lici. ( http://gerrit.openvpn.net/c/openvpn/+/1290?usp=email )
Change subject: dco-freebsd: fix peer stats storage on client instances
......................................................................
Patch Set 1: Code-Review+1
(1 comment)
Patchset:
PS1:
Tested again, it seems to work fine now. LGTM
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1290?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I92b5f3996f2a2180fa5e94719603078c1fc2f7f6
Gerrit-Change-Number: 1290
Gerrit-PatchSet: 1
Gerrit-Owner: ralf_lici <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: mrbff <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ralf_lici <[email protected]...>
Gerrit-Comment-Date: Tue, 21 Oct 2025 11:42:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: flichtenheld, plaisthos, ralf_lici.
cron2 has posted comments on this change by ralf_lici. ( http://gerrit.openvpn.net/c/openvpn/+/1290?usp=email )
Change subject: dco-freebsd: fix peer stats storage on client instances
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1290?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I92b5f3996f2a2180fa5e94719603078c1fc2f7f6
Gerrit-Change-Number: 1290
Gerrit-PatchSet: 1
Gerrit-Owner: ralf_lici <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: mrbff <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ralf_lici <[email protected]...>
Gerrit-Comment-Date: Tue, 28 Oct 2025 11:32:55 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH 1/1 dco-freebsd: fix peer stats storage on client instances
In reply to a message not in the archiveFrom: Ralf Lici <[email protected]...>
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.
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 <[email protected]...>
src/openvpn/dco_freebsd.c +11 -1
@@ -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 ;
[Openvpn-devel] [PATCH applied] Re: dco-freebsd: fix peer stats storage on client instances
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 <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1290
Message-Id: <[email protected]...>
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#2) to the change originally created by ralf_lici. ( http://gerrit.openvpn.net/c/openvpn/+/1290?usp=email )
The following approvals got outdated and were removed:
Code-Review+1 by mrbff, Code-Review+2 by cron2
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.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1290
Message-Id: <[email protected]...>
---
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/2
src/openvpn/dco_freebsd.c +11 -1
@@ -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 ;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1290?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I92b5f3996f2a2180fa5e94719603078c1fc2f7f6
Gerrit-Change-Number: 1290
Gerrit-PatchSet: 2
Gerrit-Owner: ralf_lici <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: mrbff <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1290?usp=email )
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.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1290
Message-Id: <[email protected]...>
---
M src/openvpn/dco_freebsd.c
1 file changed, 11 insertions(+), 1 deletion(-)
src/openvpn/dco_freebsd.c +11 -1
@@ -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 ;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1290?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I92b5f3996f2a2180fa5e94719603078c1fc2f7f6
Gerrit-Change-Number: 1290
Gerrit-PatchSet: 2
Gerrit-Owner: ralf_lici <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: mrbff <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>