From: "stipa (Code Review)" Date: Tue, 24 Dec 2024 16:06:27 +0000 References: Reply-To: lstipakov@...277..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="/pLJ22qOGvk="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: repair DNS address option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --/pLJ22qOGvk= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/845?usp=3Demail to review the following change. Change subject: repair DNS address option ...................................................................... repair DNS address option Commit 6f2d222 ("dns: store IPv4 addresses in network byte order") changed the internal representation of IPv4 address within DNS settings to network byte order, however later this value is copied into tuntap_options, where IPv4 addresses are assumed to be in host byte order (see lots of occurences of "htonl(tt->" in tun.c). As a consequence, DNS server address is set incorrectly, like 4.4.8.8 instead of 8.8.4.4 Fix by converting address to host byte order when copying from DNS options to tuntap_options. Change-Id: I87e4593e6a548bacd40b840cd241950019fa457d Signed-off-by: Lev Stipakov --- M src/openvpn/options.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/45/845/1 diff --git a/src/openvpn/options.c b/src/openvpn/options.c index b2a3a8b..20e8d55 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -1390,7 +1390,7 @@ overflow =3D true; continue; } - tt->dns[tt->dns_len++] =3D server->addr[i].in.a4.s_add= r; + tt->dns[tt->dns_len++] =3D ntohl(server->addr[i].in.a4= .s_addr); } else { -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/845?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: I87e4593e6a548bacd40b840cd241950019fa457d Gerrit-Change-Number: 845 Gerrit-PatchSet: 1 Gerrit-Owner: stipa Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --/pLJ22qOGvk= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

stipa would like plaisthos and flichtenheld to review t= his change.

Vi= ew Change

repair DNS address option

Commit

6f2d222 (&qu= ot;dns: store IPv4 addresses in network byte order")

changed th= e internal representation of IPv4 address within DNS
settings to network= byte order, however later this value is copied into
tuntap_options, whe= re IPv4 addresses are assumed to be in host byte
order (see lots of occu= rences of "htonl(tt->" in tun.c). As a
consequence, DNS ser= ver address is set incorrectly, like 4.4.8.8 instead
of 8.8.4.4

F= ix by converting address to host byte order when copying from DNS
option= s to tuntap_options.

Change-Id: I87e4593e6a548bacd40b840cd241950019f= a457d
Signed-off-by: Lev Stipakov <lev@...515...>
---
M src/= openvpn/options.c
1 file changed, 1 insertion(+), 1 deletion(-)

<= /pre>
<=
span>diff --git a/src/openvpn/options.c b/src/openvpn/options.c
<= span>index b2a3a8b..20e8d55 100644
--- a/src/openvpn/option= s.c
+++ b/src/openvpn/options.c
@@ -1390,7 = +1390,7 @@
overflow =3D true;
continue;
= }
- = tt->dns[tt->dns_len++] =3D server->addr[i].in.a4.s_addr;<= /span>
+ = tt->dns[tt->dns_len++] =3D ntohl(server->addr[i].in.a4.s_addr);
}
else
{

To view,= visit ch= ange 845. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I87e4593e6a548bacd40b840cd24= 1950019fa457d
Gerrit-Change-Number: 845
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <lstipakov@...277...>= ;
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--/pLJ22qOGvk=--