[Openvpn-devel,v2] Reduce default restart pause to 1 second

Message ID 20221219150435.1222451-1-selva.nair@gmail.com
State Accepted
Headers show
Series [Openvpn-devel,v2] Reduce default restart pause to 1 second | expand

Commit Message

Selva Nair Dec. 19, 2022, 3:04 p.m. UTC
From: Selva Nair <selva.nair@gmail.com>

Current value of restart pause is 5 seconds which feels
unduly long. Reduce it to 1 second.

User can still customize the delay using the first parameter for
"--connect-retry".

Also improve the description of "--connect-retry" in the
man page.

v2 changes:
- fix incomplete man page edit as pointed out by Arne Schwabe
- fix man page (rst) changes as suggested by Frank Lichtenheld

Signed-off-by: Selva Nair <selva.nair@gmail.com>
---
I've changed the rst edits following how other similar options
are described -- though I do not like referring to 'arg' as 'n'
first and then "explaining" it in valid-syntaxes...
Will be happy to revise if there is a better way.

reST is not for me: feels like I'm forced to write a paper
in Word instead of LaTeX.

 doc/man-sections/client-options.rst | 17 ++++++++++++-----
 src/openvpn/options.c               |  2 +-
 2 files changed, 13 insertions(+), 6 deletions(-)

Comments

Frank Lichtenheld Dec. 19, 2022, 3:33 p.m. UTC | #1
On Mon, Dec 19, 2022 at 10:04:35AM -0500, selva.nair@gmail.com wrote:
> From: Selva Nair <selva.nair@gmail.com>
> 
> Current value of restart pause is 5 seconds which feels
> unduly long. Reduce it to 1 second.
> 
> User can still customize the delay using the first parameter for
> "--connect-retry".
> 
> Also improve the description of "--connect-retry" in the
> man page.
> 
> v2 changes:
> - fix incomplete man page edit as pointed out by Arne Schwabe
> - fix man page (rst) changes as suggested by Frank Lichtenheld
> 
> Signed-off-by: Selva Nair <selva.nair@gmail.com>
> ---
> I've changed the rst edits following how other similar options
> are described -- though I do not like referring to 'arg' as 'n'
> first and then "explaining" it in valid-syntaxes...
> Will be happy to revise if there is a better way.

Yeah, I really looked for alternatives when I first learned about
this limitation. Because it is very annoying. But I didn't find any.

Acked-By: Frank Lichtenheld <frank@lichtenheld.com>

Regards,
Gert Doering Dec. 19, 2022, 4:51 p.m. UTC | #2
Admittedly, I have not tested this, but it's simple enough - code wise,
not the "fighting .rst" part :-)

Your patch has been applied to the master and release/2.6 branch.

commit cb385c64279fcb11bf6622d9723e1223b4e2a7f5 (master)
commit 3a5d82d7fee8fc7d00902e9640494ea6fdd08b35 (release/2.6)
Author: Selva Nair
Date:   Mon Dec 19 10:04:35 2022 -0500

     Reduce default restart pause to 1 second

     Signed-off-by: Selva Nair <selva.nair@gmail.com>
     Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
     Message-Id: <20221219150435.1222451-1-selva.nair@gmail.com>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25770.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/doc/man-sections/client-options.rst b/doc/man-sections/client-options.rst
index 07651479..974cc992 100644
--- a/doc/man-sections/client-options.rst
+++ b/doc/man-sections/client-options.rst
@@ -138,12 +138,19 @@  configuration.
   Set ``--verb 6`` for debugging info showing the transformation of
   src/dest addresses in packets.
 
---connect-retry n
-  Wait ``n`` seconds between connection attempts (default :code:`5`).
+--connect-retry args
+  Wait ``n`` seconds between connection attempts (default :code:`1`).
   Repeated reconnection attempts are slowed down after 5 retries per
-  remote by doubling the wait time after each unsuccessful attempt. An
-  optional argument ``max`` specifies the maximum value of wait time in
-  seconds at which it gets capped (default :code:`300`).
+  remote by doubling the wait time after each unsuccessful attempt.
+
+  Valid syntaxes:
+  ::
+
+     connect retry n
+     connect retry n max
+
+  If the optional argument ``max`` is specified, the maximum wait time in
+  seconds gets capped at that value (default :code:`300`).
 
 --connect-retry-max n
   ``n`` specifies the number of times each ``--remote`` or
diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 4383c953..4442697f 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -815,7 +815,7 @@  init_options(struct options *o, const bool init_gc)
     o->ce.proto = PROTO_UDP;
     o->ce.af = AF_UNSPEC;
     o->ce.bind_ipv6_only = false;
-    o->ce.connect_retry_seconds = 5;
+    o->ce.connect_retry_seconds = 1;
     o->ce.connect_retry_seconds_max = 300;
     o->ce.connect_timeout = 120;
     o->connect_retry_max = 0;