From: "cron2 (Code Review)" Date: Wed, 30 Jul 2025 18:15:36 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="UnBMue3VZsg="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Fix broken DHCP options List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: stipa , plaisthos , flichtenheld Cc: openvpn-devel --UnBMue3VZsg= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#2) to the change originally created by= stipa. ( http://gerrit.openvpn.net/c/openvpn/+/1090?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: Fix broken DHCP options ...................................................................... Fix broken DHCP options Commit 2dfc4f ("dns: deal with --dhcp-options when --dns is active") broke support for --dhcp-options. It removed the setting of the DHCP_OPTIONS_DHCP_OPTIONAL flag for some DHCP options. This flag is required for those options to be applied correctly, as it is used when building the DHCP options string that is passed to the TAP driver. This commit fixes the issue by restoring the setting of this flag. GitHub: fixes OpenVPN/openvpn#791 Change-Id: I0d75efcceb826d06e74abd003d5377468ff9fe3b Signed-off-by: Lev Stipakov Acked-by: Gert Doering Message-Id: <20250730180527.25339-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32= 427.html Signed-off-by: Gert Doering --- M src/openvpn/options.c 1 file changed, 13 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/90/1090/2 diff --git a/src/openvpn/options.c b/src/openvpn/options.c index b7328d7..53be6f5 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -8712,9 +8712,12 @@ #endif VERIFY_PERMISSION(OPT_P_DHCPDNS); + bool dhcp_optional =3D false; + if ((streq(p[1], "DOMAIN") || streq(p[1], "ADAPTER_DOMAIN_SUFFIX")= ) && p[2] && !p[3]) { dhcp->domain =3D p[2]; + dhcp_optional =3D true; } else if (streq(p[1], "DOMAIN-SEARCH") && p[2] && !p[3]) { @@ -8727,6 +8730,7 @@ msg(msglevel, "--dhcp-option %s: maximum of %d search entr= ies can be specified", p[1], N_SEARCH_LIST_LEN); } + dhcp_optional =3D true; } else if ((streq(p[1], "DNS") || streq(p[1], "DNS6")) && p[2] && !p= [3] && (!strstr(p[2], ":") || ipv6_addr_safe(p[2]))) @@ -8738,6 +8742,7 @@ else { dhcp_option_address_parse("DNS", p[2], dhcp->dns, &dhcp->d= ns_len, msglevel); + dhcp_optional =3D true; } } #if defined(_WIN32) || defined(TARGET_ANDROID) @@ -8761,6 +8766,7 @@ else if (streq(p[1], "WINS") && p[2] && !p[3]) { dhcp_option_address_parse("WINS", p[2], o->wins, &o->wins_len,= msglevel); + o->dhcp_options |=3D DHCP_OPTIONS_DHCP_OPTIONAL; } else if (streq(p[1], "NTP") && p[2] && !p[3]) { @@ -8792,6 +8798,13 @@ #else /* if defined(_WIN32) || defined(TARGET_ANDROID) */ setenv_foreign_option(options, p[1], p[2], es); #endif /* if defined(_WIN32) || defined(TARGET_ANDROID) */ + + if (dhcp_optional) + { +#if defined(_WIN32) || defined(TARGET_ANDROID) + o->dhcp_options |=3D DHCP_OPTIONS_DHCP_OPTIONAL; +#endif + } } #ifdef _WIN32 else if (streq(p[0], "show-adapters") && !p[1]) -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1090?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: I0d75efcceb826d06e74abd003d5377468ff9fe3b Gerrit-Change-Number: 1090 Gerrit-PatchSet: 2 Gerrit-Owner: stipa Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --UnBMue3VZsg= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #2 to the change originally cr= eated by stipa.

View Change

The following approvals got outdated an= d were removed: Code-Review+2 by cron2

Fix broken DHCP options

Commit

2dfc4= f ("dns: deal with --dhcp-options when --dns is active")

b= roke support for --dhcp-options. It removed the setting of the
DHCP_OPTI= ONS_DHCP_OPTIONAL flag for some DHCP options. This flag is
required for = those options to be applied correctly, as it is used
when building the D= HCP options string that is passed to the TAP driver.

This commit fix= es the issue by restoring the setting of this flag.

GitHub: fixes Op= enVPN/openvpn#791

Change-Id: I0d75efcceb826d06e74abd003d5377468ff9fe= 3b
Signed-off-by: Lev Stipakov <lev@...515...>
Acked-by: Gert D= oering <gert@...1296...>
Message-Id: <20250730180527.25339-1-ge= rt@...1296...>
URL: https://www.mail-archive.com/openvpn-devel@...1199...= sourceforge.net/msg32427.html
Signed-off-by: Gert Doering <gert@...1711...= 96...>
---
M src/openvpn/options.c
1 file changed, 13 insertion= s(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/open=
vpn refs/changes/90/1090/2
diff --git a/src/openvpn/options.c b/src=
/openvpn/options.c
index b7328d7..53be6f5 100644
= --- a/src/openvpn/options.c
+++ b/src/openvpn/options= .c
@@ -8712,9 +8712,12 @@
#endif VERIFY_PERMISSION(OPT_P_DHCPDNS);
<= br>+ bool dhcp_optional = =3D false;
+ if ((streq(p[1], "DOMAIN") || streq(p[1], "= ADAPTER_DOMAIN_SUFFIX")) && p[2] && !p[3])
<= span> {
dhcp->domain =3D p[2];
+ dhcp_optiona= l =3D true;
}
else if (st= req(p[1], "DOMAIN-SEARCH") && p[2] && !p[3])
{
@@ -8727,6 +8730,7 @@
msg(msglevel, "--dhcp-option %s: maximum of %d sear= ch entries can be specified",

p[1= ], N_SEARCH_LIST_LEN);
}
+ dhcp_optional =3D true;
}
else if ((streq(p[1], "= DNS") || streq(p[1], "DNS6")) && p[2] && !p[= 3]
&& (!strstr(p[2], ":"= ;) || ipv6_addr_safe(p[2])))
@@ -8738,6 +8742,7 @@ else
{
= dhcp_option_address_parse("DNS", p[2], dhcp->dn= s, &dhcp->dns_len, msglevel);
+ dhcp_optional =3D true;
= }
}
#if defined(_WIN32= ) || defined(TARGET_ANDROID)
@@ -8761,6 +8766,7 @@ else if (streq(p[1], "WINS") && p[2] &am= p;& !p[3])
{
dhcp= _option_address_parse("WINS", p[2], o->wins, &o->wins_l= en, msglevel);
+ = o->dhcp_options |=3D DHCP_OPTIONS_DHCP_OPTIONAL;
= }
else if (streq(p[1], "NTP") &= amp;& p[2] && !p[3])
{
@@ -8792,6 +8798,13 @@

#else /* if defined(_WIN32) || def= ined(TARGET_ANDROID) */
setenv_foreign_option(opti= ons, p[1], p[2], es);
#endif /* if defined(_WIN32) || defi= ned(TARGET_ANDROID) */
+ if (dhcp= _optional)
+ {=
+#if defined(_WIN32)= || defined(TARGET_ANDROID)
+ o->dhcp_options |=3D DHCP_OPTIONS_DHCP_OPTIONAL;
+#endif
+ }
}
#ifdef _WIN32
else if (streq(p[0], "= ;show-adapters") && !p[1])

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

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0d75efcceb826d06e74abd003d5= 377468ff9fe3b
Gerrit-Change-Number: 1090
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <lstipakov@...277...>= ;
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--UnBMue3VZsg=--