[Openvpn-devel] Allow querying DCO status via management status

Message ID 20220813211104.411554-1-arne@rfc2549.org
State Accepted
Headers show
Series [Openvpn-devel] Allow querying DCO status via management status | expand

Commit Message

Arne Schwabe Aug. 13, 2022, 11:11 a.m. UTC
This is allows querying the DCO status without doing an error-prone
parsing of the startup log.

Also remove comment that serves no purpose anymore.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
 src/openvpn/multi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


Lev Stipakov Aug. 13, 2022, 11:02 p.m. UTC | #1

Code looks good and does what it says - tested on Linux with
--status-version 2 and sending SIGUSR2.

Is the first line of the commit message ("Allow querying DCO status
via management status") descriptive enough?

Since the change allows users to see DCO status without a management
interface, just by sending SIGUSR2, maybe
"multi.c: include DCO status in status version 2" would be better?

Acked-by: Lev Stipakov <lstipakov@gmail.com>
Gert Doering Aug. 17, 2022, 9:33 a.m. UTC | #2
I have lightly tested it, by sending SIGUSR2 as Lev has suggested.  It's
not visible in the client GLOBAL_STATS (unsurprisingly, since added to 
multi_print_status()... but maybe a followup patch?) but on the servers
it nicely shows...

Aug 17 21:31:59 ubuntu2004 tap-udp-p2mp[2183229]: GLOBAL_STATS,dco_enabled,0
Aug 17 21:32:01 ubuntu2004 tun-tcp-p2mp[2183195]: GLOBAL_STATS,dco_enabled,1
Aug 17 21:32:05 ubuntu2004 tun-udp-p2mp-fragment[2183260]: GLOBAL_STATS,dco_enabled,0
Aug 17 21:32:09 ubuntu2004 tun-udp-p2mp-topology-subnet[2183217]: GLOBAL_STATS,dco_enabled,1
Aug 17 21:32:11 ubuntu2004 tun-udp-p2mp[2183208]: GLOBAL_STATS,dco_enabled,1

Did not test management interface, but that's the same code anyway.

I have adjusted the commit message + subject as suggested by Lev.

Your patch has been applied to the master branch.

commit b421a0d55afc6e7a566b97cf9b687824be5a9118
Author: Arne Schwabe
Date:   Sat Aug 13 23:11:04 2022 +0200

     Include DCO status in GLOBAL_STATS status v2 output

     Signed-off-by: Arne Schwabe <arne@rfc2549.org>
     Acked-by: Lev Stipakov <lstipakov@gmail.com>
     Message-Id: <20220813211104.411554-1-arne@rfc2549.org>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24923.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>

kind regards,

Gert Doering


diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index 53ee3e1a1..95414429f 100644
--- a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -837,7 +837,7 @@  multi_print_status(struct multi_context *m, struct status_output *so, const int
-        if (version == 1) /* WAS: m->status_file_version */
+        if (version == 1)
              * Status file version 1
@@ -984,6 +984,7 @@  multi_print_status(struct multi_context *m, struct status_output *so, const int
                               sep, sep, mbuf_maximum_queued(m->mbuf));
+            status_printf(so, "GLOBAL_STATS%cdco_enabled%c%d", sep, sep, dco_enabled(&m->top.options));
             status_printf(so, "END");