From: "d12fk (Code Review)" Date: Thu, 6 Mar 2025 22:15:08 +0000 In-Reply-To: References: Reply-To: heiko@...515..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., gert@...1296... Message-ID: <81521732600c996c9b7a8fb83a6faf6f30b81d41-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="11wCf2lc7AU="; charset=UTF-8 Subject: [Openvpn-devel] [L] Change in openvpn[master]: dns: don't publish env vars to non-dns scripts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: cron2 , openvpn-devel --11wCf2lc7AU= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: d12fk, plaisthos. Hello flichtenheld, plaisthos, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/840?usp=3Demail to look at the new patch set (#11). Change subject: dns: don't publish env vars to non-dns scripts ...................................................................... dns: don't publish env vars to non-dns scripts With --dns-script in place we no longer need DNS related vars in the environment for other script hooks. Code for doing that is removed and the function to set --dns stuff made static, for internal use only. Change-Id: I3fb01ab76cf3df0874ba92e08f371d17607a8369 Signed-off-by: Heiko Hund --- M src/openvpn/dns.c M src/openvpn/dns.h M src/openvpn/options.c 3 files changed, 87 insertions(+), 258 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/40/840/11 diff --git a/src/openvpn/dns.c b/src/openvpn/dns.c index 5eb1b5e..6ddf5c2 100644 --- a/src/openvpn/dns.c +++ b/src/openvpn/dns.c @@ -350,93 +350,6 @@ } } -static void -setenv_dns_option(struct env_set *es, - const char *format, int i, int j, - const char *value) -{ - char name[64]; - bool name_ok =3D false; - - if (j < 0) - { - name_ok =3D snprintf(name, sizeof(name), format, i); - } - else - { - name_ok =3D snprintf(name, sizeof(name), format, i, j); - } - - if (!name_ok) - { - msg(M_WARN, "WARNING: dns option setenv name buffer overflow"); - } - - setenv_str(es, name, value); -} - -void -setenv_dns_options(const struct dns_options *o, struct env_set *es) -{ - struct gc_arena gc =3D gc_new(); - const struct dns_server *s; - const struct dns_domain *d; - int i, j; - - for (i =3D 1, d =3D o->search_domains; d !=3D NULL; i++, d =3D d->next) - { - setenv_dns_option(es, "dns_search_domain_%d", i, -1, d->name); - } - - for (i =3D 1, s =3D o->servers; s !=3D NULL; i++, s =3D s->next) - { - for (j =3D 0; j < s->addr_count; ++j) - { - if (s->addr[j].family =3D=3D AF_INET) - { - setenv_dns_option(es, "dns_server_%d_address_%d", i, j + 1, - print_in_addr_t(s->addr[j].in.a4.s_addr,= IA_NET_ORDER, &gc)); - } - else - { - setenv_dns_option(es, "dns_server_%d_address_%d", i, j + 1, - print_in6_addr(s->addr[j].in.a6, 0, &gc)= ); - } - if (s->addr[j].port) - { - setenv_dns_option(es, "dns_server_%d_port_%d", i, j + 1, - print_in_port_t(s->addr[j].port, &gc)); - } - } - - if (s->domains) - { - for (j =3D 1, d =3D s->domains; d !=3D NULL; j++, d =3D d->nex= t) - { - setenv_dns_option(es, "dns_server_%d_resolve_domain_%d", i= , j, d->name); - } - } - - if (s->dnssec) - { - setenv_dns_option(es, "dns_server_%d_dnssec", i, -1, - dnssec_value(s->dnssec)); - } - - if (s->transport) - { - setenv_dns_option(es, "dns_server_%d_transport", i, -1, - transport_value(s->transport)); - } - if (s->sni) - { - setenv_dns_option(es, "dns_server_%d_sni", i, -1, s->sni); - } - } - - gc_free(&gc); -} - #ifdef _WIN32 static void @@ -554,6 +467,93 @@ #else /* ifdef _WIN32 */ static void +setenv_dns_option(struct env_set *es, + const char *format, int i, int j, + const char *value) +{ + char name[64]; + bool name_ok =3D false; + + if (j < 0) + { + name_ok =3D snprintf(name, sizeof(name), format, i); + } + else + { + name_ok =3D snprintf(name, sizeof(name), format, i, j); + } + + if (!name_ok) + { + msg(M_WARN, "WARNING: dns option setenv name buffer overflow"); + } + + setenv_str(es, name, value); +} + +static void +setenv_dns_options(const struct dns_options *o, struct env_set *es) +{ + struct gc_arena gc =3D gc_new(); + const struct dns_server *s; + const struct dns_domain *d; + int i, j; + + for (i =3D 1, d =3D o->search_domains; d !=3D NULL; i++, d =3D d->next) + { + setenv_dns_option(es, "dns_search_domain_%d", i, -1, d->name); + } + + for (i =3D 1, s =3D o->servers; s !=3D NULL; i++, s =3D s->next) + { + for (j =3D 0; j < s->addr_count; ++j) + { + if (s->addr[j].family =3D=3D AF_INET) + { + setenv_dns_option(es, "dns_server_%d_address_%d", i, j + 1, + print_in_addr_t(s->addr[j].in.a4.s_addr,= IA_NET_ORDER, &gc)); + } + else + { + setenv_dns_option(es, "dns_server_%d_address_%d", i, j + 1, + print_in6_addr(s->addr[j].in.a6, 0, &gc)= ); + } + if (s->addr[j].port) + { + setenv_dns_option(es, "dns_server_%d_port_%d", i, j + 1, + print_in_port_t(s->addr[j].port, &gc)); + } + } + + if (s->domains) + { + for (j =3D 1, d =3D s->domains; d !=3D NULL; j++, d =3D d->nex= t) + { + setenv_dns_option(es, "dns_server_%d_resolve_domain_%d", i= , j, d->name); + } + } + + if (s->dnssec) + { + setenv_dns_option(es, "dns_server_%d_dnssec", i, -1, + dnssec_value(s->dnssec)); + } + + if (s->transport) + { + setenv_dns_option(es, "dns_server_%d_transport", i, -1, + transport_value(s->transport)); + } + if (s->sni) + { + setenv_dns_option(es, "dns_server_%d_sni", i, -1, s->sni); + } + } + + gc_free(&gc); +} + +static void script_env_set(bool up, const struct dns_options *o, const struct tuntap *= tt, struct env_set *es) { setenv_str(es, "dev", tt->actual_name); diff --git a/src/openvpn/dns.h b/src/openvpn/dns.h index fe00403..0696efd 100644 --- a/src/openvpn/dns.h +++ b/src/openvpn/dns.h @@ -168,14 +168,6 @@ struct dns_script_runner_info *dsri); /** - * Puts the DNS options into an environment set. - * - * @param o Pointer to the DNS options to set - * @param es Pointer to the env_set to set the options into - */ -void setenv_dns_options(const struct dns_options *o, struct env_set *es); - -/** * Prints configured DNS options. * * @param o Pointer to the DNS options to print diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 48fefb2..d7f6b16 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -1057,11 +1057,6 @@ setenv_local_entry(es, o->ce.local_list->array[i], i+1); } } - - if (!o->pull) - { - setenv_dns_options(&o->dns_options, es); - } } #ifndef _WIN32 @@ -1375,149 +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 @@ -3930,14 +3782,6 @@ { dns_options_preprocess_pull(&o->dns_options); } - else - { -#if defined(_WIN32) || defined(TARGET_ANDROID) - tuntap_options_copy_dns(o); -#else - foreign_options_copy_dns(o, es); -#endif - } if (o->auth_token_generate && !o->auth_token_renewal) { o->auth_token_renewal =3D o->renegotiate_seconds; @@ -4308,7 +4152,6 @@ /* * Sanity check on options after more options were pulled from server. - * Also time to modify some options based on other options. */ bool options_postprocess_pull(struct options *o, struct env_set *es) @@ -4317,12 +4160,6 @@ if (success) { dns_options_postprocess_pull(&o->dns_options); - setenv_dns_options(&o->dns_options, es); -#if defined(_WIN32) || defined(TARGET_ANDROID) - tuntap_options_copy_dns(o); -#else - foreign_options_copy_dns(o, es); -#endif } return success; } -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/840?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: I3fb01ab76cf3df0874ba92e08f371d17607a8369 Gerrit-Change-Number: 840 Gerrit-PatchSet: 11 Gerrit-Owner: d12fk Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: cron2 Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: d12fk Gerrit-MessageType: newpatchset --11wCf2lc7AU= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: d12fk, plaisthos.

d12fk uploaded patch set #11 to this change.

View Change

dns: don't publish env vars to non-dns scripts

With --dns-scr= ipt in place we no longer need DNS related vars in the
environment for o= ther script hooks. Code for doing that is removed and
the function to se= t --dns stuff made static, for internal use only.

Change-Id: I3fb01a= b76cf3df0874ba92e08f371d17607a8369
Signed-off-by: Heiko Hund <heiko@...220...= ..2662...>
---
M src/openvpn/dns.c
M src/openvpn/dns.h
M src= /openvpn/options.c
3 files changed, 87 insertions(+), 258 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/40/84=
0/11
diff --git a/src/openvpn/dns.c b/src/openvpn/dns.c
<= span>index 5eb1b5e..6ddf5c2 100644
--- a/src/openvpn/dns.c<= /span>
+++ b/src/openvpn/dns.c
@@ -350,93 +350,6 @= @
}
}

-static void

-setenv_dns_option(struct env_set *es,
- const cha= r *format, int i, int j,
-{
- = char name[64];
- b= ool name_ok =3D false;
= -
- if (j < 0)
- {
- name_ok =3D snprintf(name, sizeo= f(name), format, i);
- = }
- else- {
- name_ok =3D snprintf(name, sizeof(name= ), format, i, j);
- = }
-
- if (!name_ok)
- {
- msg(M_WARN, "WARNING: dns option setenv name b= uffer overflow");
= - }
-
- setenv_str(es, name, value);
-}
-
-void
-setenv= _dns_options(const struct dns_options *o, struct env_set *es)
-{

- struct gc_arena gc =3D gc_new();
- const struct dns_server *s;- const struct dns_domain *d= ;
- int i, j;=
-
- for (i =3D 1, d =3D o->search_domains; d != =3D NULL; i++, d =3D d->next)
- {
- = setenv_dns_option(es, "dns_search_domain_%d", i, -1, d->nam= e);
- }
-

- for (i =3D 1, s =3D o->servers; s !=3D NULL; i++= , s =3D s->next)
- = {
- for (j =3D= 0; j < s->addr_count; ++j)
- {
-= if (s->addr[j].family =3D=3D AF_INET)
- {
- setenv_dns_option(es, "dns_ser= ver_%d_address_%d", i, j + 1,
- print_in_addr_t(s->addr[j= ].in.a4.s_addr, IA_NET_ORDER, &gc));
- }
- else
- {
- = setenv_dns_option(es, "dns_server_%d_address_%d", i= , j + 1,
- = print_in6_addr(s->addr[j].in.a6, 0, &gc));
- }
- if (s->addr[j].port= )

- {=
- setenv_dns_o= ption(es, "dns_server_%d_port_%d", i, j + 1,
- print_in= _port_t(s->addr[j].port, &gc));
- }
- }
-
- if (s->domain= s)
- {- for (j =3D 1, d =3D= s->domains; d !=3D NULL; j++, d =3D d->next)
- {
- setenv_dns_option(es, "dns_ser= ver_%d_resolve_domain_%d", i, j, d->name);
- }
- }
-
- if (= s->dnssec)
- = {
- setenv_d= ns_option(es, "dns_server_%d_dnssec", i, -1,
- dnssec_value= (s->dnssec));
- = }
-
- if (s->transport)- {
- setenv_dns_option(es, "dns= _server_%d_transport", i, -1,
- transport_value(s->transport)= );
- }- if (s->sni)- {
- setenv_dns_option(es, "dn= s_server_%d_sni", i, -1, s->sni);
- }
- }
-<= br>- gc_free(&gc);<= br>-}
-
#ifdef _WIN32
=
static void
@@ -554,6 +467,93 @@ #else /* ifdef _WIN32 */

static= void
+setenv_dns_opt= ion(struct env_set *es,
+ const char *format, int i, int j,
+ const char *value)
+{
+ char name[64];
+ bool name_ok =3D false;
+

+ if (j < 0)
+ {
+ name_ok =3D snprintf(name, sizeof(name), format, i);<= br>+ }
+ else
+ {
+ name_ok =3D snprintf(name, sizeof(name), format, i, j);
+ }
+
+ if (!name_ok)
+ {
+ msg(M_WARN, "WARNING: dns option setenv name buffer overfl= ow");
+ }
+
+ setenv_str(es, name, value);+}
+
+static void
+setenv_dns_options(const struct dns_options *o, struct env_set *es)
+{
+ struct gc_arena gc =3D gc_new();
+ const struct dns_ser= ver *s;
+ const st= ruct dns_domain *d;
+= int i, j;
+
+ for (i =3D 1, d =3D o= ->search_domains; d !=3D NULL; i++, d =3D d->next)
+ {
+ setenv_dns_option(es, "dns_search_domai= n_%d", i, -1, d->name);
+ }
+
+ for (i =3D 1, s = =3D o->servers; s !=3D NULL; i++, s =3D s->next)
+ {
+ for (j =3D 0; j < s->addr_count; ++j)
+ {
+ if (s->addr[j].fa= mily =3D=3D AF_INET)

= + {
+ = setenv_dns_option(es, "dns_server_%d_address_%d", i, j= + 1,
+ = print_in_addr_t(s->addr[j].in.a4.s_addr, IA_NET_ORDE= R, &gc));
+ = }
+ = else
+ {
+ seten= v_dns_option(es, "dns_server_%d_address_%d", i, j + 1,
= + = print_in6_addr(s->addr[j].in.a6, 0, &gc));
+ }
+ if (s->addr[j].port)
<= span style=3D"color: hsl(120, 100%, 40%);">+ {

+ setenv_dns_option(es,= "dns_server_%d_port_%d", i, j + 1,
+ print_in_port_t= (s->addr[j].port, &gc));
+ }
+ }
+
+ if (s->domai= ns)
+ {=
+ for (j =3D 1, = d =3D s->domains; d !=3D NULL; j++, d =3D d->next)
+ {
+ setenv_dns_option(es, "= dns_server_%d_resolve_domain_%d", i, j, d->name);
+ }
+ }
+
+ if (s->dnssec)
+ {
= + setenv_dns_option(es, "dns_server_%d_dnssec", i, -1,=
+ = dnssec_value(s->dnssec));
+ }
+
+ i= f (s->transport)
+= {
+ = setenv_dns_option(es, "dns_server_%d_transport", i, -1,<= br>+ = transport_value(s->transport));
+ }
+ if (s->sni)
+ {
= + setenv_dns_option(es, "dns_server_%d_sni", i, -1, s-= >sni);
+ }<= /span>
+ }
+

+ gc_free(&gc);
+}
+
+static void
script_env_set(bool up, const struct dns_options *o, const = struct tuntap *tt, struct env_set *es)
{
= setenv_str(es, "dev", tt->actual_name);
di= ff --git a/src/openvpn/dns.h b/src/openvpn/dns.h
index fe00= 403..0696efd 100644
--- a/src/openvpn/dns.h
+++ b/src/openvpn/dns.h

@@ -168,14 +168,6 @@
struct dns_script_runner_info *dsri);


/**
- * Puts the DNS options into an environment set.
- *
- * @param o Pointer to the DNS options to set
- * @param es Po= inter to the env_set to set the options into
- */
-void setenv_dns_options(const struct dns_options *o, struct env_set *e= s);
-
-/**
* Prints configur= ed DNS options.
*
* @param o = Pointer to the DNS options to print
diff --git a/src/open= vpn/options.c b/src/openvpn/options.c
index 48fefb2..d7f6b1= 6 100644
--- a/src/openvpn/options.c
+++ b/= src/openvpn/options.c
@@ -1057,11 +1057,6 @@
setenv_local_entry(es, o->ce.local_list->array[i], i+1= );

}
}
-
- if (!o->pull)
- {
- = setenv_dns_options(&o->dns_options, es);
- }
}

#ifndef _WIN32
@@ -1375,149 +1370,6 @@<= br> }
}
}
-

-/*
-= * If DNS options are set use these for TUN/TAP options as well.
= - * Applies to DNS, DNS6 and DOMA= IN-SEARCH.
- * Existing= options will be discarded.
- */
-static void<= /span>
-tuntap_options_copy_dn= s(struct options *o)
-{=
- struct tuntap_opt= ions *tt =3D &o->tuntap_options;
- struct dns_options *dns =3D &o->dns_options;
-
- if (dns->search_domains)
<= span style=3D"color: hsl(0, 100%, 40%);">- {

- tt->domain_search_list_len =3D 0;
- const struct dns_d= omain *domain =3D dns->search_domains;
- while (domain && tt->domain_search_l= ist_len < N_SEARCH_LIST_LEN)
- {
- = tt->domain_search_list[tt->domain_search_list_len++] =3D do= main->name;
- = domain =3D domain->next;
- }
- = if (domain)
- = {
- msg= (M_WARN, "WARNING: couldn't copy all --dns search-domains to --dhc= p-option");
- = }
- tt->dh= cp_options |=3D DHCP_OPTIONS_DHCP_REQUIRED;
- }
-
- if (dns->= ;servers)
- {=
- tt->dns_len =3D 0= ;
- tt->dns6_= len =3D 0;
- boo= l 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_DH= CP_ADDR)
- = {
- = overflow =3D true;
- continue;
- }
- tt->dns[tt->dns_len++] =3D nt= ohl(server->addr[i].in.a4.s_addr);
- }
- else
- {
- if (tt->dns6_len >=3D N_DHCP_ADDR)<= br>- {<= br>- overf= low =3D true;
- = continue;
- }
- tt->dns6[tt->dns6_len++] =3D server->addr[= i].in.a6;
- = }
- }
- server =3D s= erver->next;
- = }
- if (overfl= ow)
- {- 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)
<= 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_A= NDROID) */

#ifndef ENABLE_SMALL@@ -3930,14 +3782,6 @@
{
= dns_options_preprocess_pull(&o->dns_options);
= }
- else- {
-#if defined(_WIN32) || defined(TARGET_ANDROID)=
- tuntap_option= s_copy_dns(o);
-#else
- foreign_options= _copy_dns(o, es);
-#end= if
- }
if (o->auth_token_generate && !o->auth_token_renewal)=

{
o->auth_token_renewal = =3D o->renegotiate_seconds;
@@ -4308,7 +4152,6 @@=

/*
* Sanity check on options= after more options were pulled from server.
- * Also time to modify some options based on other o= ptions.
*/
bool
options= _postprocess_pull(struct options *o, struct env_set *es)
@@= -4317,12 +4160,6 @@
if (success)
= {
dns_options_postprocess_pull(&o->dns_opt= ions);
- setenv_= dns_options(&o->dns_options, es);
-#if defined(_WIN32) || defined(TARGET_ANDROID)- tuntap_options_copy_dns= (o);
-#else
<= span style=3D"color: hsl(0, 100%, 40%);">- foreign_options_copy_dns(= o, es);

-#endif<= br> }
return success;
}

To view, visit change 840. To unsubscribe, or f= or help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3fb01ab76cf3df0874ba92e08f3= 71d17607a8369
Gerrit-Change-Number: 840
Gerrit-PatchSet: 11
Gerrit-Owner: d12fk <heiko@...515...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: cron2 <gert@...1296...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: d12fk <heiko@...515...>= ;
Gerrit-MessageType: newpatchset
--11wCf2lc7AU=--