From ba1ff425cd3fb2914fa6b171cbe41ae884dd3739 Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Thu, 1 Sep 2022 13:29:42 +0100 Subject: [PATCH] Disable persistent state check for OpenVPN3 `openvpn3` does not support the `state` management command as a query, it requires either an `on` or an `off` parameter to be supplied. This commit disables the `state` check when using OpenVPN3. Signed-off-by: Christopher Ng --- openvpn.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openvpn.c b/openvpn.c index 322c6b6..adf93d2 100644 --- a/openvpn.c +++ b/openvpn.c @@ -122,8 +122,11 @@ OnReady(connection_t *c, UNUSED char *msg) ManagementCommand(c, "echo on all", OnEcho, combined); ManagementCommand(c, "bytecount 5", NULL, regular); - /* ask for the current state, especially useful when the daemon was prestarted */ - ManagementCommand(c, "state", OnStateChange, regular); + if (o.ovpn_engine != OPENVPN_ENGINE_OVPN3) { // openvpn3 doesn't support this and will respond with an error + /* ask for the current state, especially useful when the daemon was prestarted */ + ManagementCommand(c, "state", OnStateChange, regular); + } + if (c->flags & FLAG_DAEMON_PERSISTENT && o.enable_persistent == 2)