From: "cron2 (Code Review)" Date: Sun, 19 Oct 2025 17:07:50 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, ralf@...2726..., frank@...2641..., antonio@...2726... Message-ID: <2807b7c4e2ee73c80902be3a1b2b0dcfe97eab07-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="D6p2dZ1mYrY="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: dco-freebsd: store peer stats directly in c2 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: ralf_lici , plaisthos , flichtenheld Cc: openvpn-devel --D6p2dZ1mYrY= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#5) to the change originally created by= ralf_lici. ( http://gerrit.openvpn.net/c/openvpn/+/1275?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: dco-freebsd: store peer stats directly in c2 ...................................................................... dco-freebsd: store peer stats directly in c2 The dco_context_t structure includes a reference to the general context structure c, which allows us to store dco_read_bytes and dco_write_bytes directly as c2 fields. This aligns the FreeBSD implementation with how we handle DCO peer stats on Linux and Windows. Change-Id: I53dd40fabdeacb9dca843e28fdd3b357711c5a84 Signed-off-by: Ralf Lici Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1275 Message-Id: <20251019170249.30942-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33= 791.html Signed-off-by: Gert Doering --- M src/openvpn/dco_freebsd.c 1 file changed, 16 insertions(+), 19 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/75/1275/5 diff --git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c index 947a769..e51f8dd 100644 --- a/src/openvpn/dco_freebsd.c +++ b/src/openvpn/dco_freebsd.c @@ -564,6 +564,21 @@ return ret; } +static void +dco_update_peer_stat(struct multi_context *m, uint32_t peerid, const nvlis= t_t *nvl) +{ + if (peerid >=3D m->max_clients || !m->instances[peerid]) + { + msg(M_WARN, "dco_update_peer_stat: invalid peer ID %d returned by = kernel", peerid); + return; + } + + struct multi_instance *mi =3D m->instances[peerid]; + + mi->context.c2.dco_read_bytes =3D nvlist_get_number(nvl, "in"); + mi->context.c2.dco_write_bytes =3D nvlist_get_number(nvl, "out"); +} + int dco_do_read(dco_context_t *dco) { @@ -619,10 +634,7 @@ if (nvlist_exists_nvlist(nvl, "bytes")) { - const nvlist_t *bytes =3D nvlist_get_nvlist(nvl, "bytes"); - - dco->dco_read_bytes =3D nvlist_get_number(bytes, "in"); - dco->dco_write_bytes =3D nvlist_get_number(bytes, "out"); + dco_update_peer_stat(dco->c->multi, dco->dco_message_peer_= id, nvlist_get_nvlist(nvl, "bytes")); } dco->dco_message_type =3D OVPN_CMD_DEL_PEER; @@ -777,21 +789,6 @@ nvlist_destroy(nvl); } -static void -dco_update_peer_stat(struct multi_context *m, uint32_t peerid, const nvlis= t_t *nvl) -{ - if (peerid >=3D m->max_clients || !m->instances[peerid]) - { - msg(M_WARN, "dco_update_peer_stat: invalid peer ID %d returned by = kernel", peerid); - return; - } - - struct multi_instance *mi =3D m->instances[peerid]; - - mi->context.c2.dco_read_bytes =3D nvlist_get_number(nvl, "in"); - mi->context.c2.dco_write_bytes =3D nvlist_get_number(nvl, "out"); -} - int dco_get_peer_stats_multi(dco_context_t *dco, const bool raise_sigusr1_on_e= rr) { -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1275?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I53dd40fabdeacb9dca843e28fdd3b357711c5a84 Gerrit-Change-Number: 1275 Gerrit-PatchSet: 5 Gerrit-Owner: ralf_lici Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-CC: ordex --D6p2dZ1mYrY= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #5 to the change originally created by ralf_lici.<= /p>

Vi= ew Change

The following approvals got outdated and were removed: Code-Review+2 by cron2

dco-freebsd: store peer stats direc=
tly in c2

The dco_context_t structure includes a reference to the ge= neral context
structure c, which allows us to store dco_read_bytes and d= co_write_bytes
directly as c2 fields. This aligns the FreeBSD implementa= tion with how
we handle DCO peer stats on Linux and Windows.

Chan= ge-Id: I53dd40fabdeacb9dca843e28fdd3b357711c5a84
Signed-off-by: Ralf Lic= i <ralf@...2726...>
Acked-by: Gert Doering <gert@...1296...>=
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1275
Message-Id: = <20251019170249.30942-1-gert@...1296...>
URL: https://www.mail-arc= hive.com/openvpn-devel@lists.sourceforge.net/msg33791.html
Signed-off-by= : Gert Doering <gert@...1296...>
---
M src/openvpn/dco_freebsd.= c
1 file changed, 16 insertions(+), 19 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/75/1275=
/5
diff --git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd=
.c
index 947a769..e51f8dd 100644
--- a/src/= openvpn/dco_freebsd.c
+++ b/src/openvpn/dco_freebsd.c
@@ -564,6 +564,21 @@
return ret;
= }

+static void
+d= co_update_peer_stat(struct multi_context *m, uint32_t peerid, const nvlist_= t *nvl)
+{
= + if (peerid >=3D m->m= ax_clients || !m->instances[peerid])
+ {
+ msg(M_WARN, "dco_update_peer_stat: invalid peer ID %d re= turned by kernel", peerid);
+ return;
+ }
+
+ struct multi_instanc= e *mi =3D m->instances[peerid];
+
+ = mi->context.c2.dco_read_bytes =3D nvlist_get_number(nvl, "in")= ;
+ mi->context= .c2.dco_write_bytes =3D nvlist_get_number(nvl, "out");
= +}
+
int
dco_do_re= ad(dco_context_t *dco)
{
@@ -619,10 +634,7= @@

if (nvlist_exists_nvlist= (nvl, "bytes"))
{
- const nvlist_t *bytes = =3D nvlist_get_nvlist(nvl, "bytes");
-
- dco->dco_read_bytes =3D nvlist_get_number(bytes, &qu= ot;in");
- = dco->dco_write_bytes =3D nvlist_get_number(bytes, "out"= ;);
+ = dco_update_peer_stat(dco->c->multi, dco->dco_message_peer_id, nvli= st_get_nvlist(nvl, "bytes"));
}

dco->dco_message_type =3D OVP= N_CMD_DEL_PEER;
@@ -777,21 +789,6 @@
n= vlist_destroy(nvl);
}

-static void
-dco_update_peer_stat(struct multi_context *m, uint= 32_t peerid, const nvlist_t *nvl)
-{
- if (= peerid >=3D m->max_clients || !m->instances[peerid])
- {

- msg(M_WARN, "dco_update_peer_stat: inv= alid peer ID %d returned by kernel", peerid);
- return;
- }
-
- struct mul= ti_instance *mi =3D m->instances[peerid];
-
- mi->context.c2.dco_read_bytes =3D nvlist_get_number(nvl, "in&= quot;);
- mi->con= text.c2.dco_write_bytes =3D nvlist_get_number(nvl, "out");=
-}
-
int
dco_get_p= eer_stats_multi(dco_context_t *dco, const bool raise_sigusr1_on_err)=
{

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

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I53dd40fabdeacb9dca843e28fdd= 3b357711c5a84
Gerrit-Change-Number: 1275
Gerrit-PatchSet: 5
Gerrit-Owner: ralf_lici <ralf@...2726...>= ;
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-CC: ordex <antonio@...2726...> = --D6p2dZ1mYrY=--