diff options
author | Arne Schwabe <arne@rfc2549.org> | 2013-11-25 13:31:15 +0100 |
---|---|---|
committer | Gert Doering <gert@greenie.muc.de> | 2013-11-27 20:18:36 +0100 |
commit | 6c5db192c30ff0c6b89e2e0aefec00329de39302 (patch) | |
tree | 9b364925444a5403c3652d7b4d2e33c9c42a0781 /src/openvpn/tun.c | |
parent | bb9026a60a8ebdf20fdf9a99e16c0d8afc658747 (diff) | |
download | openvpn-6c5db192c30ff0c6b89e2e0aefec00329de39302.tar.gz openvpn-6c5db192c30ff0c6b89e2e0aefec00329de39302.tar.xz openvpn-6c5db192c30ff0c6b89e2e0aefec00329de39302.zip |
change the type of 'remote' to addrinfo*, and rename to 'remote_list'.
Warning: this is work in progress, preparing for the full dual-stack
client patch. With this commit in place, connecting via "--proto udp" or
"--proto tcp-client" to a host that has IPv4+IPv6 in place, on an OS that
will prefer IPv6 to IPv4 will always fail. The remote_list will have IPv6
in it's first entry, while the socket will try to do AF_INET, and that
will not work. This will be fixed by the upcoming change to handle
multiple remote IP addresses (as returned by getaddrinfo()) as multiple
<connection> blocks, with appropriate retry and AF selection logic.
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1385382680-5912-4-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8053
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'src/openvpn/tun.c')
-rw-r--r-- | src/openvpn/tun.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 9f53b23..0f30e2f 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -412,7 +412,7 @@ init_tun (const char *dev, /* --dev option */ int ifconfig_ipv6_netbits_parm, const char *ifconfig_ipv6_remote_parm, /* --ifconfig parm 2 IPv6 */ in_addr_t local_public, - in_addr_t remote_public, + struct addrinfo *remote_public, const bool strict_warn, struct env_set *es) { @@ -466,6 +466,7 @@ init_tun (const char *dev, /* --dev option */ */ if (strict_warn) { + struct addrinfo *curele; ifconfig_sanity_check (tt->type == DEV_TYPE_TUN, tt->remote_netmask, tt->topology); /* @@ -479,11 +480,14 @@ init_tun (const char *dev, /* --dev option */ tt->local, tt->remote_netmask); - check_addr_clash ("remote", - tt->type, - remote_public, - tt->local, - tt->remote_netmask); + for (curele=remote_public;curele;curele=curele->ai_next) { + if (curele->ai_family == AF_INET) + check_addr_clash ("remote", + tt->type, + ((struct sockaddr_in*)curele->ai_addr)->sin_addr.s_addr, + tt->local, + tt->remote_netmask); + } if (tt->type == DEV_TYPE_TAP || (tt->type == DEV_TYPE_TUN && tt->topology == TOP_SUBNET)) check_subnet_conflict (tt->local, tt->remote_netmask, "TUN/TAP adapter"); |