0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 20:13:05 +02:00
Commit Graph

2241 Commits

Author SHA1 Message Date
James Yonan
95ce4f22c8 string: added to_delim() method then redefined first_line() method to use it
Signed-off-by: James Yonan <james@openvpn.net>
2019-09-06 22:24:56 -06:00
James Yonan
448218b1e1 string: added add_leading() method
Signed-off-by: James Yonan <james@openvpn.net>
2019-09-06 22:24:56 -06:00
James Yonan
e3b0bf4f5c MSF iterator: allow conversion from ordinary iterator and added exists() method
Also added better comments for MSF::find().

Signed-off-by: James Yonan <james@openvpn.net>
2019-09-06 22:24:56 -06:00
James Yonan
11412ac50a AsioPolySock: in remote_endpoint_str() method, test for alt_routing_enabled()
Signed-off-by: James Yonan <james@openvpn.net>
2019-09-06 22:24:56 -06:00
James Yonan
9fb4e705f9 Added TimeSkew to skew a time duration by a random flux
Signed-off-by: James Yonan <james@openvpn.net>
2019-09-06 22:24:56 -06:00
James Yonan
7496383002 write_binary_atomic: reduce the length of the temporary filename
Linux has a filename maximum of 255 chars, but we need to
be careful about the composition of the temporary filename
so that we don't exceed this limitation on the temporary,
even when the original is within the limit.

Signed-off-by: James Yonan <james@openvpn.net>
2019-09-06 22:24:56 -06:00
James Yonan
b31d9c0191 auth-token-user: increase size limit to 340 chars
Since the auth-token-user directive (that is pushed from
server to client) is base64-encoded, increase the size
to support a pre-base64-encoded username length
of 256 characters.

Signed-off-by: James Yonan <james@openvpn.net>
2019-09-06 22:24:56 -06:00
James Yonan
c82644c03a Added BufferLineIterator
Iterate over the lines in a buffer by returning
a sub-buffer for each line.  Zero-copy.

Signed-off-by: James Yonan <james@openvpn.net>
2019-09-06 22:24:56 -06:00
James Yonan
115cb656b6 RandomAPI: added randbyte() and randbool() methods
Signed-off-by: James Yonan <james@openvpn.net>
2019-09-06 22:24:56 -06:00
James Yonan
4fa8348689 RunContext: ASIO SIGNAL message now shows signal name rather than number
Signed-off-by: James Yonan <james@openvpn.net>
2019-09-06 22:24:56 -06:00
James Yonan
ebfce58513 Added StaticBuffer, a constant-length Buffer for writing that cannot be extended
Signed-off-by: James Yonan <james@openvpn.net>
2019-09-06 22:24:56 -06:00
James Yonan
c8f9cb88a4 string::split(): call reserve() on return vector
Signed-off-by: James Yonan <james@openvpn.net>
2019-09-06 22:24:56 -06:00
James Yonan
f15e566065 read_binary_unix_fast: should return an int (i.e. errno), not a bool
Signed-off-by: James Yonan <james@openvpn.net>
2019-09-06 22:24:56 -06:00
James Yonan
60501b4513 random: factor out rand32_distribute() from RandomAPI::randrange32()
This is done so that rand32_distribute() can be used for
hash seeds as well.

Signed-off-by: James Yonan <james@openvpn.net>
2019-09-06 22:24:56 -06:00
Lev Stipakov
90123495a5 wintun: get device interfaces list only once
Instead of getting device interfaces list for every adapter,
do it just one.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-09-05 13:45:41 +03:00
Lev Stipakov
ec790df73b wintun: read packets in bulk
Instead of reading single packet and calling
asio::post (which incurs overhead) to read next one,
continue reading packets until ringbuffer is empty (head == tail).

According to tests, this increases read performance
by 40% (from 1.25 to 1.70 Gbit/s).

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-09-05 13:45:41 +03:00
Lev Stipakov
0f85d3f729 wintun: use correct io_context when performing initial read
Without specifying io_context, ASIO will use system
executor, which creates separate thread pool and runs
read() in a wrong, non openvpn core, thread.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-09-05 13:45:41 +03:00
Lev Stipakov
a6151cdeab wintun: use auto-reset events
Wintun documentation clearly states that we must use auto-reset events in ring buffers.
Auto-reset sets event back to non-signalled state after calling WaitForSingleObject.
Without auto-reset and explicit ResetEvent call we got a busy loop.

To avoid confusion move event.hpp from common/ to win/, since it is
Windows-specific code.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-09-05 13:45:41 +03:00
Antonio Quartulli
29acfd95f3
libs: update ASIO to 1.14.0
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2019-09-02 22:22:08 +02:00
Arne Schwabe
438a0ef287 Remove outdated and unused android build files 2019-08-30 00:06:50 +02:00
Antonio Quartulli
e9df57969f
Merge remote-tracking branch 'origin/released' 2019-08-29 18:33:12 +02:00
David Sommerseth
44725ad094
ssl: Fix building with OpenSSL 1.0.2
OpenSSL 1.1.0 introduces OpenSSL_version() function and the
OPENVPN_VERSION macro.  Since they are not defined in older OpenSSL
versoins, building breaks.

The usage of OpenSSL_version() and OPENSSL_VERSION where introduced with
commit 23959fa705

Signed-off-by: David Sommerseth <davids@openvpn.net>
2019-08-29 17:45:45 +02:00
David Sommerseth
efe3f1f635
version: Reset version reference for git master
Signed-off-by: David Sommerseth <davids@openvpn.net>
2019-08-29 17:27:57 +02:00
Arne Schwabe
8c79c06d94 Make tls-crypt/tls-cryptv2 compile with multiple compilation units
This changes the the non constexpr expression to constexpr so that
they can be used in multiple compilation units
2019-08-29 16:59:33 +02:00
Arne Schwabe
4d18aaeb88 Fix LLVM warnings reported during OS X build
const modifies on primitive return types (int, bool, etc.) do not
do anything and Clang complains about these.

Zero initialisation in C++ is done by = {} or class().

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2019-08-29 16:59:33 +02:00
Arne Schwabe
8c9496bb4d Use const_cast for SSL_session_reused
The constness of the SSL* parameter has been changed in upstream SSL.
So we can cast away const for older versions compatibility
Upstream commit: c04b66b18d
2019-08-29 16:46:08 +02:00
Arne Schwabe
33be562a39 Add missing override keywords to openssl/sslctx.hpp 2019-08-29 16:42:12 +02:00
Antonio Quartulli
2c5435a000
dcocli: use compile time define for Tun methods instead of hardcoded iproute
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2019-08-29 16:38:53 +02:00
Arne Schwabe
7c39088f00 Allow overriding reported HW_ADDR and support IV_PLAT_VER 2019-08-29 16:33:05 +02:00
Arne Schwabe
7bb1ea19ee Move sending IV_UI_VER and IV_SSO to build_peer_info 2019-08-29 16:33:05 +02:00
Arne Schwabe
23959fa705 Add reporting of IV_SSL_VER
This information is only send if push-peer-info is enabled. It is meant
to have an easy way for centrally adminstrated to spot clients using
outdated SSL libraries.
2019-08-29 16:33:05 +02:00
Arne Schwabe
63ab5b5e46 Only initialise static member in OpenSSLContext once
This avoid a linkage problem encountered when building core with two
compilation units and OPENVPN_EXTERN being used.

Also adjust core unit tests with regard to now different extern usage
2019-08-29 16:21:57 +02:00
Antonio Quartulli
ecebb40304
Merge remote-tracking branch 'origin/qa' 2019-08-28 10:57:54 +02:00
Lev Stipakov
52c9702502 wintun: replace volatiles with atomics
Volatile doesn't prevent reordering done by hardware (such as ARM).
If this could be a problem, volatile has to be replaced by atomic with
acquire/release semantics.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-08-21 19:09:11 +03:00
Lev Stipakov
d720c7104c appveyor: install Strawberry perl
Similar to https://github.com/conan-community/community/issues/243,
openssl build fails on VS2019 if wrong perl is used.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-08-21 19:09:11 +03:00
Lev Stipakov
60a253a7ef appveyor: update to VS2019
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-08-21 19:09:11 +03:00
Lev Stipakov
48f2b5100b wintun: support for privilege separation
This allows to run openvpn under normal user account,
in which case ring buffers registration is performed
by a separate privileged process.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-08-21 19:09:11 +03:00
Lev Stipakov
6f266be3d8 wintun: ring buffers support
Implemented according to Wintun documentation
and reference client code.

For send and receive ring, client allocates buffer,
creates event and passes it to Wintun under LocalSystem
privileges. When data is availabe for read, Wintun
moves tail pointer of send ring and signals via
send ring's event. To write, client writes to tail
pointer of receive ring and signals via receive ring's event.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-08-21 17:58:37 +03:00
Lev Stipakov
baa1ce2ccf vcxproj: bump VS version to 2019 2019-08-21 17:58:37 +03:00
Lev Stipakov
98bfd037e3 tun/win: factor out ClientConfig into separate header
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-08-21 17:58:37 +03:00
Lev Stipakov
aeb5ce0ad7 wintun: open device with SetupAPI
With introduction of ring buffers Wintun device
must be opened via SetupAPI.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-08-21 17:58:37 +03:00
David Sommerseth
3998d303ce
Finalizing the OpenVPN 3 Core library 3.3 release
Signed-off-by: David Sommerseth <davids@openvpn.net>
2019-08-20 20:11:55 +02:00
Lev Stipakov
728733aee7 deps/mbedtls: rebase "enable unsupported critical extensions" patch
This rebases "Enable allowing unsupported critical extensions in
 runtime" patch on top of 2.7.11.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-08-14 17:02:49 +03:00
Antonio Quartulli
43e36ca45a
lib-version: update to mbedtls-2.7.11 2019-08-14 14:44:15 +02:00
Lev Stipakov
4dbcd85e50 openssl/cipher.hpp: add missing include <compat.hpp>
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-08-10 13:11:25 +03:00
David Sommerseth
69d72ed64f
DCOTransport: Fix server side specific trunk handling
Commit 089aec00b pulled in a dependency for a very server specific
feature not normally needed in more basic implementations.  This
resulted in the code not being able to compile unless the advanced
implementation would be available.  This only happens when ENABLE_DCO is
enabled.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2019-08-07 17:10:23 +02:00
Arne Schwabe
ff732e3b5d Fix OpenVPN Core build with OpenSSL 1.1.0
The client hello call back function are only available in 1.1.1+, not
1.1.0.
2019-07-31 18:02:06 +02:00
Arne Schwabe
0da42f393f Do not use deprecated OpenSSL 1.1.0 methods
For reference:

void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)
{
   if (ctx) {
       EVP_CIPHER_CTX_cleanup(ctx);
      OPENSSL_free(ctx);
   }
}

from OpenSSL 1.0.2

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2019-07-24 13:20:34 +02:00
Antonio Quartulli
35062c0b60
travis.yml: update environment
Update osx used images to osx-10.2
Update linux to Ubuntu 18.04
Update ASIO to 1.13.0
Update OpenSSL to 1.0.2s
Compile with -std=c++14 flag

while at it, fix a script syntax error.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2019-07-19 22:26:07 +02:00
Antonio Quartulli
47046cf6d2
Merge branch 'qa' 2019-07-19 14:39:43 +02:00