]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Stub implementation of "--dhcp-option DNS6 <v6addr>"
authorGert Doering <gert@greenie.muc.de>
Mon, 21 Nov 2016 16:42:42 +0000 (17:42 +0100)
committerGert Doering <gert@greenie.muc.de>
Mon, 21 Nov 2016 17:41:58 +0000 (18:41 +0100)
This defines a new DHCP suboption "DNS6", but does not actually
implement anything but "document the option and understand it".

If received, it will be put into an "foreign_option_<n>" environment
variable where an --up script or plugin could receive and act upon it.

On non-Windows platforms, all "dhcp-option" sub-options end up there,
so v4 and v6 DNS options will be reflected like this:

   foreign_option_1=dhcp-option DNS6 2001:608::2
   foreign_option_2=dhcp-option DNS 195.30.0.2

v2: do not set o->dhcp_options if DNS6 is the single dhcp-option seen
    (spotted by Selva Nair)

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Selva Nair <selva.nair@gmail.com>
Message-Id: <1479746562-751-1-git-send-email-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13174.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
doc/openvpn.8
src/openvpn/options.c

index 11564afca8d4dae2402943b63661abb32a0aded8..d454a3659d72002739523cb676844da413743634 100644 (file)
@@ -5627,9 +5627,21 @@ across the VPN.
 Set Connection-specific DNS Suffix.
 
 .B DNS addr \-\-
-Set primary domain name server address.  Repeat
+Set primary domain name server IPv4 address.  Repeat
 this option to set secondary DNS server addresses.
 
+.B DNS6 addr \-\-
+Set primary domain name server IPv6 address.  Repeat
+this option to set secondary DNS server IPv6 addresses.
+
+Note: currently this is somewhat of a placeholder option - it is
+understood, but OpenVPN has no code to tell Windows about it (the
+existing DHCP code can only do IPv4 DHCP, and that protocol only
+permits IPv4 addresses anywhere).  The option will be put into the
+environment, so an
+.B \-\-up
+script could act upon it.
+
 .B WINS addr \-\-
 Set primary WINS server address (NetBIOS over TCP/IP Name Server).
 Repeat this option to set secondary WINS server addresses.
index 7f128c36eb632618a5d07750138a7bc1d44d44ca..f30e62dd7bd6ebcc98eea2a3484ddd1de3586720 100644 (file)
@@ -704,7 +704,8 @@ static const char usage_message[] =
   "                    which allow multiple addresses,\n"
   "                    --dhcp-option must be repeated.\n"
   "                    DOMAIN name : Set DNS suffix\n"
-  "                    DNS addr    : Set domain name server address(es)\n"
+  "                    DNS addr    : Set domain name server address(es) (IPv4)\n"
+  "                    DNS6 addr   : Set domain name server address(es) (IPv6)\n"
   "                    NTP         : Set NTP server address(es)\n"
   "                    NBDD        : Set NBDD server address(es)\n"
   "                    WINS addr   : Set WINS server address(es)\n"
@@ -6406,6 +6407,14 @@ add_option (struct options *options,
        {
          dhcp_option_address_parse ("DNS", p[2], o->dns, &o->dns_len, msglevel);
        }
+      else if (streq (p[1], "DNS6") && p[2])
+       {
+         /* this is somewhat of a placeholder - we understand the option,
+          * but cannot act upon it - so we'll just accept it and put it
+          * into the environment, as we would do on all non-win32 platforms
+          */
+         foreign_option (options, p, 3, es);
+       }
       else if (streq (p[1], "WINS") && p[2])
        {
          dhcp_option_address_parse ("WINS", p[2], o->wins, &o->wins_len, msglevel);
@@ -6427,7 +6436,14 @@ add_option (struct options *options,
          msg (msglevel, "--dhcp-option: unknown option type '%s' or missing or unknown parameter", p[1]);
          goto err;
        }
-      o->dhcp_options = true;
+
+      /* flag that we have options to give to the TAP driver's DHCPv4 server
+       *  - skipped for "DNS6", as that's not a DHCPv4 option
+       */
+      if (!streq (p[1], "DNS6"))
+       {
+         o->dhcp_options = true;
+       }
     }
 #endif
 #ifdef _WIN32