From: "flichtenheld (Code Review)" Date: Mon, 17 Jul 2023 14:17:17 +0000 In-Reply-To: References: Reply-To: frank@...2641..., arne-openvpn@...1227..., heiko@...515..., openvpn-devel@lists.sourceforge.net, lstipakov@...277..., a@...2181... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="e+I5FS/VS9c="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[release/2.6]: Print DCO client stats on SIGUSR2 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: stipa Cc: openvpn-devel , d12fk , plaisthos --e+I5FS/VS9c= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable flichtenheld has submitted this change. ( http://gerrit.openvpn.net/c/openv= pn/+/202?usp=3Demail ) Change subject: Print DCO client stats on SIGUSR2 ...................................................................... Print DCO client stats on SIGUSR2 Change-Id: I465febdf7ee5fe573e88255844f718efb60f8e8a Signed-off-by: Lev Stipakov Acked-by: Gert Doering Message-Id: <20230322113249.2039-1-lstipakov@...277...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26= 471.html Signed-off-by: Gert Doering (cherry picked from commit d5238627e4fab93a6c09816c60eb90e237b626c3) --- M src/openvpn/sig.c M src/openvpn/sig.h 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/openvpn/sig.c b/src/openvpn/sig.c index 5b89bb4..05c0054 100644 --- a/src/openvpn/sig.c +++ b/src/openvpn/sig.c @@ -300,18 +300,23 @@ * Triggered by SIGUSR2 or F2 on Windows. */ void -print_status(const struct context *c, struct status_output *so) +print_status(struct context *c, struct status_output *so) { struct gc_arena gc =3D gc_new(); status_reset(so); + if (dco_enabled(&c->options)) + { + dco_get_peer_stats(c); + } + status_printf(so, "OpenVPN STATISTICS"); status_printf(so, "Updated,%s", time_string(0, 0, false, &gc)); status_printf(so, "TUN/TAP read bytes," counter_format, c->c2.tun_read= _bytes); status_printf(so, "TUN/TAP write bytes," counter_format, c->c2.tun_wri= te_bytes); - status_printf(so, "TCP/UDP read bytes," counter_format, c->c2.link_rea= d_bytes); - status_printf(so, "TCP/UDP write bytes," counter_format, c->c2.link_wr= ite_bytes); + status_printf(so, "TCP/UDP read bytes," counter_format, c->c2.link_rea= d_bytes + c->c2.dco_read_bytes); + status_printf(so, "TCP/UDP write bytes," counter_format, c->c2.link_wr= ite_bytes + c->c2.dco_write_bytes); status_printf(so, "Auth read bytes," counter_format, c->c2.link_read_b= ytes_auth); #ifdef USE_COMP if (c->c2.comp_context) @@ -402,7 +407,7 @@ } static void -process_sigusr2(const struct context *c) +process_sigusr2(struct context *c) { struct status_output *so =3D status_open(NULL, 0, M_INFO, NULL, 0); print_status(c, so); diff --git a/src/openvpn/sig.h b/src/openvpn/sig.h index 4858eb9..b09dfab 100644 --- a/src/openvpn/sig.h +++ b/src/openvpn/sig.h @@ -69,7 +69,7 @@ void print_signal(const struct signal_info *si, const char *title, int msg= level); -void print_status(const struct context *c, struct status_output *so); +void print_status(struct context *c, struct status_output *so); void remap_signal(struct context *c); -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/202?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: release/2.6 Gerrit-Change-Id: I465febdf7ee5fe573e88255844f718efb60f8e8a Gerrit-Change-Number: 202 Gerrit-PatchSet: 2 Gerrit-Owner: stipa Gerrit-Reviewer: cron2 Gerrit-Reviewer: d12fk Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: ordex Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --e+I5FS/VS9c= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

flichtenheld submitted this change.

View Change

Print DCO client stats on SIGUSR2
Change-Id: I465febdf7ee5fe573e88255844f718efb60f8e8a
Signed-off-by: Le= v Stipakov <lev@...515...>
Acked-by: Gert Doering <gert@...1726...= ...>
Message-Id: <20230322113249.2039-1-lstipakov@...277...>URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg2= 6471.html
Signed-off-by: Gert Doering <gert@...1296...>
(cherry= picked from commit d5238627e4fab93a6c09816c60eb90e237b626c3)
---
M s= rc/openvpn/sig.c
M src/openvpn/sig.h
2 files changed, 10 insertions(+= ), 5 deletions(-)

diff --git a/src/openvpn/sig.c b/src/openvpn/sig.c
index= 5b89bb4..05c0054 100644
--- a/src/openvpn/sig.c
= +++ b/src/openvpn/sig.c
@@ -300,18 +300,23 @@<= br> * Triggered by SIGUSR2 or F2 on Windows.
*/
void
-pr= int_status(const struct context *c, struct status_output *so)
+print_status(struct context *c, s= truct status_output *so)

{
struct gc_= arena gc =3D gc_new();

status_reset(= so);

+ {
+ dco_get_peer_stats(c);
+ }
+
status_printf(so, "OpenVPN STATISTICS&quo= t;);
status_printf(so, "Updated,%s", time_st= ring(0, 0, false, &gc));
status_printf(so, "T= UN/TAP read bytes," counter_format, c->c2.tun_read_bytes); status_printf(so, "TUN/TAP write bytes," counter_for= mat, c->c2.tun_write_bytes);
- status_printf(so, "TCP/UDP read bytes," counter_for= mat, c->c2.link_read_bytes);
- status_printf(so, "TCP/UDP write bytes," counter_fo= rmat, c->c2.link_write_bytes);
+ status_printf(so, "TCP/UDP read bytes," counter= _format, c->c2.link_read_bytes + c->c2.dco_read_bytes);
+ status_printf(so, "TCP/U= DP write bytes," counter_format, c->c2.link_write_bytes + c->c2.= dco_write_bytes);
status_printf(so, "Auth read by= tes," counter_format, c->c2.link_read_bytes_auth);
= #ifdef USE_COMP
if (c->c2.comp_context)
= @@ -402,7 +407,7 @@
}

static void
-proce= ss_sigusr2(const struct context *c)
+process_sigusr2(struct context *c)
{
struct status_output *so =3D status_open(NULL, 0, M_INFO, N= ULL, 0);
print_status(c, so);
diff --g= it a/src/openvpn/sig.h b/src/openvpn/sig.h
index 4858eb9..b= 09dfab 100644
--- a/src/openvpn/sig.h
+++ b= /src/openvpn/sig.h
@@ -69,7 +69,7 @@

void print_signal(const struct signal_info *si, const char *ti= tle, int msglevel);

-void print_status(const struct context *c, struct status_ou= tput *so);
+void prin= t_status(struct context *c, struct status_output *so);

void remap_signal(struct context *c);


To view, visit change 202. To unsubscribe, or fo= r help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: I465febdf7ee5fe573e88255844f= 718efb60f8e8a
Gerrit-Change-Number: 202
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <lstipakov@...277...>= ;
Gerrit-Reviewer: cron2
Gerrit-Reviewer: d12fk <heiko@...515...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: ordex <a@...2181...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--e+I5FS/VS9c=--