Squashed 'OpenVPN Adapter/Vendors/openvpn/' changes from e6d68831a..35bbca799

35bbca799 Merged in OVPN3-184-generate-warning (pull request #1)
a73d2ce68 Merged in antonio/OVPN3-169-pure-ssl-transport (pull request #3)
8d7f5f3c1 Merged in feature/docker (pull request #2)
d9b5055cd [OVPN3-169] cli.cpp: compile with -DOPENVPN_TLS_LINK when requested
2d99bbfea [OVPN3-169] cliopt.hpp: add support for TLS transport module
62c8461d2 [OVPN3-169] tcpcli.hpp: add runtime support for TLSLink
e0e76bb28 [OVPN3-169] tcplink: introduce LinkBase abstract class
a71014d40 [OVPN3-169] tcplink: create LinkCommon class and inherit from it
cfd6df5bc build system: fix 'git apply'
3e49de7de [OVPN3-210] ovpncli: handle "allow-name-constraints" for OpenSSL
08d72bd76 [OVPN3-184] mbedtls: handle Name Constraints
40c70113d [OVPN3-184] Add mbedTLS patch
ef8d11f34 [OVPN3-169] OpenSSL: implement write_ciphertext_unbuffered() function
37dc86378 [OVPN3-169] mbedTLS: implement write_ciphertext_unbuffered() function
5834ed401 [OVPN3-169] SSLAPI: add write_ciphertext_unbuffered() function
071050b5f vars-linux-dbg: update linux debug profile
5bbfe68c3 [OVPN3-169] Protocol: add support for TLS transport protocol type
dc12d3189 [OVPN3-223] build: add docker images

git-subtree-dir: OpenVPN Adapter/Vendors/openvpn
git-subtree-split: 35bbca799dfa3fbe8e17f8d6e94c3946c397b593
This commit is contained in:
Sergey Abramchuk
2018-05-03 11:46:13 +03:00
parent 84ad2a289f
commit 56284506fc
26 changed files with 1162 additions and 412 deletions
+30 -3
View File
@@ -41,11 +41,14 @@ namespace openvpn {
TCPv4,
UDPv6,
TCPv6,
TLSv4, // TLS over IPv4
TLSv6, // TLS over IPv6
UnixStream, // unix domain socket (stream)
UnixDGram, // unix domain socket (datagram)
NamedPipe, // named pipe (Windows only)
UDP=UDPv4,
TCP=TCPv4,
TLS=TLSv4,
};
enum AllowSuffix {
@@ -64,8 +67,9 @@ namespace openvpn {
bool is_udp() const { return type_ == UDPv4 || type_ == UDPv6; }
bool is_tcp() const { return type_ == TCPv4 || type_ == TCPv6; }
bool is_reliable() const { return is_tcp(); }
bool is_ipv6() const { return type_ == UDPv6 || type_ == TCPv6; }
bool is_tls() const { return type_ == TLSv4 || type_ == TLSv6; }
bool is_reliable() const { return is_tcp() || is_tls(); }
bool is_ipv6() const { return type_ == UDPv6 || type_ == TCPv6 || type_ == TLSv6; }
bool is_unix() const { return type_ == UnixStream || type_ == UnixDGram; }
bool is_named_pipe() const { return type_ == NamedPipe; }
bool is_local() const { return is_unix() || is_named_pipe(); }
@@ -87,7 +91,7 @@ namespace openvpn {
unsigned int extra_transport_bytes() const
{
return is_tcp() ? sizeof(std::uint16_t) : 0;
return (is_tcp() || is_tls()) ? sizeof(std::uint16_t) : 0;
}
void mod_addr_version(const IP::Addr& addr)
@@ -101,12 +105,16 @@ namespace openvpn {
type_ = UDPv4;
else if (is_tcp())
type_ = TCPv4;
else if (is_tls())
type_ = TLSv4;
break;
case IP::Addr::V6:
if (is_udp())
type_ = UDPv6;
else if (is_tcp())
type_ = TCPv6;
else if (is_tls())
type_ = TLSv6;
break;
}
}
@@ -157,6 +165,9 @@ namespace openvpn {
return 3;
case NamedPipe:
return 4;
case TLSv4:
case TLSv6:
return 5;
default:
return -1;
}
@@ -174,6 +185,10 @@ namespace openvpn {
return "UDPv6";
case TCPv6:
return "TCPv6";
case TLSv4:
return "TLSv4";
case TLSv6:
return "TLSv6";
case UnixStream:
return "UnixStream";
case UnixDGram:
@@ -199,6 +214,10 @@ namespace openvpn {
return "udp6";
case TCPv6:
return "tcp6";
case TLSv4:
return "tls4";
case TLSv6:
return "tls6";
case UnixStream:
return "unix-stream";
case UnixDGram:
@@ -224,6 +243,10 @@ namespace openvpn {
return force_ipv4 ? "UDPv4" : "UDPv6";
case TCPv6:
return force_ipv4 ? "TCPv4_CLIENT" : "TCPv6_CLIENT";
case TLSv4:
return "TLSv4";
case TLSv6:
return force_ipv4 ? "TLSv4" : "TLSv6";
default:
return "UNDEF_PROTO";
}
@@ -268,6 +291,8 @@ namespace openvpn {
ret = UDPv4;
else if (s1 == "tcp")
ret = TCPv4;
else if (s1 == "tls")
ret = TLSv4;
}
else if (s2 == "6" || s2 == "v6")
{
@@ -275,6 +300,8 @@ namespace openvpn {
ret = UDPv6;
else if (s1 == "tcp")
ret = TCPv6;
else if (s1 == "tls")
ret = TLSv6;
}
}
return ret;