From: "cron2 (Code Review)" Date: Wed, 18 Jun 2025 13:01:09 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., heiko@...515..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277... Message-ID: <4de68b41e43fb1ac51200b07fd4a0b8f041ed39a-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="Z4r2Sgy/PtQ="; charset=UTF-8 Subject: [Openvpn-devel] [L] Change in openvpn[master]: dns: deal with --dhcp-options when --dns is active List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: d12fk , plaisthos , flichtenheld , stipa Cc: openvpn-devel --Z4r2Sgy/PtQ= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#25) to the change originally created b= y d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/904?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: dns: deal with --dhcp-options when --dns is active ...................................................................... dns: deal with --dhcp-options when --dns is active Since --dns settings overrule DNS related --dhcp-options, remove the latter when values were defined via --dns. To stay as backward compatible as possible, we add foreign_options to the script hook environment from the --dns values when a --up script is defined. In that case the default --dns-updown is not run, even when --dns values are present, to prevent double DNS configuration. This way an existing --up script that deals with DNS can run, without the immediate need to change after an openvpn upgrade and a server pushing --dns options. If you specify a custom --dns-updown, or force running the default dns-updown that comes with openvpn, those compat env vars are not set for --up scripts and the dns-updown command is run, even when there's an --up script present. Since Android uses the DNS values from tuntap_options, we always override those with --dns stuff unconditionally. Also on Windows when --ip-win32 is dynamic or adaptive, since DHCP relies on these as well. Change-Id: I635c4018fb43b5976a39b6a90cb2e9cb2570cd6a Signed-off-by: Heiko Hund Acked-by: Gert Doering Message-Id: <20250618124835.24737-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31= 922.html Signed-off-by: Gert Doering --- M src/openvpn/dns.c M src/openvpn/dns.h M src/openvpn/options.c 3 files changed, 323 insertions(+), 184 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/04/904/25 diff --git a/src/openvpn/dns.c b/src/openvpn/dns.c index 7cf1b63..939ae09 100644 --- a/src/openvpn/dns.c +++ b/src/openvpn/dns.c @@ -691,7 +691,8 @@ static void run_up_down_command(bool up, struct options *o, const struct tuntap *tt, s= truct dns_updown_runner_info *updown_runner) { - if (!o->dns_options.updown) + struct dns_options *dns =3D &o->dns_options; + if (!dns->updown || (o->up_script && !dns->user_set_updown)) { return; } @@ -701,7 +702,7 @@ if (!updown_runner->required) { /* Run dns updown directly */ - status =3D do_run_up_down_command(up, NULL, &o->dns_options, tt); + status =3D do_run_up_down_command(up, NULL, dns, tt); } else { @@ -852,6 +853,14 @@ { return; } +#ifdef _WIN32 + /* Don't use iservice in DHCP mode */ + struct tuntap_options *tto =3D &o->tuntap_options; + if (tto->ip_win32_type =3D=3D IPW32_SET_DHCP_MASQ || tto->ip_win32_typ= e =3D=3D IPW32_SET_ADAPTIVE) + { + return; + } +#endif /* Warn about adding servers of unsupported AF */ const struct dns_server *s =3D o->dns_options.servers; diff --git a/src/openvpn/dns.h b/src/openvpn/dns.h index 60f5471..688daa7 100644 --- a/src/openvpn/dns.h +++ b/src/openvpn/dns.h @@ -76,7 +76,28 @@ #endif }; +#ifndef N_DHCP_ADDR +#define N_DHCP_ADDR 4 +#endif + +#ifndef N_SEARCH_LIST_LEN +#define N_SEARCH_LIST_LEN 10 +#endif + +struct dhcp_options { + in_addr_t dns[N_DHCP_ADDR]; + int dns_len; + + struct in6_addr dns6[N_DHCP_ADDR]; + int dns6_len; + + const char *domain; + const char *domain_search_list[N_SEARCH_LIST_LEN]; + int domain_search_list_len; +}; + struct dns_options { + struct dhcp_options from_dhcp; struct dns_domain *search_domains; struct dns_server *servers_prepull; struct dns_server *servers; diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 6ea01d4..d758a67 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -1328,7 +1328,6 @@ #endif /* ifndef ENABLE_SMALL */ #endif /* ifdef _WIN32 */ -#if defined(_WIN32) || defined(TARGET_ANDROID) static void dhcp_option_dns6_parse(const char *parm, struct in6_addr *dns6_list, int *= len, int msglevel) { @@ -1371,150 +1370,6 @@ } } -/* - * If DNS options are set use these for TUN/TAP options as well. - * Applies to DNS, DNS6 and DOMAIN-SEARCH. - * Existing options will be discarded. - */ -static void -tuntap_options_copy_dns(struct options *o) -{ - struct tuntap_options *tt =3D &o->tuntap_options; - struct dns_options *dns =3D &o->dns_options; - - if (dns->search_domains) - { - tt->domain_search_list_len =3D 0; - const struct dns_domain *domain =3D dns->search_domains; - while (domain && tt->domain_search_list_len < N_SEARCH_LIST_LEN) - { - tt->domain_search_list[tt->domain_search_list_len++] =3D domai= n->name; - domain =3D domain->next; - } - if (domain) - { - msg(M_WARN, "WARNING: couldn't copy all --dns search-domains t= o --dhcp-option"); - } - tt->dhcp_options |=3D DHCP_OPTIONS_DHCP_REQUIRED; - } - - if (dns->servers) - { - tt->dns_len =3D 0; - tt->dns6_len =3D 0; - bool overflow =3D false; - const struct dns_server *server =3D dns->servers; - while (server) - { - for (int i =3D 0; i < server->addr_count; ++i) - { - if (server->addr[i].family =3D=3D AF_INET) - { - if (tt->dns_len >=3D N_DHCP_ADDR) - { - overflow =3D true; - continue; - } - tt->dns[tt->dns_len++] =3D ntohl(server->addr[i].in.a4= .s_addr); - } - else - { - if (tt->dns6_len >=3D N_DHCP_ADDR) - { - overflow =3D true; - continue; - } - tt->dns6[tt->dns6_len++] =3D server->addr[i].in.a6; - } - } - server =3D server->next; - } - if (overflow) - { - msg(M_WARN, "WARNING: couldn't copy all --dns server addresses= to --dhcp-option"); - } - tt->dhcp_options |=3D DHCP_OPTIONS_DHCP_OPTIONAL; - } -} -#else /* if defined(_WIN32) || defined(TARGET_ANDROID) */ -static void -foreign_options_copy_dns(struct options *o, struct env_set *es) -{ - const struct dns_domain *domain =3D o->dns_options.search_domains; - const struct dns_server *server =3D o->dns_options.servers; - if (!domain && !server) - { - return; - } - - /* reset the index since we're starting all over again */ - int opt_max =3D o->foreign_option_index; - o->foreign_option_index =3D 0; - - for (int i =3D 1; i <=3D opt_max; ++i) - { - char name[32]; - snprintf(name, sizeof(name), "foreign_option_%d", i); - - const char *env_str =3D env_set_get(es, name); - const char *value =3D strchr(env_str, '=3D') + 1; - if ((domain && strstr(value, "dhcp-option DOMAIN-SEARCH") =3D=3D v= alue) - || (server && strstr(value, "dhcp-option DNS") =3D=3D value)) - { - setenv_del(es, name); - } - else - { - setenv_foreign_option(o, &value, 1, es); - } - } - - struct gc_arena gc =3D gc_new(); - - while (server) - { - for (size_t i =3D 0; i < server->addr_count; ++i) - { - if (server->addr[i].family =3D=3D AF_INET) - { - const char *argv[] =3D { - "dhcp-option", - "DNS", - print_in_addr_t(server->addr[i].in.a4.s_addr, 0, &gc) - }; - setenv_foreign_option(o, argv, 3, es); - } - else - { - const char *argv[] =3D { - "dhcp-option", - "DNS6", - print_in6_addr(server->addr[i].in.a6, 0, &gc) - }; - setenv_foreign_option(o, argv, 3, es); - } - } - server =3D server->next; - } - while (domain) - { - const char *argv[] =3D { "dhcp-option", "DOMAIN-SEARCH", domain->n= ame }; - setenv_foreign_option(o, argv, 3, es); - domain =3D domain->next; - } - - gc_free(&gc); - - /* remove old leftover entries */ - while (o->foreign_option_index < opt_max) - { - char name[32]; - snprintf(name, sizeof(name), "foreign_option_%d", opt_max--); - setenv_del(es, name); - } -} -#endif /* if defined(_WIN32) || defined(TARGET_ANDROID) */ - #ifndef ENABLE_SMALL static const char * print_vlan_accept(enum vlan_acceptable_frames mode) @@ -3603,6 +3458,260 @@ } } +#if defined(_WIN32) || defined(TARGET_ANDROID) +/** + * @brief Postprocess DNS related settings + * + * Set TUN/TAP DNS options with values from either --dns + * or --dhcp-option. + * + * @param o pointer to the options struct + */ +static void +tuntap_options_postprocess_dns(struct options *o) +{ + struct dns_options *dns =3D &o->dns_options; + struct tuntap_options *tt =3D &o->tuntap_options; + if (!dns->servers) + { + /* Copy --dhcp-options to tuntap_options */ + struct dhcp_options *dhcp =3D &dns->from_dhcp; + assert(sizeof(dhcp->dns) =3D=3D sizeof(tt->dns)); + assert(sizeof(dhcp->dns6) =3D=3D sizeof(tt->dns6)); + assert(sizeof(dhcp->domain_search_list) =3D=3D sizeof(tt->domain_s= earch_list)); + + tt->domain =3D dhcp->domain; + tt->dns_len =3D dhcp->dns_len; + tt->dns6_len =3D dhcp->dns6_len; + + memcpy(tt->dns, dhcp->dns, sizeof(tt->dns)); + memcpy(tt->dns6, dhcp->dns6, sizeof(tt->dns6)); + + tt->domain_search_list_len =3D dhcp->domain_search_list_len; + for (size_t i =3D 0; i < SIZE(tt->domain_search_list); ++i) + { + tt->domain_search_list[i] =3D dhcp->domain_search_list[i]; + } + + return; + } + +#if defined(_WIN32) + if (tt->ip_win32_type !=3D IPW32_SET_DHCP_MASQ && tt->ip_win32_type != =3D IPW32_SET_ADAPTIVE) + { + return; /* Not in DHCP mode */ + } +#endif /* if defined(_WIN32) */ + + /* Copy --dns options to tuntap_options */ + const struct dns_domain *d =3D dns->search_domains; + while (d && tt->domain_search_list_len + 1 < N_SEARCH_LIST_LEN) + { + tt->domain_search_list[tt->domain_search_list_len++] =3D d->name; + d =3D d->next; + } + if (d) + { + msg(M_WARN, "WARNING: couldn't copy all --dns search-domains to TU= N/TAP"); + } + + const struct dns_server *s =3D dns->servers; + while (s) + { + bool non_standard_server_port =3D false; + for (int i =3D 0; i < s->addr_count; ++i) + { + if (s->addr[i].port && s->addr[i].port !=3D 53) + { + non_standard_server_port =3D true; + break; + } + } + if ((s->transport && s->transport !=3D DNS_TRANSPORT_PLAIN) + || (s->dnssec && s->dnssec !=3D DNS_SECURITY_NO) + || non_standard_server_port) + { + /* Skip servers requiring unsupported config to be set */ + s =3D s->next; + } + else + { + bool overflow =3D false; + for (int i =3D 0; i < s->addr_count; ++i) + { + if (s->addr[i].family =3D=3D AF_INET && tt->dns_len + 1 < = N_DHCP_ADDR) + { + tt->dns[tt->dns_len++] =3D s->addr[i].in.a4.s_addr; + } + else if (tt->dns6_len + 1 < N_DHCP_ADDR) + { + tt->dns6[tt->dns6_len++] =3D s->addr[i].in.a6; + } + else + { + overflow =3D true; + } + } + if (overflow) + { + msg(M_WARN, "WARNING: couldn't copy all --dns server addre= sses to TUN/TAP"); + } + return; + } + } +} + +#else /* if defined(_WIN32) || defined(TARGET_ANDROID) */ + +/** + * @brief Postprocess DNS related settings + * + * Discard existing --dhcp-options from the env if needed and possibly + * replace them with values from --dns. If no --dns servers are set copy + * the --dhcp-option values over for --dns-updown runs. + * + * @param o pointer to the options struct + * @param es env set to modify potentially + */ +static void +dhcp_options_postprocess_dns(struct options *o, struct env_set *es) +{ + struct gc_arena gc =3D gc_new(); + struct dns_options *dns =3D &o->dns_options; + + if (dns->servers || dns->user_set_updown) + { + /* Clean up env from --dhcp-option DNS config */ + struct buffer name =3D alloc_buf_gc(OPTION_PARM_SIZE, &gc); + struct buffer value =3D alloc_buf_gc(OPTION_PARM_SIZE, &gc); + + const int fo_count =3D o->foreign_option_index; + o->foreign_option_index =3D 0; + + for (int i =3D 1; i <=3D fo_count; ++i) + { + buf_clear(&name); + buf_printf(&name, "foreign_option_%d", i); + const char *env_str =3D env_set_get(es, BSTR(&name)); + const char *item_val =3D strchr(env_str, '=3D') + 1; + buf_clear(&value); + buf_printf(&value, "%s", item_val); + + /* Remove foreign option item from env set */ + env_set_del(es, BSTR(&name)); + + item_val =3D BSTR(&value); + if (strncmp(item_val, "dhcp-option ", 12) !=3D 0 + || (strncmp(item_val + 12, "ADAPTER-DOMAIN-SUFFIX ", 22) != =3D 0 + && strncmp(item_val + 12, "DOMAIN-SEARCH ", 14) !=3D 0 + && strncmp(item_val + 12, "DOMAIN ", 7) !=3D 0 + && strncmp(item_val + 12, "DNS6 ", 5) !=3D 0 + && strncmp(item_val + 12, "DNS ", 4) !=3D 0)) + { + /* Re-set the item with potentially updated name */ + buf_clear(&name); + buf_printf(&name, "foreign_option_%d", ++o->foreign_option= _index); + setenv_str(es, BSTR(&name), BSTR(&value)); + } + } + } + + if (!dns->servers) + { + /* Copy --dhcp-options to dns_options */ + struct dhcp_options *dhcp =3D &dns->from_dhcp; + + if (dhcp->dns_len || dhcp->dns6_len) + { + struct dns_domain **entry =3D &dns->search_domains; + ALLOC_OBJ_CLEAR_GC(*entry, struct dns_domain, &dns->gc); + struct dns_domain *new =3D *entry; + new->name =3D dhcp->domain; + entry =3D &new->next; + + for (size_t i =3D 0; i < dhcp->domain_search_list_len; ++i) + { + ALLOC_OBJ_CLEAR_GC(*entry, struct dns_domain, &dns->gc); + struct dns_domain *new =3D *entry; + new->name =3D dhcp->domain_search_list[i]; + entry =3D &new->next; + } + + struct dns_server *server =3D dns_server_get(&dns->servers, 0,= &dns->gc); + const size_t max_addrs =3D SIZE(server->addr); + for (size_t i =3D 0; i < dhcp->dns_len && server->addr_count <= max_addrs; ++i) + { + server->addr[server->addr_count].in.a4.s_addr =3D htonl(dh= cp->dns[i]); + server->addr[server->addr_count].family =3D AF_INET; + server->addr_count +=3D 1; + } + for (size_t i =3D 0; i < dhcp->dns6_len && server->addr_count = < max_addrs; ++i) + { + server->addr[server->addr_count].in.a6 =3D dhcp->dns6[i]; + server->addr[server->addr_count].family =3D AF_INET6; + server->addr_count +=3D 1; + } + } + } + else if (o->up_script && !dns->user_set_updown) + { + /* Set foreign option env vars from --dns config */ + const char *p[] =3D { "dhcp-option", NULL, NULL }; + size_t p_len =3D sizeof(p) / sizeof(p[0]); + + p[1] =3D "DOMAIN"; + const struct dns_domain *d =3D dns->search_domains; + while (d) + { + p[2] =3D d->name; + setenv_foreign_option(o, (const char **)p, p_len, es); + d =3D d->next; + } + + const struct dns_server *s =3D dns->servers; + while (s) + { + bool non_standard_server_port =3D false; + for (int i =3D 0; i < s->addr_count; ++i) + { + if (s->addr[i].port && s->addr[i].port !=3D 53) + { + non_standard_server_port =3D true; + break; + } + } + if ((s->transport && s->transport !=3D DNS_TRANSPORT_PLAIN) + || (s->dnssec && s->dnssec !=3D DNS_SECURITY_NO) + || non_standard_server_port) + { + /* Skip servers requiring unsupported config to be set */ + s =3D s->next; + } + else + { + for (int i =3D 0; i < s->addr_count; ++i) + { + if (s->addr[i].family =3D=3D AF_INET) + { + p[1] =3D "DNS"; + p[2] =3D print_in_addr_t(s->addr[i].in.a4.s_addr, = IA_NET_ORDER, &gc); + } + else + { + p[1] =3D "DNS6"; + p[2] =3D print_in6_addr(s->addr[i].in.a6, 0, &gc); + } + setenv_foreign_option(o, (const char **)p, p_len, es); + } + break; + } + } + } + + gc_free(&gc); +} +#endif /* if defined(_WIN32) || defined(TARGET_ANDROID) */ + static void options_postprocess_mutate(struct options *o, struct env_set *es) { @@ -3786,9 +3895,9 @@ else { #if defined(_WIN32) || defined(TARGET_ANDROID) - tuntap_options_copy_dns(o); + tuntap_options_postprocess_dns(o); #else - foreign_options_copy_dns(o, es); + dhcp_options_postprocess_dns(o, es); #endif } if (o->auth_token_generate && !o->auth_token_renewal) @@ -4171,9 +4280,9 @@ { dns_options_postprocess_pull(&o->dns_options); #if defined(_WIN32) || defined(TARGET_ANDROID) - tuntap_options_copy_dns(o); + tuntap_options_postprocess_dns(o); #else - foreign_options_copy_dns(o, es); + dhcp_options_postprocess_dns(o, es); #endif } return success; @@ -8162,18 +8271,43 @@ goto err; } } -#if defined(_WIN32) || defined(TARGET_ANDROID) else if (streq(p[0], "dhcp-option") && p[1]) { + struct dhcp_options *dhcp =3D &options->dns_options.from_dhcp; +#if defined(_WIN32) || defined(TARGET_ANDROID) struct tuntap_options *o =3D &options->tuntap_options; +#endif VERIFY_PERMISSION(OPT_P_DHCPDNS); - if ((streq(p[1], "DOMAIN") || streq(p[1], "ADAPTER_DOMAIN_SUFFIX")) - && p[2] && !p[3]) + if ((streq(p[1], "DOMAIN") || streq(p[1], "ADAPTER_DOMAIN_SUFFIX")= ) && p[2] && !p[3]) { - o->domain =3D p[2]; - o->dhcp_options |=3D DHCP_OPTIONS_DHCP_OPTIONAL; + dhcp->domain =3D p[2]; } + else if (streq(p[1], "DOMAIN-SEARCH") && p[2] && !p[3]) + { + if (dhcp->domain_search_list_len < N_SEARCH_LIST_LEN) + { + dhcp->domain_search_list[dhcp->domain_search_list_len++] = =3D p[2]; + } + else + { + msg(msglevel, "--dhcp-option %s: maximum of %d search entr= ies can be specified", + p[1], N_SEARCH_LIST_LEN); + } + } + else if ((streq(p[1], "DNS") || streq(p[1], "DNS6")) && p[2] && !p= [3] + && (!strstr(p[2], ":") || ipv6_addr_safe(p[2]))) + { + if (strstr(p[2], ":")) + { + dhcp_option_dns6_parse(p[2], dhcp->dns6, &dhcp->dns6_len, = msglevel); + } + else + { + dhcp_option_address_parse("DNS", p[2], dhcp->dns, &dhcp->d= ns_len, msglevel); + } + } +#if defined(_WIN32) || defined(TARGET_ANDROID) else if (streq(p[1], "NBS") && p[2] && !p[3]) { o->netbios_scope =3D p[2]; @@ -8191,23 +8325,9 @@ o->netbios_node_type =3D t; o->dhcp_options |=3D DHCP_OPTIONS_DHCP_REQUIRED; } - else if ((streq(p[1], "DNS") || streq(p[1], "DNS6")) && p[2] && !p= [3] - && (!strstr(p[2], ":") || ipv6_addr_safe(p[2]))) - { - if (strstr(p[2], ":")) - { - dhcp_option_dns6_parse(p[2], o->dns6, &o->dns6_len, msglev= el); - } - else - { - dhcp_option_address_parse("DNS", p[2], o->dns, &o->dns_len= , msglevel); - o->dhcp_options |=3D DHCP_OPTIONS_DHCP_OPTIONAL; - } - } 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]) { @@ -8219,19 +8339,6 @@ dhcp_option_address_parse("NBDD", p[2], o->nbdd, &o->nbdd_len,= msglevel); o->dhcp_options |=3D DHCP_OPTIONS_DHCP_REQUIRED; } - else if (streq(p[1], "DOMAIN-SEARCH") && p[2] && !p[3]) - { - if (o->domain_search_list_len < N_SEARCH_LIST_LEN) - { - o->domain_search_list[o->domain_search_list_len++] =3D p[2= ]; - } - else - { - msg(msglevel, "--dhcp-option %s: maximum of %d search entr= ies can be specified", - p[1], N_SEARCH_LIST_LEN); - } - o->dhcp_options |=3D DHCP_OPTIONS_DHCP_OPTIONAL; - } else if (streq(p[1], "DISABLE-NBT") && !p[2]) { o->disable_nbt =3D 1; @@ -8249,8 +8356,10 @@ msg(msglevel, "--dhcp-option: unknown option type '%s' or miss= ing or unknown parameter", p[1]); goto err; } - } +#else /* if defined(_WIN32) || defined(TARGET_ANDROID) */ + setenv_foreign_option(options, (const char **)p, 3, es); #endif /* if defined(_WIN32) || defined(TARGET_ANDROID) */ + } #ifdef _WIN32 else if (streq(p[0], "show-adapters") && !p[1]) { -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/904?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: I635c4018fb43b5976a39b6a90cb2e9cb2570cd6a Gerrit-Change-Number: 904 Gerrit-PatchSet: 25 Gerrit-Owner: d12fk Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-Reviewer: stipa Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --Z4r2Sgy/PtQ= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #25 to the change originally c= reated by d12fk.

View Change

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

dns: deal with --dhcp-options when --dns is active
Since --dns settings overrule DNS related --dhcp-options,
remove t= he latter when values were defined via --dns.

To stay as backward co= mpatible as possible, we add foreign_options to
the script hook environm= ent from the --dns values when a --up script
is defined. In that case th= e default --dns-updown is not run, even
when --dns values are present, t= o prevent double DNS configuration.
This way an existing --up script tha= t deals with DNS can run, without
the immediate need to change after an = openvpn upgrade and a server
pushing --dns options.

If you specif= y a custom --dns-updown, or force running the default
dns-updown that co= mes with openvpn, those compat env vars are not set
for --up scripts and= the dns-updown command is run, even when there's
an --up script pre= sent.

Since Android uses the DNS values from tuntap_options, we alwa= ys
override those with --dns stuff unconditionally. Also on Windows when=
--ip-win32 is dynamic or adaptive, since DHCP relies on these as well.<= br>
Change-Id: I635c4018fb43b5976a39b6a90cb2e9cb2570cd6a
Signed-off-b= y: Heiko Hund <heiko@...2662...>
Acked-by: Gert Doering <gert@...220...= ..1296...>
Message-Id: <20250618124835.24737-1-gert@...1296...>=
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/m= sg31922.html
Signed-off-by: Gert Doering <gert@...1296...>
---<= br>M src/openvpn/dns.c
M src/openvpn/dns.h
M src/openvpn/options.c3 files changed, 323 insertions(+), 184 deletions(-)

git pull ss=
h://gerrit.openvpn.net:29418/openvpn refs/changes/04/904/25
diff --=
git a/src/openvpn/dns.c b/src/openvpn/dns.c
index 7cf1b63..= 939ae09 100644
--- a/src/openvpn/dns.c
+++ = b/src/openvpn/dns.c
@@ -691,7 +691,8 @@
st= atic void
run_up_down_command(bool up, struct options *o, = const struct tuntap *tt, struct dns_updown_runner_info *updown_runner)
{
- if = (!o->dns_options.updown)
+ struct dns_options *dns =3D &o->dns_options;
<= span style=3D"color: hsl(120, 100%, 40%);">+ if (!dns->updown || (o-&= gt;up_script && !dns->user_set_updown))

{
return;
}
@@ -= 701,7 +702,7 @@
if (!updown_runner->required)
{
/* Run dns updown directly */
- status =3D do_ru= n_up_down_command(up, NULL, &o->dns_options, tt);
+ status =3D do_run_up_down_comm= and(up, NULL, dns, tt);
}
else
{
@@ -852,6 +853,14 @@
= {
return;
}
+#ifdef _WIN32

+ /* Don't use iservice in DHCP m= ode */
+ struct tu= ntap_options *tto =3D &o->tuntap_options;
+ if (tto->ip_win32_type =3D=3D IPW32_SET= _DHCP_MASQ || tto->ip_win32_type =3D=3D IPW32_SET_ADAPTIVE)
+ {

+ return;
+ }
+#endif

/* Warn about addi= ng servers of unsupported AF */
const struct dns_serve= r *s =3D o->dns_options.servers;
diff --git a/src/openvp= n/dns.h b/src/openvpn/dns.h
index 60f5471..688daa7 100644
--- a/src/openvpn/dns.h
+++ b/src/openvpn/dn= s.h
@@ -76,7 +76,28 @@
#endif
};


+#ifndef N_DHCP_ADDR
+#define N_DHCP_ADDR 4
+#endif
+
+#ifndef N_SEARCH_LIST_LE= N
+#define N_SEARCH_L= IST_LEN 10
+#endif
+
+struct dhcp_options {
+ in_addr_t dns[N_DHCP_ADDR];<= br>+ int dns_len;
= +
+ struct in6_addr dns6[N_DHCP_ADDR];
= + int dns6_len;
+

+ const char *domain;
+ const char *domain_search_list[N_SEARCH_LIS= T_LEN];
+ int doma= in_search_list_len;
+= };
+
= struct dns_options {
+ struct dhcp_options from_dhcp;
struct dns_domain= *search_domains;
struct dns_server *servers_prepull;<= /span>
struct dns_server *servers;
diff --git= a/src/openvpn/options.c b/src/openvpn/options.c
index 6ea0= 1d4..d758a67 100644
--- a/src/openvpn/options.c
<= span>+++ b/src/openvpn/options.c

@@ -1328,7 +1328,6 @@
#endif /* ifndef ENABLE_SMALL */
#endif /* if= def _WIN32 */

-#if defined(_WIN32) || defined(TARGET_ANDROID)
s= tatic void
dhcp_option_dns6_parse(const char *parm, struct= in6_addr *dns6_list, int *len, int msglevel)
{
= @@ -1371,150 +1370,6 @@
}
}

-/*
- * If DNS options are set = use these for TUN/TAP options as well.
- * Applies to DNS, DNS6 and DOMAIN-SEARCH.
- * Existing options will be discarded= .

- */
-static void
-tuntap_options_copy_dns(struct options *o)
-{
- struct tuntap_options *tt =3D &o->tu= ntap_options;
- stru= ct dns_options *dns =3D &o->dns_options;
-
- if (dns->search_domains)
- {
- = tt->domain_search_list_len =3D 0;
- const struct dns_domain *domain =3D dns->s= earch_domains;
- = while (domain && tt->domain_search_list_len < N_SEARCH_LIST_= LEN)
- {<= br>- tt->domain_sea= rch_list[tt->domain_search_list_len++] =3D domain->name;
- domain =3D domain->= next;

- }=
- if (domain)- {
- msg(M_WARN, "WARNING: cou= ldn't copy all --dns search-domains to --dhcp-option");
= - }
- tt->dhcp_options |=3D DHCP_OPTIO= NS_DHCP_REQUIRED;
- = }
-
- if (dns->servers)
- {
- tt->dns_len =3D 0;
- tt->dns6_len =3D 0;
- bool overflow =3D false;
- const struct dns_s= erver *server =3D dns->servers;
- while (server)
- {
- for (int i =3D 0; i < server->addr_count; ++i)- {
- if (server->addr[i]= .family =3D=3D AF_INET)
- {
- = if (tt->dns_len >=3D N_DHCP_ADDR)
- {
- overflow =3D tr= ue;
- = continue;
- = }
- = tt->dns[tt->dns_len++] =3D ntohl(server->addr[i].in.= a4.s_addr);
- = }
- = else
- = {
- = if (tt->dns6_len >=3D N_DHCP_ADDR)
- {
- overflow =3D true;
- continue;<= /span>
- }<= /span>
- tt= ->dns6[tt->dns6_len++] =3D server->addr[i].in.a6;
- }
- }
- server =3D server->next;
= - }
- if (overflow)
- {
- msg(M_WARN, "WARNING: couldn't cop= y all --dns server addresses to --dhcp-option");
- }
- tt->dhcp_options |=3D DHCP_OPTIONS_DHCP_OPTI= ONAL;
- }
= -}
-#else /* if defined(_WIN32) || defined(TARGET_ANDROI= D) */
-static void
-foreign_options_copy_dns(s= truct options *o, struct env_set *es)
-{
- = const struct dns_domain *domain =3D o->dns_options.search_domains;

- const struct dns_server= *server =3D o->dns_options.servers;
- if (!domain && !server)
- {
- return;
- }
-
- /* reset the index sinc= e we're starting all over again */
- int opt_max =3D o->foreign_option_index;
= - o->foreign_option_index = =3D 0;
-
- for (int i =3D 1; i <=3D opt_= max; ++i)

- {=
- char name[32];
- snprintf(name, size= of(name), "foreign_option_%d", i);
-
- const char *env_str =3D env_set_get(es, name);
- const char *value =3D strchr(env= _str, '=3D') + 1;
- if ((domain && strstr(value, "dhcp-option DOMAIN-S= EARCH") =3D=3D value)
- || (server && strstr(value, "dhcp-option DNS&= quot;) =3D=3D value))
-= {
- = setenv_del(es, name);
-= }
- else=
- {
<= span style=3D"color: hsl(0, 100%, 40%);">- setenv_foreign_option= (o, &value, 1, es);

- }
- }
-
- struct gc_arena gc =3D gc_new();
= -
- while (server)
- {
- {
- if (server->addr[i].family = =3D=3D AF_INET)
- = {
- = const char *argv[] =3D {
- "dhcp-option",
- "DNS",
= - print_in_add= r_t(server->addr[i].in.a4.s_addr, 0, &gc)
- };
- setenv_foreign_option(o, argv, 3, e= s);
- }
- else- {
- const char *argv[] =3D = {
- = "dhcp-option",
- print_in6_addr(server->addr[i].in= .a6, 0, &gc)
- = };
- = setenv_foreign_option(o, argv, 3, es);
- }
- }
- server =3D server->next;
- }
-= {
- const ch= ar *argv[] =3D { "dhcp-option", "DOMAIN-SEARCH", domain= ->name };
- s= etenv_foreign_option(o, argv, 3, es);
- domain =3D domain->next;
- }
-
- g= c_free(&gc);
-
- /* remove old leftover= entries */
- while = (o->foreign_option_index < opt_max)
- {
- char name[32];
- snprintf(name, sizeof(name), "foreign_option_%d", op= t_max--);
- sete= nv_del(es, name);
- = }
-}
-#endif /* if defined(_WIN32) || defined(= TARGET_ANDROID) */
-
#ifndef ENABLE_SMALL
static const char *
print_vlan_accept(enum vlan_acceptable_frames mode)@@ -3603,6 +3458,260 @@
}
}

+#if= defined(_WIN32) || defined(TARGET_ANDROID)
+/**
+ * @brief Postprocess DNS related settings
+ *
+ * Set TUN/TAP DNS options with values from either --dns
+ * or --dhcp-option.
+ *
+ * @param o pointer to the options s= truct
+ */
= +static void
+tuntap_options_postprocess_dns(struct = options *o)
+{=
+ struct dns_options *dn= s =3D &o->dns_options;
+ struct tuntap_options *tt =3D &o->tuntap_options;
+ if (!dns->servers= )
+ {
+ /* Copy --dhcp-options t= o tuntap_options */

+= struct dhcp_options *dhcp =3D &dns->from_dhcp;
+ assert(sizeof(dhcp->dn= s) =3D=3D sizeof(tt->dns));

+ assert(sizeof(dhcp->dns6) =3D=3D sizeof(tt->dns6))= ;
+ assert(siz= eof(dhcp->domain_search_list) =3D=3D sizeof(tt->domain_search_list));=
+
+ tt->domain =3D dhcp->dom= ain;
+ tt->= dns_len =3D dhcp->dns_len;
+ tt->dns6_len =3D dhcp->dns6_len;
+
+ memcpy(tt->dns, dhcp->dns, sizeof(tt->dn= s));
+ memcpy(= tt->dns6, dhcp->dns6, sizeof(tt->dns6));
+
+ tt->domain_search_list_len =3D dhcp->domain_search= _list_len;
+ f= or (size_t i =3D 0; i < SIZE(tt->domain_search_list); ++i)
= + {
+ tt->domain_search_list[i]= =3D dhcp->domain_search_list[i];
+ }
+
+ retu= rn;
+ }
= +
+#if defined(_WIN32)
+ if (tt->ip_win32_type !=3D IPW32_SET_DHCP_= MASQ && tt->ip_win32_type !=3D IPW32_SET_ADAPTIVE)
+ {

+ return; /* Not in DHCP mode */
+ }
+#endif /* if defined(_WIN32) */=
+
+ /* Copy --dns options to tuntap_options *= /
+ const struct d= ns_domain *d =3D dns->search_domains;
+ while (d && tt->domain_search_list_len = + 1 < N_SEARCH_LIST_LEN)
+ {
+ = tt->domain_search_list[tt->domain_search_list_len++] =3D d->name= ;
+ d =3D d-&g= t;next;
+ }=
+ if (d)
+ {

+ msg(M_WARN, "WARNING: couldn't c= opy all --dns search-domains to TUN/TAP");
+ }
+
+ c= onst struct dns_server *s =3D dns->servers;
+ while (s)
+ {
+ bool non_standard_server_port =3D false;
+ for (int i =3D 0; i < s->= addr_count; ++i)
+ = {
+ i= f (s->addr[i].port && s->addr[i].port !=3D 53)
+ {

+ non_standard_server_port= =3D true;
+ = break;
+ = }
+ }
+ if ((s->tra= nsport && s->transport !=3D DNS_TRANSPORT_PLAIN)
+ || (s->dnssec &&= amp; s->dnssec !=3D DNS_SECURITY_NO)

+ || non_standard_server_port)
+ {

+ /* Skip servers requiring unsupp= orted config to be set */
+ s =3D s->next;
+ }
+ else
+ = {
+ = bool overflow =3D false;
+ for (int i =3D 0; i < s->addr_count; ++i)+ {
+ if (s->addr[i].f= amily =3D=3D AF_INET && tt->dns_len + 1 < N_DHCP_ADDR)
=
+ {+ tt->d= ns[tt->dns_len++] =3D s->addr[i].in.a4.s_addr;
+ }
+ else if (tt->dns6_len = + 1 < N_DHCP_ADDR)
+ {
+= tt->dns6[tt->dns6_len++] =3D s->addr[i].in.a6;=
+ }
+ else<= /span>
+ {
+ ov= erflow =3D true;
+ = }
+ = }
+ = if (overflow)
+ = {
+ = msg(M_WARN, "WARNING: couldn't copy all --dns server addresse= s to TUN/TAP");
= + }
+ = return;
+ = }
+ }+}
+
+#else /* if defined(_WIN32) || defined(TARGET_ANDROID) */+
+/**
+ * @brief Postprocess DNS related settings
+ *
+ * Discard existing --dhcp-options from the env if needed= and possibly
+ * rep= lace them with values from --dns. If no --dns servers are set copy+ * the --dhcp-option values = over for --dns-updown runs.
+ *
+ * @param= o pointer to the options struct
+ * @param es env set to modify potentially
+ */

+static void
+dhcp_options_postprocess_dns(struct options *o, struct e= nv_set *es)
+{=
+ struct gc_arena gc =3D= gc_new();
+ struc= t dns_options *dns =3D &o->dns_options;
+
+ if (dns->servers || dns->user_set_updown)
+ {

+ /* Clean up env from --dhcp-option DNS co= nfig */
+ stru= ct buffer name =3D alloc_buf_gc(OPTION_PARM_SIZE, &gc);
+ struct buffer value =3D all= oc_buf_gc(OPTION_PARM_SIZE, &gc);

+
+ = const int fo_count =3D o->foreign_option_index;
+ o->foreign_option_index = =3D 0;
+
+ for (int i =3D 1; i <= =3D fo_count; ++i)

+ = {
+ = buf_clear(&name);
+ const char = *env_str =3D env_set_get(es, BSTR(&name));
+ const char *item_val =3D strchr(env_= str, '=3D') + 1;
+ buf_clear(&value);
+ buf_printf(&value, "%s", item= _val);
+
+ /* Remove foreign op= tion item from env set */

+ env_set_del(es, BSTR(&name));
+
+ item_val =3D BSTR(&value);
+ if (strncmp(item_val, &qu= ot;dhcp-option ", 12) !=3D 0
+ || (strncmp(item_val + 12, "ADAPTER-DOMA= IN-SUFFIX ", 22) !=3D 0
+ && strncmp(item_val + 12, "DOMAIN= -SEARCH ", 14) !=3D 0
+ && strncmp(item_val + 12, "DOMAIN &= quot;, 7) !=3D 0
+ = && strncmp(item_val + 12, "DNS6 ", 5) != =3D 0
+ = && strncmp(item_val + 12, "DNS ", 4) !=3D 0))
+ {
<= span style=3D"color: hsl(120, 100%, 40%);">+ /* Re-set the i= tem with potentially updated name */

+ buf_clear(&name);
+ buf_printf(&name, &q= uot;foreign_option_%d", ++o->foreign_option_index);
+ setenv_str(es, BSTR= (&name), BSTR(&value));

+ }
+ }
+ = }
+
+ if (!dns->servers)
<= span style=3D"color: hsl(120, 100%, 40%);">+ {

+ /* Copy --dhcp-options to dns_options= */
+ struct d= hcp_options *dhcp =3D &dns->from_dhcp;
+
+ if (dhcp->dns_len || dhcp->dns6_len)
+ {
+ struct dns_domain **entry =3D &= dns->search_domains;
+ ALLOC_OBJ_CLEAR_GC(*entry, struct dns_domain, &dns->= gc);
+ str= uct dns_domain *new =3D *entry;
+ new->name =3D dhcp->domain;
+ entry =3D &new->ne= xt;
+
+ for (size_t i =3D 0; i = < dhcp->domain_search_list_len; ++i)

+ {
+ ALLOC_OBJ_CLEAR_GC(*entry, struct dns_doma= in, &dns->gc);
+ struct dns_domain *new =3D *entry;
+ new->name =3D dhcp->= ;domain_search_list[i];
+ entry =3D &new->next;
+ }
+
+ struct dns_server *server =3D dns_server_get(&dns->s= ervers, 0, &dns->gc);
+ const size_t max_addrs =3D SIZE(server->addr);
+ for (size_t = i =3D 0; i < dhcp->dns_len && server->addr_count < max_= addrs; ++i)
+ = {
+ = server->addr[server->addr_count].in.a4.s_addr =3D htonl(dhcp->dn= s[i]);
+ = server->addr[server->addr_count].family =3D AF_INET;
+ server->addr_c= ount +=3D 1;

+ = }
+ f= or (size_t i =3D 0; i < dhcp->dns6_len && server->addr_cou= nt < max_addrs; ++i)
+ {
+ = server->addr[server->addr_count].in.a6 =3D dhcp->dns= 6[i];
+ = server->addr[server->addr_count].family =3D AF_INET6;
+ server->addr_c= ount +=3D 1;

+ = }
+ }
+ }
+ else if (o->up_script &&am= p; !dns->user_set_updown)
+ {
+ = /* Set foreign option env vars from --dns config */
+ const char *p[] =3D { "dhcp= -option", NULL, NULL };
+ size_t p_len =3D sizeof(p) / sizeof(p[0]);
+

+ p[1] =3D "DOMAIN";
+ const struct dns_domain *d = =3D dns->search_domains;
+ while (d)
+ {
+ = p[2] =3D d->name;
+ setenv_foreign_option(o, (const char **)p, p_len, es);=
+ d =3D d= ->next;
+ }=
+
+ const struct dns_server *s =3D= dns->servers;
+ = while (s)
+ = {
+ bo= ol non_standard_server_port =3D false;
+ for (int i =3D 0; i < s->addr_count; += +i)
+ {
+ if (s-= >addr[i].port && s->addr[i].port !=3D 53)
+ {
+ non_standard_server_p= ort =3D true;
+ = break;
= + }
+ = }
+ = if ((s->transport && s->transport !=3D DNS_TRANSPORT_PLA= IN)
+ = || (s->dnssec && s->dnssec !=3D DNS_SECURITY_NO)
+ || non_standard_= server_port)

+ = {
+ = /* Skip servers requiring unsupported config to be set */
+ s =3D s->next;<= /span>
+ }=
+ else+ {
+ for (int i =3D 0; i= < s->addr_count; ++i)

+ {
+ if (s->addr[i].family =3D=3D AF_INET)<= br>+ {
+ p= [1] =3D "DNS";
+ p[2] =3D print_in_addr_t(s->addr[i].in.a4.s= _addr, IA_NET_ORDER, &gc);
+ }
+ else
+ {
+ p[1] =3D "DNS6";
+ = p[2] =3D print_in6_addr(s->addr[i].in.a6, 0, &gc);
+ }
+ setenv_foreign_= option(o, (const char **)p, p_len, es);

+ }
+ break;
+ }
+ }
+ }
++ gc_free(&gc);=
+}
+#endif /* if defined(_WIN32) || defined(TARG= ET_ANDROID) */
+
static void
options_postprocess_mutate(struct= options *o, struct env_set *es)
{
@@ -378= 6,9 +3895,9 @@
else
{
<= span> #if defined(_WIN32) || defined(TARGET_ANDROID)

- tuntap_options_copy_dns(o);<= br>+ tuntap_options_post= process_dns(o);
#else
- foreign_options_copy_dns(o, es);
+ dhcp_options_postprocess_dns(= o, es);
#endif
}
= if (o->auth_token_generate && !o->auth_token_renewal)=
@@ -4171,9 +4280,9 @@
{
= dns_options_postprocess_pull(&o->dns_options);
= #if defined(_WIN32) || defined(TARGET_ANDROID)
- tuntap_options_copy_dns(o);
+ tuntap_options_postproces= s_dns(o);

#else
- foreign_options_copy_dns(o, es);
+ dhcp_options_postprocess_dns(o, e= s);
#endif
}
ret= urn success;
@@ -8162,18 +8271,43 @@
= goto err;
}
}-#if defined(_WIN32) || defined= (TARGET_ANDROID)
else if (streq(p[0], "dhcp-optio= n") && p[1])
{
+ struct dhcp_options *dhcp =3D &opt= ions->dns_options.from_dhcp;
+#if defined(_WIN32) || defined(TARGET_ANDROID)
= struct tuntap_options *o =3D &options->tuntap_options;
+#endif
= VERIFY_PERMISSION(OPT_P_DHCPDNS);

- if ((streq(p[1], "DOMAIN= ") || streq(p[1], "ADAPTER_DOMAIN_SUFFIX"))

- && p[2] &&= !p[3])
+ if (= (streq(p[1], "DOMAIN") || streq(p[1], "ADAPTER_DOMAIN_SUFFIX= ")) && p[2] && !p[3])
{
- o->domain = =3D p[2];
- = o->dhcp_options |=3D DHCP_OPTIONS_DHCP_OPTIONAL;
+ dhcp->domain =3D p[2];
}
+ else if (streq(p[1], "DOMAIN-SEARCH") && p[2]= && !p[3])
+ = {
+ = if (dhcp->domain_search_list_len < N_SEARCH_LIST_LEN)
+ {

+ dhcp->domain_search_l= ist[dhcp->domain_search_list_len++] =3D p[2];
+ }
+ else
+ {
+ msg(msglevel, "--dhcp-option %s: maximum= of %d search entries can be specified",
+ p[1], N_SEARCH_LIST_LEN);
+ }+ }
+ else if ((streq(p[1], "DNS= ") || streq(p[1], "DNS6")) && p[2] && !p[3]<= /span>
+ &am= p;& (!strstr(p[2], ":") || ipv6_addr_safe(p[2])))
<= span style=3D"color: hsl(120, 100%, 40%);">+ {

+ if (strstr(p[2], ":"= ;))
+ {
+ dhcp_o= ption_dns6_parse(p[2], dhcp->dns6, &dhcp->dns6_len, msglevel);
+ }+ else
<= span style=3D"color: hsl(120, 100%, 40%);">+ {

+ dhcp_option_address_p= arse("DNS", p[2], dhcp->dns, &dhcp->dns_len, msglevel);=
+ }
+ }
+#if defined(_WIN32) || defined(TARG= ET_ANDROID)

else if (streq(p[1], "NBS") = && p[2] && !p[3])
{
o->netbios_scope =3D p[2];

@@ -8191,23 +8= 325,9 @@
o->netbios_node_type =3D t;=
o->dhcp_options |=3D DHCP_OPTIONS_DHCP_REQUIRED;<= /span>
}
- else if ((streq(p[1], "DNS") || streq(p[1], "DN= S6")) && p[2] && !p[3]
- && (!strstr(p[2], ":&qu= ot;) || ipv6_addr_safe(p[2])))
- {
- = if (strstr(p[2], ":"))
- {
- dhcp_option_dns6_parse(p[2], o->dns6, &o= ->dns6_len, msglevel);
- }
- = else
- = {
- d= hcp_option_address_parse("DNS", p[2], o->dns, &o->dns_l= en, msglevel);
- = o->dhcp_options |=3D DHCP_OPTIONS_DHCP_OPTIONAL;
- }

- }
else if = (streq(p[1], "WINS") && p[2] && !p[3])
= {
dhcp_option_address_parse(&qu= ot;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])
{
@@ -8219,19 +8339,6 @@
dhcp_option_address_parse("NBDD", p[2],= o->nbdd, &o->nbdd_len, msglevel);
o= ->dhcp_options |=3D DHCP_OPTIONS_DHCP_REQUIRED;
= }
- else if (st= req(p[1], "DOMAIN-SEARCH") && p[2] && !p[3])
- {
- if (o->domain_search_li= st_len < N_SEARCH_LIST_LEN)
- {
= - o->domain_search_list[o->domain_search_list_len++] = =3D p[2];
- = }
- else
- {
<= span style=3D"color: hsl(0, 100%, 40%);">- msg(msglevel, &qu= ot;--dhcp-option %s: maximum of %d search entries can be specified",
- p[1= ], N_SEARCH_LIST_LEN);
= - }
- = o->dhcp_options |=3D DHCP_OPTIONS_DHCP_OPTIONAL;
- }
else = if (streq(p[1], "DISABLE-NBT") && !p[2])
= {
o->disable_nbt =3D 1;
= @@ -8249,8 +8356,10 @@
msg(msglevel, &qu= ot;--dhcp-option: unknown option type '%s' or missing or unknown pa= rameter", p[1]);
goto err;
}

- }
+#else /* if defined(_WI= N32) || defined(TARGET_ANDROID) */
+ setenv_foreign_option(options, (const char **)p, 3, = es);
#endif /* if defined(_WIN32) || defined(TARGET_ANDROI= D) */
+ } #ifdef _WIN32
else if (streq(p[0], "show= -adapters") && !p[1])
{
<= /span>

To view, visit change 904. To unsubscribe, or for help writin= g mail filters, visit settin= gs.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I635c4018fb43b5976a39b6a90cb= 2e9cb2570cd6a
Gerrit-Change-Number: 904
Gerrit-PatchSet: 25
Gerrit-Owner: d12fk <heiko@...515...>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-Reviewer: stipa <lstipakov@...277...= >
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--Z4r2Sgy/PtQ=--