Skip to contentSkip to conversation

Change in openvpn[master]: dns option: make server id/priority optional

Openvpn-devel flichtenheld (Code Review) 1 participant 8 messages Sep 12, 2023 – Dec 4, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1677715752000.I1f97d8e5ae8f049d72db5c12ce627f601d87505c@...2715...

#1 lore raw

Attention is currently required from: flichtenheld, plaisthos.

d12fk has uploaded this change for review. ( http://gerrit.openvpn.net/c/openvpn/+/40?usp=email )

Change subject: dns option: make server id/priority optional
......................................................................

dns option: make server id/priority optional

With the discovery that most of the time only one DNS server's settings can be applied on various systems, the priority value will likely serve no purpose most of the time.

This is to make it optional to give a --dns server priority, for cases where you only specify one DNS server anyway. We keep the priority because it still serves the case where you want to override pushed server settings with local ones and when you run backends which do support multiple server's settings like dnsmasq(8).

Change-Id I1f97d8e5ae8f049d72db5c12ce627f601d87505c

---
M doc/man-sections/client-options.rst
M src/openvpn/dns.c
M src/openvpn/dns.h
M src/openvpn/options.c

4 files changed, 37 insertions(+), 28 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/40/40/5

doc/man-sections/client-options.rst +6 -5
index 4555534..df8ac43 100644
@@ -168,11 +168,11 @@
   ::
 
      dns search-domains domain [domain ...]
-     dns server n address addr[:port] [addr[:port] ...]
-     dns server n resolve-domains domain [domain ...]
-     dns server n dnssec yes|optional|no
-     dns server n transport DoH|DoT|plain
-     dns server n sni server-name
+     dns server [n] address addr[:port] [addr[:port] ...]
+     dns server [n] resolve-domains domain [domain ...]
+     dns server [n] dnssec yes|optional|no
+     dns server [n] transport DoH|DoT|plain
+     dns server [n] sni server-name
 
   The ``--dns search-domains`` directive takes one or more domain names
   to be added as DNS domain suffixes. If it is repeated multiple times within
@@ -180,6 +180,7 @@
   a server will amend locally defined ones.
 
   The ``--dns server`` directive is used to configure DNS server ``n``.
+  If the ``n`` parameter is omitted the directive configures DNS server ``0``.
   The server id ``n`` must be a value between -128 and 127. For pushed
   DNS server options it must be between 0 and 127. The server id is used
   to group options and also for ordering the list of configured DNS servers;
src/openvpn/dns.c +7 -2
index 51fca2f..5f5e06b 100644
@@ -159,13 +159,18 @@
 }
 
 bool
-dns_server_priority_parse(long *priority, const char *str, bool pulled)
+dns_server_priority_parse(long *priority, size_t *subidx, const char *str, bool pulled)
 {
     char *endptr;
     const long min = pulled ? 0 : INT8_MIN;
     const long max = INT8_MAX;
     long prio = strtol(str, &endptr, 10);
-    if (*endptr != '\0' || prio < min || prio > max)
+    if (endptr == str)
+    {
+        /* No priority found, str isn't numeric */
+        *subidx -= 1;
+    }
+    else if (*endptr != '\0' || prio < min || prio > max)
     {
         return false;
     }
src/openvpn/dns.h +3 -1
index e497857..d0258f7 100644
@@ -78,11 +78,13 @@
  * Parses a string DNS server priority and validates it.
  *
  * @param   priority    Pointer to where the priority should be stored
+ * @param   subidx      Pointer to the sub-option index, decremented if no
+ *                      priority value could be found
  * @param   str         Priority string to parse
  * @param   pulled      Whether this was pulled from a server
  * @return              True if priority in string is valid
  */
-bool dns_server_priority_parse(long *priority, const char *str, bool pulled);
+bool dns_server_priority_parse(long *priority, size_t *subidx, const char *str, bool pulled);
 
 /**
  * Find or create DNS server with priority in a linked list.
src/openvpn/options.c +21 -20

104 lines not on this page · raw message

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/40?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1f97d8e5ae8f049d72db5c12ce627f601d87505c
Gerrit-Change-Number: 40
Gerrit-PatchSet: 5
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, flichtenheld.

plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/40?usp=email )

Change subject: dns option: make server id/priority optional
......................................................................

Patch Set 5:

(1 comment)

Patchset:

PS5:
I am really behind this idea. Is dropping the priority important enough to warrant having to deal with the difference between versions that suppport this and version that do not support this (2.6 and 3.8) worth the trouble?

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/40?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1f97d8e5ae8f049d72db5c12ce627f601d87505c
Gerrit-Change-Number: 40
Gerrit-PatchSet: 5
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Tue, 12 Sep 2023 11:09:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, flichtenheld.

plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/40?usp=email )

Change subject: dns option: make server id/priority optional
......................................................................

Patch Set 5:

(1 comment)

Patchset:

PS5:
I meant "not behind the idea" I cannot find a way tol edit my comment.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/40?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1f97d8e5ae8f049d72db5c12ce627f601d87505c
Gerrit-Change-Number: 40
Gerrit-PatchSet: 5
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Tue, 12 Sep 2023 11:10:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld.

d12fk has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/40?usp=email )

Change subject: dns option: make server id/priority optional
......................................................................

Patch Set 5: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/40?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1f97d8e5ae8f049d72db5c12ce627f601d87505c
Gerrit-Change-Number: 40
Gerrit-PatchSet: 5
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 12 Sep 2023 13:54:11 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#5 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

d12fk has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/40?usp=email )

Change subject: dns option: make server id/priority optional
......................................................................

Patch Set 5:

(1 comment)

Patchset:

PS5:

Quoted 1 line

I meant "not behind the idea" I cannot find a way tol edit my comment.

I'm not demanding for this to go in, but in reality most ppl will only ever push one set of dns options, that's where the idea came from. Could be impelented in v3 as well when we decide to merge it in v2.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/40?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1f97d8e5ae8f049d72db5c12ce627f601d87505c
Gerrit-Change-Number: 40
Gerrit-PatchSet: 5
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 12 Sep 2023 13:56:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Gerrit-MessageType: comment

#6 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

d12fk has removed a vote from this change. ( http://gerrit.openvpn.net/c/openvpn/+/40?usp=email )

Change subject: dns option: make server id/priority optional
......................................................................

Removed Code-Review+2 by d12fk <[email protected]...>
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/40?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1f97d8e5ae8f049d72db5c12ce627f601d87505c
Gerrit-Change-Number: 40
Gerrit-PatchSet: 5
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: deleteVote

#7 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, flichtenheld.

plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/40?usp=email )

Change subject: dns option: make server id/priority optional
......................................................................

Patch Set 6:

(1 comment)

File doc/man-sections/client-options.rst:

http://gerrit.openvpn.net/c/openvpn/+/40/comment/c8ce561a_922ced24 :
PS6, Line 183: If the ``n`` parameter is omitted the directive configures DNS server ``0``.
If you add like a comment here that only newer OpenVPN versions will not accept this.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/40?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1f97d8e5ae8f049d72db5c12ce627f601d87505c
Gerrit-Change-Number: 40
Gerrit-PatchSet: 6
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Sun, 08 Oct 2023 09:31:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#8 lore raw
In reply to a message not in the archive

d12fk has abandoned this change. ( http://gerrit.openvpn.net/c/openvpn/+/40?usp=email )

Change subject: dns option: make server id/priority optional
......................................................................

Abandoned

optional server id would introduce yet another config incompatibility
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/40?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1f97d8e5ae8f049d72db5c12ce627f601d87505c
Gerrit-Change-Number: 40
Gerrit-PatchSet: 6
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: abandon