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

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

Commit Message

Selva Nair Dec. 18, 2022, 7:58 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.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
---
Whle reviewing commit 5d429efd9720109b9c9f1265f5d351a75a401942
Arne had suggested this, but I failed to follow up:

Quoting from Message ID 11772d2a-4877-0ed0-2484-7ef66e059737@rfc2549.org
<quote arne@rfc2549.org 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(-)

Comments

Arne Schwabe Dec. 19, 2022, 12:12 p.m. UTC | #1
Am 18.12.22 um 20:58 schrieb selva.nair@gmail.com:
> +--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
Gert Doering Dec. 19, 2022, 12:17 p.m. UTC | #2
Hi,

On Mon, Dec 19, 2022 at 01:12:32PM +0100, Arne Schwabe wrote:
> Am 18.12.22 um 20:58 schrieb selva.nair@gmail.com:
> > +--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
Frank Lichtenheld Dec. 19, 2022, 12:18 p.m. UTC | #3
On Sun, Dec 18, 2022 at 02:58:10PM -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.

Some comments about that part:
 
> diff --git a/doc/man-sections/client-options.rst b/doc/man-sections/client-options.rst
> index 07651479..37d24044 100644
> --- a/doc/man-sections/client-options.rst
> +++ b/doc/man-sections/client-options.rst
> @@ -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.

>    Wait ``n`` seconds between connection attempts (default :code:`5`).

You didn't actually adapt the default here.

>    Repeated reconnection attempts are slowed down after 5 retries per
>    remote by doubling the wait time after each unsuccessful attempt. An

Regards,

Patch

diff --git a/doc/man-sections/client-options.rst b/doc/man-sections/client-options.rst
index 07651479..37d24044 100644
--- a/doc/man-sections/client-options.rst
+++ b/doc/man-sections/client-options.rst
@@ -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
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;