diff options
author | Alberto Gonzalez Iniesta <agi@inittab.org> | 2013-01-10 17:54:01 +0100 |
---|---|---|
committer | Alberto Gonzalez Iniesta <agi@inittab.org> | 2013-01-10 17:54:01 +0100 |
commit | 9e3cceecfca10ef806f193ec41e0e0a44706c328 (patch) | |
tree | 7198ea4f45a8a88c0828acd4eb4afe817dbe23a7 /src/openvpn/socket.c | |
parent | 9abc160bcbe71cfa43952943c6dff41e8016c32f (diff) |
Imported Upstream version 2.3.0upstream/2.3.0
Diffstat (limited to 'src/openvpn/socket.c')
-rw-r--r-- | src/openvpn/socket.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 505cf3b..8eb112b 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -158,7 +158,7 @@ openvpn_getaddrinfo (unsigned int flags, CLEAR(hints); hints.ai_family = ai_family; hints.ai_flags = AI_NUMERICHOST; - hints.ai_socktype = dnsflags_to_socktype(flags); + hints.ai_socktype = SOCK_STREAM; status = getaddrinfo(hostname, NULL, &hints, res); @@ -2560,6 +2560,10 @@ addr_family_name (int af) * * This is used for options compatibility * checking. + * + * IPv6 and IPv4 protocols are comptabile but OpenVPN + * has always sent UDPv4, TCPv4 over the wire. Keep these + * strings for backward compatbility */ int proto_remote (int proto, bool remote) @@ -2569,10 +2573,20 @@ proto_remote (int proto, bool remote) { switch (proto) { - case PROTO_TCPv4_SERVER: return PROTO_TCPv4_CLIENT; - case PROTO_TCPv4_CLIENT: return PROTO_TCPv4_SERVER; - case PROTO_TCPv6_SERVER: return PROTO_TCPv6_CLIENT; - case PROTO_TCPv6_CLIENT: return PROTO_TCPv6_SERVER; + case PROTO_TCPv4_SERVER: return PROTO_TCPv4_CLIENT; + case PROTO_TCPv4_CLIENT: return PROTO_TCPv4_SERVER; + case PROTO_TCPv6_SERVER: return PROTO_TCPv4_CLIENT; + case PROTO_TCPv6_CLIENT: return PROTO_TCPv4_SERVER; + case PROTO_UDPv6: return PROTO_UDPv4; + } + } + else + { + switch (proto) + { + case PROTO_TCPv6_SERVER: return PROTO_TCPv4_SERVER; + case PROTO_TCPv6_CLIENT: return PROTO_TCPv4_CLIENT; + case PROTO_UDPv6: return PROTO_UDPv4; } } return proto; |