From: "d12fk (Code Review)" Date: Wed, 4 Jun 2025 23:16:14 +0000 In-Reply-To: References: Reply-To: heiko@...515..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277..., gert@...1296... Message-ID: <05ed429c780837718e2d2817c0ddaa01b6d938f0-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="qXVHDykFg80="; 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: plaisthos , flichtenheld , stipa Cc: openvpn-devel --qXVHDykFg80= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: d12fk, flichtenheld, plaisthos, stipa. Hello flichtenheld, plaisthos, stipa, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/904?usp=3Demail to look at the new patch set (#22). The following approvals got outdated and were removed: Code-Review+1 by stipa 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 --- 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/22 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..33f387c 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: 22 Gerrit-Owner: d12fk Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-Reviewer: stipa Gerrit-CC: cron2 Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-Attention: d12fk Gerrit-Attention: stipa Gerrit-MessageType: newpatchset --qXVHDykFg80= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: d12fk, flichtenheld, plaisthos, s= tipa.

d12fk uploaded patch set #22 to this change.

View Change

The following approvals got outdated and were removed: Code-Review+1 by stipa

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...>
---
M src/openvpn/dns.c
M s= rc/openvpn/dns.h
M src/openvpn/options.c
3 files changed, 323 inserti= ons(+), 184 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/=
openvpn refs/changes/04/904/22
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
ru= n_up_down_command(bool up, struct options *o, const struct tuntap *tt, stru= ct dns_updown_runner_info *updown_runner)
{
- if (!o->dns_options.updown)
+ struct dns_option= s *dns =3D &o->dns_options;
+ if (!dns->updown || (o->up_script && !dns-= >user_set_updown))
{
retur= n;
}
@@ -701,7 +702,7 @@
if (!updown_runner->required)
{
<= span> /* Run dns updown directly */
- status =3D do_run_up_down_command(up, NULL, &= amp;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_win= 32_type =3D=3D IPW32_SET_ADAPTIVE)
+ {
= + return;
+ = }
+#endif
=
/* Warn about adding servers of unsupported AF= */
const struct dns_server *s =3D o->dns_options.s= ervers;
diff --git a/src/openvpn/dns.h b/src/openvpn/dns.h<= /span>
index 60f5471..688daa7 100644
--- a/src/ope= nvpn/dns.h
+++ b/src/openvpn/dns.h
@@ -76,7= +76,28 @@
#endif
};

+#ifndef N_DHCP_ADDR
+#define N_DHCP_ADDR 4<= /span>
+#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 fr= om_dhcp;
struct dns_domain *search_domains;
= struct dns_server *servers_prepull;
struct = dns_server *servers;
diff --git a/src/openvpn/options.c b/s= rc/openvpn/options.c
index 6ea01d4..33f387c 100644--- a/src/openvpn/options.c
+++ b/src/openvpn/optio= ns.c
@@ -1328,7 +1328,6 @@
#endif /* ifnde= f 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 *l= en, int msglevel)
{
@@ -1371,150 +1370,6 @= @
}
}

-/*

- * If DNS options are set use these for TUN/TAP option= s as well.
- * Applies = to DNS, DNS6 and DOMAIN-SEARCH.
- * Existing options will be discarded.
- */
-static void
-t= untap_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)
- {<= br>- 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_sea= rch_list_len++] =3D domain->name;
- domain =3D domain->next;
- }
- if (domain)
- {
- msg(M_WARN, "WARNING: couldn't copy all --dns s= earch-domains to --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->s= ervers;
- 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_le= n++] =3D server->addr[i].in.a6;
- }
- }
= - server =3D server->next;
- }
- if (overflow)
- {
- = msg(M_WARN, "WARNING: couldn't copy all --dns server addres= ses to --dhcp-option");
- }
- = tt->dhcp_options |=3D DHCP_OPTIONS_DHCP_OPTIONAL;
- }
-}
-#e= lse /* if defined(_WIN32) || defined(TARGET_ANDROID) */
-static void
-foreign_options_copy_dns(struct options *o, struct = env_set *es)
-{<= br>- const struct dns_domain *= domain =3D o->dns_options.search_domains;
- const struct dns_server *server =3D o->dns_op= tions.servers;
- if = (!domain && !server)
- {
- r= eturn;
- }-
- /* 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_op= tion_%d", i);
-
- const char *env_= str =3D env_set_get(es, name);
- const char *value =3D strchr(env_str, '=3D') + 1;<= /span>
- if ((domain &a= mp;& strstr(value, "dhcp-option DOMAIN-SEARCH") =3D=3D value)=
- || (serve= r && 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",
- 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->name };
= - setenv_foreign_option(o,= argv, 3, es);
- = domain =3D domain->next;
- }
-- gc_free(&gc);-
- /* remove old leftover entries */
- while (o->foreign_option_ind= ex < opt_max)

- {=
- char name[32]= ;
- snprintf(nam= e, sizeof(name), "foreign_option_%d", opt_max--);
- setenv_del(es, name);
<= br>- }
-}
-#endif /* if defined(_WIN32) || defined(TARGET_ANDROID) */
-
#ifndef = ENABLE_SMALL
static const char *
print_vl= an_accept(enum vlan_acceptable_frames mode)
@@ -3603,6 +345= 8,260 @@
}
}
=
+#if defined(_WIN32) || def= ined(TARGET_ANDROID)
= +/**
+ * @brief Postp= rocess DNS related settings
+ *
+ * Set TU= N/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)
<= span style=3D"color: hsl(120, 100%, 40%);">+{

+ struct dns_options *dns =3D &o->dns_op= tions;
+ struct tu= ntap_options *tt =3D &o->tuntap_options;
+ if (!dns->servers)
+ {
+ /* Copy --dhcp-options to tuntap_options */
+ struct dhcp_opt= ions *dhcp =3D &dns->from_dhcp;
+ assert(sizeof(dhcp->dns) =3D=3D sizeof(tt->= ;dns));
+ asse= rt(sizeof(dhcp->dns6) =3D=3D sizeof(tt->dns6));
+ assert(sizeof(dhcp->domain_sea= rch_list) =3D=3D sizeof(tt->domain_search_list));
+
+ tt->domain =3D dhcp->domain;
+ tt->dns_len =3D dhcp->d= ns_len;
+ tt-&= gt;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;
<= span style=3D"color: hsl(120, 100%, 40%);">+ for (size_t i =3D 0; i = < SIZE(tt->domain_search_list); ++i)

+ {
+ tt->domain_search_list[i] =3D dhcp->domain_s= earch_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-&= gt;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-d= omains to TUN/TAP");
+ }
+<= br>+ const struct dns_server= *s =3D dns->servers;
+ while (s)
+ = {
+ bool no= n_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;
<= span style=3D"color: hsl(120, 100%, 40%);">+ break;+ }
+ }
+ if ((s->transport && s-&g= t;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
+ {
<= span style=3D"color: hsl(120, 100%, 40%);">+ bool overflow =3D f= alse;

+ fo= r (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, "WA= RNING: couldn't copy all --dns server addresses to TUN/TAP");

+ }
= + return;
= + }
+ }
+}
+#else /* if defi= ned(_WIN32) || defined(TARGET_ANDROID) */
+
+ * @brief Pos= tprocess DNS related settings
+ *
+ * Disc= ard existing --dhcp-options from the env if needed and possibly
<= span style=3D"color: hsl(120, 100%, 40%);">+ * replace them with values fro= m --dns. If no --dns servers are set copy
+ * the --dhcp-option values over for --dns-updown run= s.
+ *
+ * @param o pointer to the opt= ions struct
+ * @para= m es env set to modify potentially
+ */
+static void
+dhcp_o= ptions_postprocess_dns(struct options *o, struct env_set *es)
+{
+ struct gc_arena gc =3D gc_new();
+ struct dns_options *dns =3D &a= mp;o->dns_options;
+
+ if (dns->s= ervers || 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_SIZ= E, &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(&= amp;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_d= el(es, BSTR(&name));
+
+ it= em_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
+ &= amp;& strncmp(item_val + 12, "DOMAIN ", 7) !=3D 0
<= span style=3D"color: hsl(120, 100%, 40%);">+ && = strncmp(item_val + 12, "DNS6 ", 5) !=3D 0

+ && strncmp(it= em_val + 12, "DNS ", 4) !=3D 0))
+ {
+ /* Re-set the item with potentially update= d name */
+ = buf_clear(&name);
+ buf_printf(&name, "foreign_option_%d"= , ++o->foreign_option_index);
+ setenv_str(es, BSTR(&name), BSTR(&valu= e));
+ }
+ }
<= span style=3D"color: hsl(120, 100%, 40%);">+ }

+
+ if (!dns->servers)
+ {
+ struct dhcp_options *dhcp =3D &am= p;dns->from_dhcp;
= +
+ if (dhcp-&= gt;dns_len || dhcp->dns6_len)
+ {
+ ALLOC_OBJ= _CLEAR_GC(*entry, struct dns_domain, &dns->gc);
+ struct dns_domain *new =3D *= entry;
+ n= ew->name =3D dhcp->domain;
+ entry =3D &new->next;
+
+ for (size_t i =3D 0; i < dhcp->domain_sear= ch_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->d= ns_len && server->addr_count < max_addrs; ++i)
+ {

+ server->addr[server-&= gt;addr_count].in.a4.s_addr =3D htonl(dhcp->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->a= ddr[server->addr_count].in.a6 =3D dhcp->dns6[i];
+ server->addr[server-&= gt;addr_count].family =3D AF_INET6;
+ server->addr_count +=3D 1;
+ }

+ }
+ }
+ else if (o->up_script && !dns->user_set_updow= n)
+ {
<= span style=3D"color: hsl(120, 100%, 40%);">+ /* Set foreign option e= nv 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;<= /span>
+ 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 &&am= p; s->addr[i].port !=3D 53)
+ {
+ non_standard_server_port =3D true;
<= span style=3D"color: hsl(120, 100%, 40%);">+ break;

+ }=
+ }
+ if ((s->transport= && s->transport !=3D DNS_TRANSPORT_PLAIN)
+ || (s->dnssec &&am= p; s->dnssec !=3D DNS_SECURITY_NO)
+ || non_standard_server_port)
+ {
+ /* Skip servers requir= ing 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";<= /span>
+ = 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;
+ = }
+ }<= /span>
+ }
+

+ gc_free(&gc);
+}
+#endif /* if defined(_WIN32) || defined(TARGET_ANDROID) */
= +
static void<= /span>
options_postprocess_mutate(struct options *o, struct env_s= et *es)
{
@@ -3786,9 +3895,9 @@
= else
{
#if defined(_WIN32)= || defined(TARGET_ANDROID)
- tuntap_options_copy_dns(o);
+ tuntap_options_postprocess_dns(o);
= #else
- f= oreign_options_copy_dns(o, es);
+ dhcp_options_postprocess_dns(o, es);
#= endif
}
if (o->auth_token_gene= rate && !o->auth_token_renewal)
@@ -4171,9 +4280= ,9 @@
{
dns_options_postproce= ss_pull(&o->dns_options);
#if defined(_WIN32) || de= fined(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<= /span>
}
return success;
@@ -8162,18 +8271,43 @@

goto err;
<= span> }

}
-#if defined(_WIN32) || defined(TARGET_ANDROID)
<= span> else if (streq(p[0], "dhcp-option") && p[1])

{
= + struct dhcp_options *dhcp =3D &options->dns_options.from_dh= cp;
+#if defined(_WIN= 32) || defined(TARGET_ANDROID)
struct tuntap_optio= ns *o =3D &options->tuntap_options;
+#endif
VERIFY_PERMISSION(OP= T_P_DHCPDNS);

- if ((streq(p[1], "DOMAIN") || streq(p[1], "= ;ADAPTER_DOMAIN_SUFFIX"))
- && p[2] && !p[3])
+ if ((streq(p[1], "DOMAIN&qu= ot;) || streq(p[1], "ADAPTER_DOMAIN_SUFFIX")) && p[2] &am= p;& !p[3])
{
- o->domain =3D p[2];
- o->dhcp_options |=3D DHCP_O= PTIONS_DHCP_OPTIONAL;
+ dhcp->domain =3D p[2];
}+ else if (streq(p[1],= "DOMAIN-SEARCH") && p[2] && !p[3])
+ {
+ if (dhcp->domain_search_li= st_len < N_SEARCH_LIST_LEN)
+ {
+ dhcp->domain_search_list[dhcp->domain_search_lis= t_len++] =3D p[2];
+ = }
+ = else
+ = {
+ = msg(msglevel, "--dhcp-option %s: maximum of %d search entries can be s= pecified",
+ = p[1], N_SEARCH_LIST_LEN);
+ }
+ }
+ else if ((streq(p[1], "DNS") || streq(p[1], "D= NS6")) && p[2] && !p[3]
+ && (!strstr(p[2], ":= ") || ipv6_addr_safe(p[2])))
+ {
+ if (strstr(p[2], ":"))
+ {
+ dhcp_option_dns6_parse(p[2], dhcp-&g= t;dns6, &dhcp->dns6_len, msglevel);
+ }
+ else
+ {
+ dhcp_option_address_parse("DNS", p[2], dh= cp->dns, &dhcp->dns_len, msglevel);
+ }
+ }
+#if defined(_WIN32) || defined(TARGET_ANDROID)
= else if (streq(p[1], "NBS") && p[2] && !p[= 3])
{
o->netbios_s= cope =3D p[2];
@@ -8191,23 +8325,9 @@
= o->netbios_node_type =3D t;
o->d= hcp_options |=3D DHCP_OPTIONS_DHCP_REQUIRED;
}

- else if ((streq(p= [1], "DNS") || streq(p[1], "DNS6")) && p[2] &am= p;& !p[3]
- = && (!strstr(p[2], ":") || ipv6_addr_safe(p[2])))=
- {
<= span style=3D"color: hsl(0, 100%, 40%);">- if (strstr(p[2], &quo= t;:"))
- = {
- dh= cp_option_dns6_parse(p[2], o->dns6, &o->dns6_len, msglevel);

- }
- 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->win= s, &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_l= en, msglevel);
o->dhcp_options |=3D DHCP_OP= TIONS_DHCP_REQUIRED;
}
- else if (streq(p[1], "DOMAIN-SEARCH&= quot;) && p[2] && !p[3])
- {
- if (o->domain_search_list_len < N_SEARCH_LIST_LEN)=
- {<= br>- o->domain_= search_list[o->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);- }
- o->dhcp_options |=3D DH= CP_OPTIONS_DHCP_OPTIONAL;
- }
else if (streq(p[1], "DISABLE-N= BT") && !p[2])
{
= o->disable_nbt =3D 1;
@@ -8249,8 +8356,10 @@

msg(msglevel, "--dhcp-option: unknown optio= n type '%s' or missing or unknown parameter", p[1]); goto err;
}
- }
+#else /* if defined(_WIN32) || defined(TARGET_ANDROID)= */
+ setenv_f= oreign_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, vis= it change= 904. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I635c4018fb43b5976a39b6a90cb= 2e9cb2570cd6a
Gerrit-Change-Number: 904
Gerrit-PatchSet: 22
Gerrit-Owner: d12fk <heiko@...515...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-Reviewer: stipa <lstipakov@...277...= >
Gerrit-CC: cron2 <gert@...1296...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-Attention: d12fk <heiko@...515...>= ;
Gerrit-Attention: stipa <lstipakov@...1663...= .>
Gerrit-MessageType: newpatchset
--qXVHDykFg80=--