remote-override <alt-remote> -- replace the hostname in all remote
directives with alt-remote.

Merged from OpenVPN 2.1

Signed-off-by: James Yonan <ja...@openvpn.net>
---
 src/openvpn/options.c | 7 ++++++-
 src/openvpn/options.h | 2 ++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 4af2974..1739460 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -4512,6 +4512,11 @@ add_option (struct options *options,
        goto err;
     }
 #endif
+  else if (streq (p[0], "remote-override") && p[1])
+    {
+      VERIFY_PERMISSION (OPT_P_GENERAL);
+      options->remote_override = p[1];
+    }
   else if (streq (p[0], "remote") && p[1])
     {
       struct remote_entry re;
@@ -4520,7 +4525,7 @@ add_option (struct options *options,
       re.af=0;

       VERIFY_PERMISSION (OPT_P_GENERAL|OPT_P_CONNECTION);
-      re.remote = p[1];
+      re.remote = options->remote_override ? options->remote_override : p[1];
       if (p[2])
        {
          re.remote_port = p[2];
diff --git a/src/openvpn/options.h b/src/openvpn/options.h
index ec1d091..1775c02 100644
--- a/src/openvpn/options.h
+++ b/src/openvpn/options.h
@@ -222,6 +222,8 @@ struct options

   struct remote_host_store *rh_store;

+  const char *remote_override;
+
   bool remote_random;
   const char *ipchange;
   const char *dev;
-- 
1.8.5.5


Reply via email to