]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Print DCO client stats on SIGUSR2
authorLev Stipakov <lev@openvpn.net>
Wed, 22 Mar 2023 11:32:49 +0000 (13:32 +0200)
committerGert Doering <gert@greenie.muc.de>
Thu, 23 Mar 2023 08:51:55 +0000 (09:51 +0100)
Change-Id: I465febdf7ee5fe573e88255844f718efb60f8e8a
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20230322113249.2039-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26471.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/sig.c
src/openvpn/sig.h

index 5b89bb42b9e75f2f238d128aab4284f3e5d37ef6..05c0054b65d1ae3cada76af423bb7a17f1f1b397 100644 (file)
@@ -300,18 +300,23 @@ restore_signal_state(void)
  * 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 = 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_write_bytes);
-    status_printf(so, "TCP/UDP read bytes," counter_format, c->c2.link_read_bytes);
-    status_printf(so, "TCP/UDP write bytes," counter_format, 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/UDP write bytes," counter_format, c->c2.link_write_bytes + c->c2.dco_write_bytes);
     status_printf(so, "Auth read bytes," counter_format, c->c2.link_read_bytes_auth);
 #ifdef USE_COMP
     if (c->c2.comp_context)
@@ -402,7 +407,7 @@ remap_signal(struct context *c)
 }
 
 static void
-process_sigusr2(const struct context *c)
+process_sigusr2(struct context *c)
 {
     struct status_output *so = status_open(NULL, 0, M_INFO, NULL, 0);
     print_status(c, so);
index 4858eb93dfd38ba68a438f0d51fb5a630d8006db..b09dfab6cb6c9aca82bf9428a476179619963c0c 100644 (file)
@@ -69,7 +69,7 @@ void restore_signal_state(void);
 
 void print_signal(const struct signal_info *si, const char *title, int msglevel);
 
-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);