]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
repair DNS address option
authorLev Stipakov <lev@openvpn.net>
Tue, 24 Dec 2024 17:42:33 +0000 (18:42 +0100)
committerGert Doering <gert@greenie.muc.de>
Tue, 24 Dec 2024 22:23:05 +0000 (23:23 +0100)
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 <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20241224174233.13005-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30195.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/options.c

index b2a3a8beebf67812bd909a4c0c00161c16c9b10a..20e8d55342348725c77049424d3894f1ce22b981 100644 (file)
@@ -1390,7 +1390,7 @@ tuntap_options_copy_dns(struct options *o)
                         overflow = true;
                         continue;
                     }
-                    tt->dns[tt->dns_len++] = server->addr[i].in.a4.s_addr;
+                    tt->dns[tt->dns_len++] = ntohl(server->addr[i].in.a4.s_addr);
                 }
                 else
                 {