Skip to contentSkip to conversation

Reduce default restart pause to 1 second

PATCH Superseded [email protected]... 4 participants 7 messages Dec 18, 2022 – Dec 19, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Reduce default restart pause to 1 second

From: Selva Nair <[email protected]...>

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.

---
Whle reviewing commit 5d429efd9720109b9c9f1265f5d351a75a401942 Arne had suggested this, but I failed to follow up:

Quoting from Message ID [email protected]... <quote [email protected]... on 03-07-2016>
Btw. if we introduce this backoff mechansim I think it is safe to lower the connect-retry small time from 5 to 1 since the potential for looping very fast through the connection entries is not there anymore. </quote>

 doc/man-sections/client-options.rst | 2 +-
 src/openvpn/options.c               | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
doc/man-sections/client-options.rst +1 -1
index 07651479..37d24044 100644
@@ -138,7 +138,7 @@ configuration.
   Set ``--verb 6`` for debugging info showing the transformation of
   src/dest addresses in packets.
 
---connect-retry n
+--connect-retry n [max]
   Wait ``n`` seconds between connection attempts (default :code:`5`).
   Repeated reconnection attempts are slowed down after 5 retries per
   remote by doubling the wait time after each unsuccessful attempt. An
src/openvpn/options.c +1 -1
index 4383c953..4442697f 100644
@@ -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;
Signature · 1 line
2.34.1
#1 lore raw

Am 18.12.22 um 20:58 schrieb [email protected]...:

Quoted 2 lines

+--connect-retry n [max]
Wait ``n`` seconds between connection attempts (default :code:5).

you were close. but forgot to change the 5 in the next line to also say 1.

Arne

#2 lore raw

Hi,

Quoted 5 lines · Arne Schwabe

Am 18.12.22 um 20:58 schrieb [email protected]...:

Quoted 2 lines

+--connect-retry n [max]
Wait ``n`` seconds between connection attempts (default :code:5).

you were close. but forgot to change the 5 in the next line to also say 1.

I can do that on the fly ("not a code change") if you agree to the change otherwise - since Selva quoted you here... :-)

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...
#3 lore raw
In reply to [email protected]...
Quoted 10 lines · On Sun, Dec 18, 2022 at 02:58:10PM -0500, [email protected]... wrote:

From: Selva Nair <[email protected]...>

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.

Some comments about that part:

doc/man-sections/client-options.rst configuration. · line 141

Quoted 10 lines
doc/man-sections/client-options.rst +1 -1
index 07651479..37d24044 100644
@@ -138,7 +138,7 @@ configuration.
   Set ``--verb 6`` for debugging info showing the transformation of
   src/dest addresses in packets.
 
---connect-retry n
+--connect-retry n [max]

This breaks the formatting, because rst option lists are stupid and only expect zero or one arguments.
Needs to use the "args" -> "valid syntaxes" pattern seen elsewhere in the documentation.

doc/man-sections/client-options.rst configuration. · line 142

Quoted 1 line
doc/man-sections/client-options.rst +0 -0
   Wait ``n`` seconds between connection attempts (default :code:`5`).

You didn't actually adapt the default here.

doc/man-sections/client-options.rst configuration. · line 144

Quoted 2 lines
doc/man-sections/client-options.rst +0 -0
   Repeated reconnection attempts are slowed down after 5 retries per
   remote by doubling the wait time after each unsuccessful attempt. An

Regards,

Signature · 1 line
  Frank Lichtenheld
#4 lore raw

PATCH v2 1/1 Reduce default restart pause to 1 second

In reply to [email protected]...

From: Selva Nair <[email protected]...>

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

---
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(-)
doc/man-sections/client-options.rst +12 -5
index 07651479..974cc992 100644
@@ -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
src/openvpn/options.c +1 -1
index 4383c953..4442697f 100644
@@ -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;
Signature · 1 line
2.34.1
Acked-by on v2 1/1
#5 lore raw
Quoted 15 lines · On Mon, Dec 19, 2022 at 10:04:35AM -0500, [email protected]... wrote:

From: Selva Nair <[email protected]...>

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

Quoted 6 lines

---
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.

Regards,

Signature · 1 line
  Frank Lichtenheld
#6 lore raw
In reply to [email protected]...

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 <[email protected]...>
     Acked-by: Frank Lichtenheld <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg25770.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering