]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Preserve --dhcp-option values from local config
authorLev Stipakov <lev@openvpn.net>
Fri, 12 Sep 2025 13:22:35 +0000 (15:22 +0200)
committerGert Doering <gert@greenie.muc.de>
Sat, 13 Sep 2025 17:10:20 +0000 (19:10 +0200)
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, and for that
we call clone_dns_options(). However, this was missing to clone the
"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: closes OpenVPN/openvpn#839
Github: closes OpenVPN/openvpn#840

Change-Id: I815e68dd5d365743faff2b80783b776d9e8a645c
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20250912132235.44304-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32879.html
URL: https://gerrit.openvpn.net/c/openvpn/+/1181
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/dns.c

index 8554089c0a5510b258a0829b3e0a9a4f1cc97b5c..5421004969791b2665185a052a5f8edab69309fb 100644 (file)
@@ -264,6 +264,7 @@ clone_dns_options(const struct dns_options *o, struct gc_arena *gc)
     clone.servers_prepull = clone_dns_servers(o->servers_prepull, gc);
     clone.updown = o->updown;
     clone.updown_flags = o->updown_flags;
+    clone.from_dhcp = o->from_dhcp;
 
     return clone;
 }