From: "d12fk (Code Review)" Date: Wed, 18 Jun 2025 12:47:25 +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: <84a7543624d977dc56a0d76a2a70acd942bd244e-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="usphmJcMtEE="; 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 --usphmJcMtEE= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: cron2, 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 (#24). 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/24 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); =20 - 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: 24 Gerrit-Owner: d12fk Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-Reviewer: stipa Gerrit-CC: cron2 Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: cron2 Gerrit-Attention: flichtenheld Gerrit-Attention: stipa Gerrit-MessageType: newpatchset --usphmJcMtEE= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

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

d12fk uploaded patch set #24 to this change.

View Change

dns: deal with --dhcp-options when --dns is active

Since --dns se= ttings overrule DNS related --dhcp-options,
remove the latter when value= s were defined via --dns.

To stay as backward compatible as possible= , we add foreign_options to
the script hook environment from the --dns v= alues when a --up script
is defined. In that case the default --dns-updo= wn 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-upd= own, or force running the default
dns-updown that comes with openvpn, th= ose compat env vars are not set
for --up scripts and the dns-updown comm= and is run, even when there's
an --up script present.

Since A= ndroid uses the DNS values from tuntap_options, we always
override those= with --dns stuff unconditionally. Also on Windows when
--ip-win32 is dy= namic or adaptive, since DHCP relies on these as well.

Change-Id: I6= 35c4018fb43b5976a39b6a90cb2e9cb2570cd6a
Signed-off-by: Heiko Hund <he= iko@...2662...>
---
M src/openvpn/dns.c
M src/openvpn/dns.h
= M src/openvpn/options.c
3 files changed, 323 insertions(+), 184 deletion= s(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes=
/04/904/24
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 +69= 1,8 @@
static void
run_up_down_command(bo= ol 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-&g= t;dns_options;
+ i= f (!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_option= s, tt);
+ stat= us =3D do_run_up_down_command(up, NULL, dns, tt);
}
else
{
@@ -852,6 +8= 53,14 @@
{
return;
= }
+#ifdef = _WIN32
+ /* Don= 9;t use iservice in DHCP mode */
+ struct tuntap_options *tto =3D &o->tuntap_options;<= /span>
+ if (tto->ip_w= in32_type =3D=3D IPW32_SET_DHCP_MASQ || tto->ip_win32_type =3D=3D IPW32_= SET_ADAPTIVE)
+ {<= /span>
+ 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_o= ptions {
+ in_addr= _t dns[N_DHCP_ADDR];
= + int dns_len;
+
+ struct in6_addr d= ns6[N_DHCP_ADDR];
+ = int dns6_len;
+
+ const char *domain;=
+ const char *dom= ain_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 d= ns_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/o= penvpn/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_pa= rse(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 DO= MAIN-SEARCH.
- * Existi= ng options will be discarded.
- */
-static voi= d
-tuntap_options_copy_= dns(struct options *o)
= -{
- struct tuntap_o= ptions *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 d= omain->name;
- = domain =3D domain->next;
- }
-= if (domain)
- = {
- ms= g(M_WARN, "WARNING: couldn't copy all --dns search-domains to --dh= cp-option");
- = }
- tt->d= hcp_options |=3D DHCP_OPTIONS_DHCP_REQUIRED;
- }
-
- if (dns-&g= t;servers)
- {
- tt->dns_len =3D = 0;
- tt->dns6= _len =3D 0;
- bo= ol overflow =3D false;
= - const struct dns_server *server =3D dns->servers;
- while (server)

- {

- for (int i =3D 0; i < server-&g= t;addr_count; ++i)
- = {
- = if (server->addr[i].family =3D=3D AF_INET)
- {
- if (tt->dns_len >=3D N_D= HCP_ADDR)
- = {
- = overflow =3D true;
- continue;
- }
- tt->dns[tt->dns_len++] =3D n= tohl(server->addr[i].in.a4.s_addr);
- }
- else
- {
- if (tt->dns6_len >=3D N_DHCP_ADDR)=
- {=
- over= flow =3D true;
- = continue;
- }
- tt->dns6[tt->dns6_len++] =3D server->addr= [i].in.a6;
- = }
- }
- server =3D = server->next;
- = }
- if (overf= low)
- {<= br>- msg(M_WARN, "= ;WARNING: couldn't copy all --dns server addresses to --dhcp-option&quo= t;);
- }<= br>- 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)
<= span style=3D"color: hsl(0, 100%, 40%);">-{

- const struct dns_domain *domain =3D o->dns_opt= ions.search_domains;
- = const struct dns_server *server =3D o->dns_options.servers;- if (!domain && !ser= ver)
- {
<= span style=3D"color: hsl(0, 100%, 40%);">- return;

- }
-
- = /* reset the index since we're starting all over again */
= - int opt_max =3D o->foreig= n_option_index;
- o-= >foreign_option_index =3D 0;
-
- for (in= t 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 c= har *value =3D strchr(env_str, '=3D') + 1;
- if ((domain && strstr(value, &= quot;dhcp-option DOMAIN-SEARCH") =3D=3D value)
- || (server && strstr(va= lue, "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)<= br>- {
- for (size_t i =3D 0; i < server-= >addr_count; ++i)
- = {
- i= f (server->addr[i].family =3D=3D AF_INET)
- {
- const char *argv[] =3D {
- "dhcp-option&quo= t;,
- = "DNS",
- = print_in_addr_t(server->addr[i].in.a4.s_addr, 0, &g= c)
- };<= /span>
- setenv= _foreign_option(o, argv, 3, es);
- }
- = {
- = const char *argv[] =3D {
- "dhcp-option",
- "DNS6",
- print_i= n6_addr(server->addr[i].in.a6, 0, &gc)
- };
- setenv_foreign_option(o, argv, 3, es);=
- }<= br>- }
- server =3D server->next;
- }
- while (domain)
- {
- const char *argv[] =3D { "dhcp-option", &quo= t;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_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
<= span> static const char *

print_vlan_accept(enum vlan_acce= ptable_frames mode)
@@ -3603,6 +3458,260 @@
}

}

+#if defined(_WIN32) || defined(TARGET_ANDROID)
+/**
+ * @brief Postprocess DNS related setti= ngs
+ *
+ * Set TUN/TAP DNS options with v= alues from either --dns

+ * or --dhcp-option.
+ *
+ * @param o = pointer to the options struct
+ */
+st= atic void
+tuntap_opt= ions_postprocess_dns(struct options *o)
+{
+ struct dns_options *dns =3D &o->dns_options;
+ struct tuntap_options *tt =3D &am= p;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_search_list));
+
+ tt= ->domain =3D dhcp->domain;
+ tt->dns_len =3D dhcp->dns_len;
+ tt->dns6_len =3D dhcp->= dns6_len;
++ memcpy(tt->dns, dh= cp->dns, sizeof(tt->dns));
+ memcpy(tt->dns6, dhcp->dns6, sizeof(tt->dns6)= );
+
+ tt->domain_search_list_le= n =3D dhcp->domain_search_list_len;
+ for (size_t i =3D 0; i < SIZE(tt->domain_s= earch_list); ++i)
+ = {
+ = tt->domain_search_list[i] =3D dhcp->domain_search_list[i];
= + }
+
+ return;
+ }
+
+#if defined(_WIN32)
+ if (tt->ip_win= 32_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_searc= h_list_len++] =3D d->name;
+ d =3D d->next;
+ }
+ if (d)
+ {
+ msg(M_WARN, &= quot;WARNING: couldn't copy all --dns search-domains to TUN/TAP");=
+ }
+

+ const struct dns_server *s =3D dns->servers;<= /span>
+ while (s)=
+ {
+ bool non_standard_server_port = =3D false;
+ f= or (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_TR= ANSPORT_PLAIN)
+ = || (s->dnssec && s->dnssec !=3D DNS_SECURITY_NO)
+ || non_standa= rd_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_le= n + 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 cop= y all --dns server addresses to TUN/TAP");
+ }
+ return;
+ }
+ }
+}<= /span>
+
+#else /* if defined(_WIN32) || defined(= TARGET_ANDROID) */
+<= /span>
+/**
+ * @brief Postprocess DNS related se= ttings
+ *
= + * Discard existing --dhcp-opt= ions from the env if needed and possibly
+ * replace them with values from --dns. If no --dns se= rvers are set copy
+ = * the --dhcp-option values over for --dns-updown runs.
+ *
+ * @param o pointer to the options struct
<= span style=3D"color: hsl(120, 100%, 40%);">+ * @param es env set to modi= fy 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 en= v 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_opti= on_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(&va= lue, "%s", item_val);
+
+ = /* Remove foreign option item from env set */
+ env_set_del(es, BSTR(&name))= ;
+
+ item_val =3D BSTR(&va= lue);
+ if= (strncmp(item_val, "dhcp-option ", 12) !=3D 0
+ || (strncmp(item_val += 12, "ADAPTER-DOMAIN-SUFFIX ", 22) !=3D 0
+ && strncmp(it= em_val + 12, "DOMAIN-SEARCH ", 14) !=3D 0
+ && strncmp(it= em_val + 12, "DOMAIN ", 7) !=3D 0
+ && strncmp(item_val + 1= 2, "DNS6 ", 5) !=3D 0
+ && strncmp(item_val + 12, "DNS= ", 4) !=3D 0))
= + {
+ = /* Re-set the item with potentially updated name */
+ buf_clear(&n= ame);

+ = buf_printf(&name, "foreign_option_%d", ++o->foreign_opti= on_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, st= ruct 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_CL= EAR_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_addr= s =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].i= n.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_l= en && server->addr_count < max_addrs; ++i)
+ {
+ server->addr[server->a= ddr_count].in.a6 =3D dhcp->dns6[i];
+ server->addr[server->addr_count].f= amily =3D AF_INET6;
+= server->addr_count +=3D 1;
+ }
+ }
+ }
+ = else if (o->up_script && !dns->user_set_updown)
+ {

+ /* Set foreign option env vars from --d= ns config */
+ = const char *p[] =3D { "dhcp-option", NULL, NULL };
+ size_t p_len =3D sizeof(p= ) / sizeof(p[0]);

+
+ p[1] =3D &quo= t;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-&= gt;transport !=3D DNS_TRANSPORT_PLAIN)
+ || (s->dnssec && s->dnssec= !=3D DNS_SECURITY_NO)
+ {
+ /* Skip servers requiring unsupported= config to be set */
= + s =3D s->next;
+ }
+ else
+ {
+= for (int i =3D 0; i < s->addr_count; ++i)
<= span style=3D"color: hsl(120, 100%, 40%);">+ {

+ if (s->add= r[i].family =3D=3D AF_INET)

+ {
+ p[1] =3D "DNS";
+ p[2] =3D pr= int_in_addr_t(s->addr[i].in.a4.s_addr, IA_NET_ORDER, &gc);
+ }<= br>+ else
+ {<= /span>
+ = 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);<= /span>
+ }
+ break;=
+ }
+ }
+ }

+
+ gc_free(&gc);
+}
+#endif /*= if defined(_WIN32) || defined(TARGET_ANDROID) */
+
static void
options_postprocess_mutate(struct options *o, struct env_set *es)
<= br> {
@@ -3786,9 +3895,9 @@
else=
{
#if defined(_WIN32) || defined(TAR= GET_ANDROID)
- t= untap_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_AN= DROID)
- tuntap_= options_copy_dns(o);
= + tuntap_options_postprocess_dns(o);
#else- foreign_options_copy_d= ns(o, es);
+ d= hcp_options_postprocess_dns(o, es);
#endif
}

return success;
@@ -8162,18 +8= 271,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;
<= span style=3D"color: hsl(120, 100%, 40%);">+#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])<= /span>
{
- o->domain =3D p[2];
- o->dhcp_options |=3D DHCP_OPTIONS_DHCP_OPT= IONAL;
+ d= hcp->domain =3D p[2];
}
+ else if (streq(p[1], "DOMAIN= -SEARCH") && p[2] && !p[3])
+ {
+ if (dhcp->domain_search_list_len < N_S= EARCH_LIST_LEN)
+ = {
+ = dhcp->domain_search_list[dhcp->domain_search_list_len++] =3D p[= 2];
+ }
+ else
+ {
<= span style=3D"color: hsl(120, 100%, 40%);">+ msg(msglevel, &= quot;--dhcp-option %s: maximum of %d search entries can be specified",=

+ = p[1], N_SEARCH_LIST_LEN);
+ }
= + }
+ e= lse if ((streq(p[1], "DNS") || streq(p[1], "DNS6")) &am= p;& p[2] && !p[3]
+ && (!strstr(p[2], ":") || ipv6= _addr_safe(p[2])))
+ = {
+ = if (strstr(p[2], ":"))
+ {
+ dhcp_option_dns6_parse(p[2], dhcp->dns6, &dh= cp->dns6_len, msglevel);
+ }
+ else
+ = {
+ = dhcp_option_address_parse("DNS", p[2], dhcp->dns, &am= p;dhcp->dns_len, msglevel);
+ }
+ }
+#if d= efined(_WIN32) || defined(TARGET_ANDROID)
else if = (streq(p[1], "NBS") && p[2] && !p[3])
<= span> {

o->netbios_scope =3D p[2];<= /span>
@@ -8191,23 +8325,9 @@
o->n= etbios_node_type =3D t;
o->dhcp_options |= =3D DHCP_OPTIONS_DHCP_REQUIRED;
}
- else if ((streq(p[1], "DN= S") || streq(p[1], "DNS6")) && p[2] && !p[3]=
- &= ;& (!strstr(p[2], ":") || ipv6_addr_safe(p[2])))
- {

- if (strstr(p[2], ":"))
- {- dhcp_option_dns= 6_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_OPTIO= NS_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])
{
<= span>@@ -8219,19 +8339,6 @@

dhcp_option_addres= s_parse("NBDD", p[2], o->nbdd, &o->nbdd_len, msglevel);=
o->dhcp_options |=3D DHCP_OPTIONS_DHCP_REQ= UIRED;
}
- else if (streq(p[1], "DOMAIN-SEARCH") &&a= mp; 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 ent= ries can be specified",
- p[1], N_SEARCH_LIST_LEN);
- }
- o->dhcp_options |=3D DHCP_OPTIONS_DH= CP_OPTIONAL;
- }=
else if (streq(p[1], "DISABLE-NBT") &am= p;& !p[2])
{
o-&g= t;disable_nbt =3D 1;
@@ -8249,8 +8356,10 @@
msg(msglevel, "--dhcp-option: unknown option type '%= s' or missing 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 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: 24
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: cron2 <gert@...1296...>= ;
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-Attention: stipa <lstipakov@...1663...= .>
Gerrit-MessageType: newpatchset
--usphmJcMtEE=--