From: "stipa (Code Review)" Date: Fri, 12 Sep 2025 11:49:59 +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="kCZhpzupTRw="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: Preserve --dhcp-option values from local config List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --kCZhpzupTRw= 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/+/1181?usp=3Demail to review the following change. Change subject: Preserve --dhcp-option values from local config ...................................................................... Preserve --dhcp-option values from local config Commit 2dfc4f8 ("dns: deal with --dhcp-options when --dns is active") has changed the way how --dhcp-option values are stored. Instead of storing them directly in tuntap_options, they are now stored in dns_options->from_dhcp. Before connect, we save options before --pull is applied, for that we call clone_dns_options(). However, this routing was missing cloning of from_dhcp struct, and as a result, the values of --dhcp-option from' the local config have been lost. Fix by adding shallow-copying of dhcp_options to clone_dns_options(). It is safe to do because it only contains fixed-size arrays, scalar types and pointers to the strings which this struct doesn't own. GitHub: https://github.com/OpenVPN/openvpn/issues/839 Change-Id: I815e68dd5d365743faff2b80783b776d9e8a645c Signed-off-by: Lev Stipakov --- M src/openvpn/dns.c 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/81/1181/1 diff --git a/src/openvpn/dns.c b/src/openvpn/dns.c index 8554089..5421004 100644 --- a/src/openvpn/dns.c +++ b/src/openvpn/dns.c @@ -264,6 +264,7 @@ clone.servers_prepull =3D clone_dns_servers(o->servers_prepull, gc); clone.updown =3D o->updown; clone.updown_flags =3D o->updown_flags; + clone.from_dhcp =3D o->from_dhcp; return clone; } -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1181?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: I815e68dd5d365743faff2b80783b776d9e8a645c Gerrit-Change-Number: 1181 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 --kCZhpzupTRw= 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

Preserve --dhcp-option values from local config

Commi= t

2dfc4f8 ("dns: deal with --dhcp-options when --dns is activ= e")

has changed the way how --dhcp-option values are stored. In= stead of
storing them directly in tuntap_options, they are now stored in=
dns_options->from_dhcp.

Before connect, we save options befor= e --pull is applied, for that
we call clone_dns_options(). However, this= routing was missing cloning
of from_dhcp struct, and as a result, the v= alues of --dhcp-option from'
the local config have been lost.
Fix by adding shallow-copying of dhcp_options to clone_dns_options(). Itis safe to do because it only contains fixed-size arrays, scalar typesand pointers to the strings which this struct doesn't own.

GitH= ub: https://github.com/OpenVPN/openvpn/issues/839

Change-Id: I815e68= dd5d365743faff2b80783b776d9e8a645c
Signed-off-by: Lev Stipakov <lev@...220...= ..515...>
---
M src/openvpn/dns.c
1 file changed, 1 insertion(+= ), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn=
 refs/changes/81/1181/1
diff --git a/src/openvpn/dns.c b/src/openvp=
n/dns.c
index 8554089..5421004 100644
--- a= /src/openvpn/dns.c
+++ b/src/openvpn/dns.c
= @@ -264,6 +264,7 @@
clone.servers_prepull =3D clone_dn= s_servers(o->servers_prepull, gc);
clone.updown =3D= o->updown;
clone.updown_flags =3D o->updown_fla= gs;
+ clone.from_d= hcp =3D o->from_dhcp;

return clon= e;
}

To view, visit change 118= 1. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I815e68dd5d365743faff2b80783= b776d9e8a645c
Gerrit-Change-Number: 1181
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
--kCZhpzupTRw=--