From: "stipa (Code Review)" Date: Thu, 31 Jul 2025 10:56:16 +0000 References: Reply-To: lstipakov@...277..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="6fudm7fUOuY="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Fix DNS options duplication on PUSH_UPDATE List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --6fudm7fUOuY= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1121?usp=3Demail to review the following change. Change subject: Fix DNS options duplication on PUSH_UPDATE ...................................................................... Fix DNS options duplication on PUSH_UPDATE Commit 2dfc4f ("dns: deal with --dhcp-options when --dns is active") has removed reset of tuntap DNS options. Due to that, incoming --dns options are added to existing ones instead of overwriting them. It has also added a new storage for --dhcp-option. The push-update code didn't clear it and as a result, incoming --dhcp-option options were added to existing once instead of overwriting them. Fixed by: - reseting tuntap DNS options (regression from abovementioned commit) - clearing dhcp options storage in push-update code Change-Id: Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787 Signed-off-by: Lev Stipakov --- M src/openvpn/options.c 1 file changed, 14 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/21/1121/1 diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 3753810..8ce57ff 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -3527,7 +3527,13 @@ #endif /* if defined(_WIN32) */ /* Copy --dns options to tuntap_options */ + const struct dns_domain *d =3D dns->search_domains; + if (d) + { + tt->domain_search_list_len =3D 0; + } + while (d && tt->domain_search_list_len + 1 < N_SEARCH_LIST_LEN) { tt->domain_search_list[tt->domain_search_list_len++] =3D d->name; @@ -3539,6 +3545,12 @@ } const struct dns_server *s =3D dns->servers; + if (s) + { + tt->dns_len =3D 0; + tt->dns6_len =3D 0; + } + while (s) { bool non_standard_server_port =3D false; @@ -6212,6 +6224,8 @@ } o->disable_nbt =3D 0; o->dhcp_options =3D 0; + + CLEAR(options->dns_options.from_dhcp); #if defined(TARGET_ANDROID) o->http_proxy_port =3D 0; o->http_proxy =3D NULL; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1121?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787 Gerrit-Change-Number: 1121 Gerrit-PatchSet: 1 Gerrit-Owner: stipa Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --6fudm7fUOuY= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

stipa would like plaisthos and flichtenheld to review t= his change.

V= iew Change

Fix DNS options duplication on PUSH_UPDATE

Commit
=
2dfc4f ("dns: deal with --dhcp-options when --dns is active&qu= ot;)

has removed reset of tuntap DNS options. Due to that, incoming = --dns
options are added to existing ones instead of overwriting them.
It has also added a new storage for --dhcp-option. The push-update
= code didn't clear it and as a result, incoming --dhcp-option optionswere added to existing once instead of overwriting them.

Fixed by:<= br>
- reseting tuntap DNS options (regression from abovementioned commi= t)
- clearing dhcp options storage in push-update code

Change-Id= : Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787
Signed-off-by: Lev Stipakov = <lev@...515...>
---
M src/openvpn/options.c
1 file changed, = 14 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.ne=
t:29418/openvpn refs/changes/21/1121/1
diff --git a/src/openvpn/opt=
ions.c b/src/openvpn/options.c
index 3753810..8ce57ff 10064= 4
--- a/src/openvpn/options.c
+++ b/src/ope= nvpn/options.c
@@ -3527,7 +3527,13 @@
#end= if /* if defined(_WIN32) */

/* Copy = --dns options to tuntap_options */
+
const struct dns_domain *d =3D dns->= ;search_domains;
+ = if (d)
+ {=
+ tt->domain_sear= ch_list_len =3D 0;
+ = }
+
while (d && tt->domain_search_list_len + 1 < N_SEARCH_= LIST_LEN)
{
tt->domain_sea= rch_list[tt->domain_search_list_len++] =3D d->name;
@= @ -3539,6 +3545,12 @@
}

const struct dns_server *s =3D dns->servers;
+ if (s)
+ {
+ tt->dns_len =3D 0;
+ tt->dns6_len =3D 0;
+ }
+
while (s)
{=
bool non_standard_server_port =3D false;@@ -6212,6 +6224,8 @@
}
o->disable_nbt =3D 0;
o->= dhcp_options =3D 0;
+=
+ CLEAR(o= ptions->dns_options.from_dhcp);
#if defined(TARGET_ANDR= OID)
o->http_proxy_port =3D 0;
o->http_proxy =3D NULL;

To view, visit change 1121. To unsubscribe, or for help writing mail filte= rs, visit settings.

<= div itemscope itemtype=3D"http://schema.org/EmailMessage">
<= meta itemprop=3D"name" content=3D"View Change"/>
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ife4d8fc5f8e2183e61226d66a76= bbaa02c06f787
Gerrit-Change-Number: 1121
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <lstipakov@...277...>= ;
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--6fudm7fUOuY=--