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

26 Commits

Author SHA1 Message Date
Razvan Cojocaru
4b10dc453a Add AsioContextStore::stop()
This is meant to help with the following scenario: main thread
creates secondary threads, each secondary thread asks the context
store for its own context, then goes into a "forever" scheduling
loop. Main thread waits for the secondary threads to finish, and
owns the context store. It would be nice to be able to have yet
another thread (say, a SIGINT handler) be able to call .stop()
on all the contexts managed by the context store, thus being able
to end the loops in the secondary threads and allow the main
thread to exit.

Signed-off-by: Razvan Cojocaru <razvan.cojocaru@openvpn.com>
2024-05-22 16:19:13 +00:00
Frank Lichtenheld
8f7fdd10ff
Use openvpn_io::detail::socket_type instead of "int"
On Linux those might be identical, but not on Windows.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2023-09-28 11:33:41 +02:00
Arne Schwabe
0d0e3809c1
Remove OPENVPN_EXTERN
with the new C++17 capability of inline for variables, we can avoid
having to ifdef tricks to only include the variables into one compilation
unit. Also remove the extern.hpp that serves no purpose now anymore.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2023-04-27 23:35:41 +02:00
David Sommerseth
dde1574596
Reformatting source code to new coding style
This is the result after running 'clang-format -i' on all C++ files and
headers, with the defined formatting rules in .clang-format.

Only the openvpn/common/unicode-impl.hpp has been excluded, as that is
mostly a copy of an external project.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2023-01-18 19:24:15 +01:00
David Sommerseth
4996c38ed4
Merge lastest changes from Core v3.7.2 2022-12-14 17:34:29 +01:00
David Sommerseth
8c94a8f774
copyright: Update to 2022
Signed-off-by: David Sommerseth <davids@openvpn.net>
2022-09-29 12:00:26 +02:00
James Yonan
e218888389 AsioBoundSocket: use defined() instead of local_.specified() for readability
Signed-off-by: James Yonan <james@openvpn.net>
2022-06-29 08:39:22 -06:00
James Yonan
b0a99915bb AsioPolySock: make alt_routing_enabled() a const method
Signed-off-by: James Yonan <james@openvpn.net>
2022-05-13 19:09:09 -06:00
James Yonan
d617b97932 AsioBoundSocket: support concurrent use of IPv4 and IPv6 local addresses
Signed-off-by: James Yonan <james@openvpn.net>
2022-05-13 19:09:09 -06:00
David Sommerseth
3fbe0a2701
Update copyrights
Signed-off-by: David Sommerseth <davids@openvpn.net>
2020-03-18 19:37:32 +01:00
Lev Stipakov
f79ef53a76
asiopolysock: disable shutdown for domain socket on macOS
Calling close() on one side makes shutdown() call on another
side throw an exception "socket is not connected".

Shutdown functionality is not required for agent and
hence disabled for UDS and macOS case.

This fixes OVPN3-500.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2019-12-12 14:39:50 +02:00
James Yonan
84483eda25 AsioPolySock: add support for socket shutdown
Signed-off-by: James Yonan <james@openvpn.net>
2019-09-06 22:24:57 -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
f89013ef92 RunContext: don't try to catch SIGQUIT by default
SIGQUIT is better left wired to its standard use of core
dump generation.

Signed-off-by: James Yonan <james@openvpn.net>
2019-07-17 10:53:46 -06:00
James Yonan
14b588c861
asio: added asio_resolver_results_to_string()
Signed-off-by: James Yonan <james@openvpn.net>
2018-03-10 02:28:32 +08:00
James Yonan
fd6e8e9bf6
AsioPolySock: minor changes to remote_endpoint_str()
Add exception handling and consistent labeling of the
underlying type.

Signed-off-by: James Yonan <james@openvpn.net>
2018-03-10 02:28:32 +08:00
James Yonan
06f5e4d711
AsioBoundSocket::Socket: added to_string() method
Signed-off-by: James Yonan <james@openvpn.net>
2018-03-10 02:28:31 +08:00
James Yonan
a26b1646b7
AsioPolySock: extend AltRouting support
Add alt_routing_enabled() method

Extend remote_endpoint_str() method

Signed-off-by: James Yonan <james@openvpn.net>
2018-03-10 02:28:31 +08:00
James Yonan
ae98aa8b6f
AsioPolySock: support AltRouting
* Added native_handle() virtual method

* Use AltRouting abstract socket when
  OPENVPN_POLYSOCK_SUPPORTS_ALT_ROUTING is defined

Signed-off-by: James Yonan <james@openvpn.net>
2018-03-10 02:28:30 +08:00
James Yonan
8f81479f1e
AsioBoundSocket::Socket: support inheritance
Signed-off-by: James Yonan <james@openvpn.net>
2018-03-10 02:28:30 +08:00
David Sommerseth
16b10559f2 [OVPN3-140] Update company names in copyrights
OpenVPN Technologies, Inc. change their name to OpenVPN Inc. during the
autumn of 2017.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2017-12-22 17:59:39 +08:00
David Sommerseth
6caca2c313 [OVPN3-140] Relicense back to AGPLv3
This is essentially a revert of commit 04b2a3c9b7 and commit
ef42e59e05.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2017-12-22 17:59:39 +08:00
James Yonan
4029579e75 AsioPolySock: support bind to local address.
Signed-off-by: James Yonan <james@openvpn.net>
2017-06-22 16:48:38 -06:00
James Yonan
138ec9606e asiopolysock.hpp: don't call SockOpt::set_cloexec(fd)
if fd is undefined (i.e. fd == -1).

Signed-off-by: James Yonan <james@openvpn.net>
2017-04-12 12:24:32 -06:00
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
2855053680 Moved asio files from openvpn/common to openvpn/asio
Signed-off-by: James Yonan <james@openvpn.net>
2017-03-30 15:48:14 -06:00