[PATCH v2] Document --preresolve option

Sami Rusani via Openvpn-devel <[email protected]>
Newsgroups gmane.network.openvpn.devel
Message-ID <_5bQ5LvkEmn_vaE7Ng8xPAcHJFWfy7td0Yvim0iLc3YVoer2RM1-PoBKAGPzHZKx1rsZP7Ht7kM_2eIUSidNkMW34yS7eT549_fSvcb-dl0=@pm.me>
Thanks, addressed in v2.

This version documents that --preresolve reuses resolved addresses on reconnects, and mentions the trade-off for dynamic DNS names and
DNS64/NAT64 roaming.

Sam

On Monday, June 29th, 2026 at 3:08 PM, Arne Schwabe <[email protected]> wrote:

> Am 27.06.26 um 22:37 schrieb Sami Rusani via Openvpn-devel:
> >
> > Hi,
> >
> > Please find attached a small documentation patch for OpenVPN/openvpn#532.
> 
> Thanks. This is a good start but I think we can improve this to give a
> bit more context:
> 
> +--preresolve
> +  Resolve configured ``--remote``, ``--local``, ``--http-proxy``, and
> +  ``--socks-proxy`` hostnames at startup before opening the connection.
> +
> 
> 
> I think we should mention that this also causes OpenVPN to never
> reresolve the hostnames on reconnect. Which is a good thing if you use
> something like persist-tun and DNS will not work while the VPN is down
> but maybe is counter-productive if you have a dyndns name for your VPN
> server or roaming to/from DNS64/NAT64 network where the IP address might
> change.
> 
> Arne
>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
v2-0001-Document-preresolve-option.patch (application/octet-stream, 2.5 KB)
From ca1bf3c6961bdf9bccf12e19ebfef46dfa621d0a Mon Sep 17 00:00:00 2001
From: Sami Rusani <[email protected]>
Date: Sat, 27 Jun 2026 21:03:51 +0200
Subject: [PATCH v2] Document --preresolve option

The option resolves configured remote, local, and proxy hostnames at
startup and reuses those resolved addresses on reconnects.

Document it in the usage text and client options man page, including
the reconnect trade-off for configurations that rely on changing DNS
answers.

GitHub: fixes OpenVPN/openvpn#532
---
Changes in v2:
- Document that resolved hostnames are reused on reconnects.
- Mention the trade-off for dynamic DNS names and DNS64/NAT64 roaming.

 doc/man-sections/client-options.rst | 11 +++++++++++
 src/openvpn/options.c               |  1 +
 2 files changed, 12 insertions(+)

diff --git a/doc/man-sections/client-options.rst b/doc/man-sections/client-options.rst
index 3ad9104..87c138a 100644
--- a/doc/man-sections/client-options.rst
+++ b/doc/man-sections/client-options.rst
@@ -568,6 +568,17 @@ configuration.
   By default, ``--resolv-retry infinite`` is enabled. You can disable by
   setting n=0.
 
+--preresolve
+  Resolve configured ``--remote``, ``--local``, ``--http-proxy``, and
+  ``--socks-proxy`` hostnames at startup before opening the connection.
+
+  The resolved addresses are cached and reused for reconnects, so OpenVPN
+  will not re-resolve these hostnames after the initial connection attempt.
+  This can help configurations where DNS is unavailable while the VPN is
+  down, but can be counter-productive for dynamic DNS names or when roaming
+  between networks where address family availability changes, such as
+  DNS64/NAT64.
+
 --single-session
   After initially connecting to a remote peer, disallow any new
   connections. Using this option means that a remote peer cannot connect,
diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index f414024..87218d4 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -175,6 +175,7 @@ static const char usage_message[] =
     "--resolv-retry n: If hostname resolve fails for --remote, retry\n"
     "                  resolve for n seconds before failing (disabled by default).\n"
     "                  Set n=\"infinite\" to retry indefinitely.\n"
+    "--preresolve    : Resolve configured --remote, --local, and proxy hostnames at startup.\n"
     "--float         : Allow remote to change its IP address/port, such as through\n"
     "                  DHCP (this is the default if --remote is not used).\n"
     "--ipchange cmd  : Run command cmd on remote ip address initial\n"
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.