Skip to content

Commit

Permalink
repair DNS address option
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Gert Doering <[email protected]>
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg30195.html
Signed-off-by: Gert Doering <[email protected]>
  • Loading branch information
lstipakov authored and cron2 committed Dec 24, 2024
1 parent f0c26b0 commit 82fd89a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/openvpn/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit 82fd89a

Please sign in to comment.