From: "stipa (Code Review)"
Date: Wed, 27 Aug 2025 11:50:58 +0000
In-Reply-To:
References:
Reply-To: lstipakov@...277..., arne-openvpn@...1227...,
openvpn-devel@lists.sourceforge.net, frank@...2641...
Message-ID: <7079c1125f8d579441467bfb892af440e9b02555-EmailReplacePatchSet-HTML@...2715...>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="hj0dEWPIRq0="; charset=UTF-8
Subject: [Openvpn-devel] [S] Change in openvpn[master]: Don't call bytecount
client logic in server mode
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
To: plaisthos , flichtenheld
Cc: openvpn-devel
--hj0dEWPIRq0=
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: flichtenheld, plaisthos.
Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1157?usp=3Demail
to look at the new patch set (#2).
Change subject: Don't call bytecount client logic in server mode
......................................................................
Don't call bytecount client logic in server mode
Calling this in server mode is wrong because:
- we only output those counters via management interface
(>BYTECOUNT:) in client mode, so in server mode this is no-op
- the timer callback to fetch DCO stats is triggerer
independenty for each peer. It is a waste of resources in server mode
where we could fetch stats for all peers with the single ioctl.
Change-Id: I7bc7de284fdbfd4be26a907ecd5c21c075bc5ac4
Signed-off-by: Lev Stipakov
---
M src/openvpn/forward.c
M src/openvpn/manage.c
M src/openvpn/manage.h
3 files changed, 5 insertions(+), 8 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/57/1157/2
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 75ca9d5..e8bdf35 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -818,7 +818,7 @@
#ifdef ENABLE_MANAGEMENT
if (management)
{
- management_check_bytecount(c, management, &c->c2.timeval);
+ management_check_bytecount_client(c, management, &c->c2.timeval);
}
#endif /* ENABLE_MANAGEMENT */
}
diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
index aed04f5..f057fb2 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/manage.c
@@ -4065,9 +4065,9 @@
}
void
-management_check_bytecount(struct context *c, struct management *man, stru=
ct timeval *timeval)
+management_check_bytecount_client(struct context *c, struct management *ma=
n, struct timeval *timeval)
{
- if (event_timeout_trigger(&man->connection.bytecount_update_interval, =
timeval, ETT_DEFAULT))
+ if (!(man->persist.callback.flags & MCF_SERVER) && event_timeout_trigg=
er(&man->connection.bytecount_update_interval, timeval, ETT_DEFAULT))
{
counter_type dco_read_bytes =3D 0;
counter_type dco_write_bytes =3D 0;
@@ -4083,10 +4083,7 @@
dco_write_bytes =3D c->c2.dco_write_bytes;
}
- if (!(man->persist.callback.flags & MCF_SERVER))
- {
- man_bytecount_output_client(man, dco_read_bytes, dco_write_byt=
es);
- }
+ man_bytecount_output_client(man, dco_read_bytes, dco_write_bytes);
}
}
diff --git a/src/openvpn/manage.h b/src/openvpn/manage.h
index 083caf5..038691f 100644
--- a/src/openvpn/manage.h
+++ b/src/openvpn/manage.h
@@ -492,7 +492,7 @@
* These functions drive the bytecount in/out counters.
*/
-void management_check_bytecount(struct context *c, struct management *man,=
struct timeval *timeval);
+void management_check_bytecount_client(struct context *c, struct managemen=
t *man, struct timeval *timeval);
static inline void
management_bytes_client(struct management *man, const int size_in, const i=
nt size_out)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1157?usp=3Demail
To unsubscribe, or for help writing mail filters, visit http://gerrit.openv=
pn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I7bc7de284fdbfd4be26a907ecd5c21c075bc5ac4
Gerrit-Change-Number: 1157
Gerrit-PatchSet: 2
Gerrit-Owner: stipa
Gerrit-Reviewer: flichtenheld
Gerrit-Reviewer: plaisthos
Gerrit-CC: openvpn-devel
Gerrit-Attention: plaisthos
Gerrit-Attention: flichtenheld
Gerrit-MessageType: newpatchset
--hj0dEWPIRq0=
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: flichtenheld, plaisthos.
stipa uploaded patch set #2 to this change.
View Change=
a>
Don't call bytecount client logic in server mode Calling this=
in server mode is wrong because: - we only output those counters v=
ia management interface (>BYTECOUNT:) in client mode, so in server m=
ode this is no-op - the timer callback to fetch DCO stats is trigge=
rer independenty for each peer. It is a waste of resources in server mo=
de where we could fetch stats for all peers with the single ioctl. <=
br>Change-Id: I7bc7de284fdbfd4be26a907ecd5c21c075bc5ac4 Signed-off-by: L=
ev Stipakov <lev@...515...> --- M src/openvpn/forward.c M sr=
c/openvpn/manage.c M src/openvpn/manage.h 3 files changed, 5 insertio=
ns(+), 8 deletions(-) git pull ssh://gerrit.openvpn.net:29418/ope=
nvpn refs/changes/57/1157/2 diff --git a/src/openvpn/forward.c b/sr=
c/openvpn/forward.c index 75ca9d5..e8bdf35 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forwar=
d.c @@ -818,7 +818,7 @@ #ifdef ENABLE_MANA=
GEMENT if (management) { - management_check_bytec=
ount(c, management, &c->c2.timeval); + management_check_bytecount_client(c, manage=
ment, &c->c2.timeval); } #endi=
f /* ENABLE_MANAGEMENT */ } diff --git a/s=
rc/openvpn/manage.c b/src/openvpn/manage.c index aed04f5..f=
057fb2 100644 --- a/src/openvpn/manage.c ++=
+ b/src/openvpn/manage.c @@ -4065,9 +4065,9 @@ } void -management_check_bytecount(struct context *c, stru=
ct management *man, struct timeval *timeval) +management_check_bytecount_client(struct context *=
c, struct management *man, struct timeval *timeval) {- if (event_timeout_trig=
ger(&man->connection.bytecount_update_interval, timeval, ETT_DEFAULT=
)) + if (!(man->=
;persist.callback.flags & MCF_SERVER) && event_timeout_trigger(=
&man->connection.bytecount_update_interval, timeval, ETT_DEFAULT))=
span> { counter_type dco_read_bytes =
=3D 0; counter_type dco_write_bytes =3D 0; <=
br>@@ -4083,10 +4083,7 @@ dco_write_byte=
s =3D c->c2.dco_write_bytes; } =
- if (!(man-&g=
t;persist.callback.flags & MCF_SERVER)) - { - man_bytecount_output_client(man, dco_read_bytes, dco_=
write_bytes); - =
} + man_byteco=
unt_output_client(man, dco_read_bytes, dco_write_bytes); =
} } diff --git a/src/=
openvpn/manage.h b/src/openvpn/manage.h index 083caf5..0386=
91f 100644 --- a/src/openvpn/manage.h +++ b=
/src/openvpn/manage.h @@ -492,7 +492,7 @@ =
* These functions drive the bytecount in/out counters. *=
/ -vo=
id management_check_bytecount(struct context *c, struct management *man, st=
ruct timeval *timeval); +void management_check_bytecount_client(struct context *c, struct manage=
ment *man, struct timeval *timeval); sta=
tic inline void management_bytes_client(struct management =
*man, const int size_in, const int size_out)
To view, visit change 1157 . To unsubscribe, or for help writing mail filt=
ers, visit settings .
=
<=
meta itemprop=3D"name" content=3D"View Change"/>
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I7bc7de284fdbfd4be26a907ecd5=
c21c075bc5ac4
Gerrit-Change-Number: 1157
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <lstipakov@...277...>=
;
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...>
Gerrit-MessageType: newpatchset
--hj0dEWPIRq0=--