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

90 Commits

Author SHA1 Message Date
James Yonan
691a641a43 Added i/o abstraction layer.
Created a lightweight abstraction layer so that another i/o
reactor can be dropped in place of asio.

The basic approach is to rename all references to asio::xxx
types to openvpn_io::xxx and then make openvpn_io a
preprocessor variable that points to the top-level namespace
of the i/o reactor implementation.

All of the source files that currently include <asio.hpp> now
include <openvpn/io/io.hpp> instead:

This gives us a lightweight abstraction layer that allows us
to define openvpn_io to be something other than asio.

Other changes:

* Inclusion of asio by scripts/build is now optional, and is
  enabled by passing ASIO=1 or ASIO_DIR=<dir>.

* Refactored openvpn/common/socktypes.hpp to no longer
  require asio.

* Refactored openvpn/log/logthread.hpp to no longer require
  asio.

* Added openvpn::get_hostname() method as alternative to
  calling asio directly.

* openvpn/openssl/util/init.hpp will now #error
  if USE_ASIO is undefined.

Signed-off-by: James Yonan <james@openvpn.net>
2017-03-30 15:48:14 -06:00
James Yonan
b2cd82a5bf copyright: updated to 2017.
Signed-off-by: James Yonan <james@openvpn.net>
2017-03-18 13:11:09 -06:00
James Yonan
ef42e59e05 Switch from AGPLv3 to GPLv3 on recently added files.
Signed-off-by: James Yonan <james@openvpn.net>
2017-03-18 12:47:11 -06:00
James Yonan
ad1989a547 asio: deal with symbol renaming in latest github master
mutable_buffers_1 -> mutable_buffer
const_buffers_1 -> const_buffer

This patch is a granularization of a patch by David Sommerseth
<davids@openvpn.net> where only the above renames are included.
2017-03-18 12:24:54 -06:00
James Yonan
8cbce45545 buf_read : removed accidently-committed debugging code. 2017-03-18 12:24:54 -06:00
James Yonan
f0cfa5e18f Buffer : added is_zeroed() method. 2017-03-18 12:24:54 -06:00
James Yonan
85b49d89b5 TempFile : added additional methods including reset(),
truncate(), read(), and set_delete().

Added buf_read() methods to read from a file descriptor
into a Buffer.
2017-03-18 12:19:39 -06:00
Samuli Seppänen
04b2a3c9b7 Switch from AGPLv3 to GPLv3
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
2017-03-16 14:43:55 +02:00
James Yonan
971abda88f copyright : updated to 2016 2016-09-03 23:29:23 -06:00
James Yonan
46d32a692d BufferVector : fixed a thinko that resulted in BufferVector
actually being a BufferList.
2016-06-09 17:20:42 -06:00
James Yonan
7e1242769a Buffer : Added c_str() and length() methods to Buffer so it
can be used like a std::string.
2016-06-09 16:54:26 -06:00
James Yonan
4083281bd1 buffer : added Buffer::null_terminate() method to
null-terminate a buffer that is not already null-terminated.
2016-05-10 17:50:03 -06:00
James Yonan
74d89fab7c OpenVPN protocol core : when passing objects to methods that
may assert ownership over them, use C++11 rvalue/move
semantics.
2016-05-10 13:02:11 -06:00
James Yonan
2255bab03a OpenVPN protocol core : added logic to control channel
receive path to reassemble messages fragmented by the
SSL layer up to a max message size of 64 KB.

Ramifications:

* Peer info data and pushed options can be significantly
  larger (i.e. approaching 64 KB).

* Less need for the options continuation feature.

Limitations:

* While this patch doesn't change the underlying OpenVPN
  protocol, it can result in messages being sent that are
  fragmented by the receiving SSL implementation into
  multiple buffers.  Implementations that lack reassembly
  capabilities (such as OpenVPN 2.x at this point in time)
  would see each buffer fragment as a separate message.

* This patch running on the server will break negotiation
  with pre-peer-info clients.  Basically this means it will
  interoperate with any OpenVPN 3 version or OpenVPN 2.x
  version that includes the June 2010 commit "Implemented a
  key/value auth channel from client to server.
  Version 2.1.1i".
2016-05-09 21:39:04 -06:00
James Yonan
fc73acfade class SafeString std::string constructor should accept
the string as a const reference.
2015-12-22 19:08:25 -07:00
James Yonan
dfbd8a9ce9 Added openvpn/buffer/bufhex.hpp for converting
POD objects to/from hex strings.
2015-12-14 14:54:25 -07:00
James Yonan
1b0ac32140 In BufferList, added put_consume() method. 2015-10-28 22:37:04 -06:00
James Yonan
79fdea43d2 buffer.hpp changes:
* added const_buffers_1_limit() method that is like
  const_buffers_1_clamp() but includes an upper-bound size
  constraint.

* realign() should be a no-op if headroom == offset_

* added additional reset() convenience method that also calls
  init_headroom()
2015-10-28 22:33:26 -06:00
James Yonan
a267d9b32a In bufstr.hpp, added buf_append_string() methods. 2015-10-27 18:18:09 -06:00
James Yonan
97384f66f6 Added to_string() method to BufferList. 2015-10-23 11:12:49 -06:00
James Yonan
7b14dae436 In zlib.hpp, don't compile zlib code unless
HAVE_ZLIB is defined.

In scripts/build-extras/zlib.sh, define
HAVE_ZLIB when running build script with
ZLIB=1.
2015-10-16 13:49:11 -06:00
James Yonan
3e42c09790 In zlib.hpp, make verbosity setting (verbose) into an
optional run-time parameter, but retain the compile-time
setting (OPENVPN_GZIP_DEBUG) to determine the default.
2015-10-15 23:34:16 -07:00
James Yonan
59c5950949 In ZLib::decompress_gzip(), allow max_size to be disabled
(i.e. no limit on size) by setting to zero.
2015-10-15 23:31:21 -07:00
James Yonan
d38101d5c2 In buflist.hpp:
* Added explicit flag to turn on size=1 optimization.
* Added join() method without arguments.
* Added copy() method.
2015-09-18 10:14:03 -07:00
James Yonan
1871d5671d Added ZLib::decompress_gzip() method. 2015-09-07 06:16:54 -07:00
James Yonan
26501d28a3 Added BufferList class for building a list of BufferPtrs
then merging them via the join() method.
2015-09-07 06:11:46 -07:00
James Yonan
ceaba5536e In Buffer, added front() and back() methods. 2015-09-06 16:41:46 -07:00
James Yonan
85e612c237 Added support for buffer.hpp to be built without ASIO.
Just define NO_ASIO.
2015-08-20 12:42:46 -07:00
James Yonan
c6a21c827b Boost dependency elimination -- final removal of Boost
dependency.  Asio is now included as a standalone,
header-only dependency.
2015-06-06 10:59:18 -06:00
James Yonan
a4759c5119 In bufstr.hpp, added buf_alloc_from_string() methods. 2015-06-03 20:36:57 -06:00
James Yonan
9b753715df Added bufclamp.hpp, a debugging tool that clamps the size
of network buffers on stream-based protocols.
2015-06-03 20:36:19 -06:00
James Yonan
b75c780cab Renamed boost::intrusive_ptr<T> usage to RCPtr<T>. 2015-05-17 21:26:53 -06:00
James Yonan
35ac9f6229 Renamed types.hpp to size.hpp since it now only defines
size_t and ssize_t.
2015-05-17 13:27:34 -06:00
James Yonan
fe6fcefa61 C++11 : rename NULL to nullptr 2015-05-17 02:53:37 -06:00
James Yonan
51a8614ca8 Added SafeString::to_string() method. 2015-04-30 10:29:07 -06:00
James Yonan
4b02f237eb minor C++11 update: Changed BOOST_STATIC_ASSERT to static_assert. 2015-04-23 13:03:09 -06:00
James Yonan
069de90ffd minor C++11 updates:
* rename BOOST_NOEXCEPT to noexcept

* verify that certain classes are noexcept move constructable
  including Option, Buffer, BufferAllocated, RunContext::Thread
2015-04-23 12:49:25 -06:00
James Yonan
0cb30aed01 Added BufferAllocated::realloc() method. 2015-02-18 07:45:29 -07:00
James Yonan
4aa3672196 Fixed memory leak in newly added ZLib::compress_gzip(). 2015-02-13 20:32:07 -07:00
James Yonan
7b6533484e Added gzip compression support to ovpn3 library. 2015-02-13 14:29:09 -07:00
James Yonan
53be529a70 In buffer.hpp, added max_size_tailroom(), inc_size(), and
mutable_buffers_1_append() methods that are useful when
appending to buffers.
2015-02-10 15:53:41 -07:00
James Yonan
ab558a2ba6 In buffer.hpp, modified mutable_buffers_1() to use
max_size_tailroom() instead of remaining(tailroom) to compute
remaining space.  This makes sense because max_size_tailroom()
doesn't consider the existing buffer length, just as data()
doesn't.
2015-02-10 15:52:56 -07:00
James Yonan
c2c7292a70 Updated copyright to 2015. 2015-01-06 12:56:21 -07:00
James Yonan
7e1d159cee Major protocol upgrades:
* peer_id/DATA_V2/op32
  client -> server:
    IV_PROTO=2
  server -> client :
    push "peer-id 1234"
    push "peer-id -1"

* AEAD/GCM support
  client -> server:
    IV_NCP=2
  server -> client:
    push "cipher AES-256-GCM"

* Compression V2
  client -> server:
    IV_LZ4v2=1
    IV_COMP_STUBv2=1
  server -> client:
    push "compress stub-v2"
    push "compress lz4-v2"

* TCP non-linear packet ID
  client -> server:
    IV_TCPNL=1
  server -> client:
    [always enabled]
2014-12-21 10:32:37 -07:00
James Yonan
e50c7e3976 Removed spurrious include of logsimple.hpp from bufstream.hpp. 2014-11-04 07:20:15 -07:00
James Yonan
902e7cb83b Added SafeString::operator==(const char *str) const 2014-11-03 08:14:23 -07:00
James Yonan
4c18baac13 Added SafeString class for passwords and other
security-sensitive data that implements wipe-on-destruct
semantics.
2014-10-30 10:37:07 -06:00
James Yonan
51c1a403c3 Buffer:
* Added reserve().

* Added set_trailer() which is useful for maintaining
  null-terminated strings.

* Added indexing methods (index and c_index) that return
  pointers rather than references.

* Added range() method for returning a subrange of a
  buffer as another buffer.
2014-10-30 10:36:33 -06:00
James Yonan
7912f80875 Added write_seq(BUFSEQ) method to TunIO for scatter/gather
write support.

Added class AsioConstBufferSeq2 as a BUFSEQ class that
implements the Asio ConstBufferSequence requirements.
2014-10-25 22:39:35 -06:00
James Yonan
48f233f517 Added some const qualifiers to Buffer constructor/member
args for consistency.
2014-10-25 22:21:42 -06:00