Skip to content

Commit 7e6723a

Browse files
ralflicicron2
authored andcommitted
Fix check_addr_clash argument order
In init_tun() make sure to pass the --local and --remote addresses in the host order so that they can be compared to the --ifconfig addresses. Change-Id: I5adbe0a79f078221c4bb5f3d39391a81b4d8adce Signed-off-by: Ralf Lici <[email protected]> Acked-by: Frank Lichtenheld <[email protected]> Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg29261.html Signed-off-by: Gert Doering <[email protected]> (cherry picked from commit 7d345b1)
1 parent f9ab7ed commit 7e6723a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/openvpn/tun.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -879,9 +879,10 @@ init_tun(const char *dev, /* --dev option */
879879
{
880880
if (curele->ai_family == AF_INET)
881881
{
882+
const in_addr_t local = ntohl(((struct sockaddr_in *)curele->ai_addr)->sin_addr.s_addr);
882883
check_addr_clash("local",
883884
tt->type,
884-
((struct sockaddr_in *)curele->ai_addr)->sin_addr.s_addr,
885+
local,
885886
tt->local,
886887
tt->remote_netmask);
887888
}
@@ -891,9 +892,10 @@ init_tun(const char *dev, /* --dev option */
891892
{
892893
if (curele->ai_family == AF_INET)
893894
{
895+
const in_addr_t remote = ntohl(((struct sockaddr_in *)curele->ai_addr)->sin_addr.s_addr);
894896
check_addr_clash("remote",
895897
tt->type,
896-
((struct sockaddr_in *)curele->ai_addr)->sin_addr.s_addr,
898+
remote,
897899
tt->local,
898900
tt->remote_netmask);
899901
}

0 commit comments

Comments
 (0)