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

4140 Commits

Author SHA1 Message Date
Heiko Hund
8c8e96e138 streamline overriding virtual function syntax
In the code base three different syntaxes for overriding virtual member
functions could be found:

  1) virtual ... override
  2) virtual ...
  3) ... override

This converts all of them to the third syntax, as recommended by the ISO
C++ core guidelines in C.128

Signed-off-by: Heiko Hund <heiko@openvpn.net>
2024-08-13 02:01:24 +02:00
James Yonan
e4368fd83e CryptoAlgs: added missing #include <list>
CryptoAlgs uses std::list but did not #include <list>

Signed-off-by: James Yonan <james@openvpn.net>
2024-08-09 10:10:05 +00:00
James Yonan
6132010ea1 ManClientInstance::SendBase: added is_stopped() virtual method
is_stopped() should return true when the instance
is stopped or halted.

Signed-off-by: James Yonan <james@openvpn.net>
2024-08-09 10:10:05 +00:00
RenovateBot
7444bad773 chore(deps): update vcpkg digest to f5398d9 2024-08-08 14:43:15 +00:00
RenovateBot
8aaecdd14a chore(deps): update dependency chriskohlhoff/asio to asio-1-31-0 2024-08-08 14:43:14 +00:00
Razvan Cojocaru
98e0f1f650 logger: De-duplicate Logger::log_{trace, info, ...} logic
Add a single template function implementing the logging logic,
parametrized by log level, and have the log_{trace, info, ...}
functions call that.

While at it, const-ify a couple of member functions.

Signed-off-by: Razvan Cojocaru <razvan.cojocaru@openvpn.com>
2024-08-08 14:43:14 +00:00
Razvan Cojocaru
bd5685c921 Add -Wnon-virtual-dtor to the UNIX C++ compiler flags
Signed-off-by: Razvan Cojocaru <razvan.cojocaru@openvpn.com>
2024-08-08 14:43:12 +00:00
Razvan Cojocaru
6217fa0e1a Add default virtual destructors to base classes with virtual functions
Without this fix, the openvpn3-linux build is broken whenever a
dependency enables -Wnon-virtual-dtor (which protobuf 27.3
currently does on Arch Linux). The openvpn3-linux build treats
warnings as errors.

Jira: OVPN3-1242
Signed-off-by: Razvan Cojocaru <razvan.cojocaru@openvpn.com>
2024-08-08 14:43:12 +00:00
Lev Stipakov
cbea2d46c2 push update: support for Linux
Only tun-related options are supported, such as

  ifconfig, route, dns, dhcp-option

etc.

OVPN3-1231

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2024-08-08 14:43:11 +00:00
Lev Stipakov
0c27550736 push update: support for dco-win
Only tun-related options are supported, such as

  ifconfig, route, dns, dhcp-option

etc.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2024-08-08 14:43:11 +00:00
Lev Stipakov
6a1a641cf5 push update: support for tap-windows6
Only tun-related options are supported, such as

  ifconfig, route, dns, dhcp-option

etc.

OVPN3-1000

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2024-08-08 14:43:11 +00:00
Lev Stipakov
72c11c8232 push update: add IV_PROTO flag
This is needed to indicate to server that
we support PUSH_UPDATE control channel message.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2024-08-08 14:43:11 +00:00
Lev Stipakov
adacc16cd4 push update: base implementation
This adds support for parsing PUSH_UPDATE
control command, which enables to update
options "on the fly", without reconnect.

The options presented in the PUSH_UPDATE list
overwrite current options with the name. To unset
an option, it has to be prefixed with the "-".

For example:

  PUSH_UPDATE,route 10.10.10.0 255.255.255.0,-dns

Replaces all existing routes with this new one
and removes all "dns" options.

If the client doesn't support updating certain option,
it reconnects. Except when option is prefixed with "?" -
in this case option is considered "optional".

For example, this message

  PUSH_UPDATE,?unsupported_option_a

does nothing, but this one:

  PUSH_UPDATE,dns 0,block-ipv6,unsupported_option_b

makes client reconnect, since it contains mandatory unsupported option.

OVPN3-1234

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2024-08-08 14:43:11 +00:00
Lev Stipakov
6f9f02ff9e cmake: use multiprocessor build for MSVC
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2024-08-08 14:43:11 +00:00
Lev Stipakov
fa78d9a8a9 vcpkg.json: add GTest host dependency
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2024-08-08 14:43:11 +00:00
Razvan Cojocaru
961ac5d699 Collapse LOGGER_LOG_{INFO, VERBOSE, DEBUG, TRACE, ERROR} implementation
Reduced the pasted implementations of the LOGGER_LOG_<VERBOSITY>
macros to a single macro with a verbosity parameter, in an attempt
to make the code easier to read by reducing the line count, and
hopefully reduce the probability of copy / paste bugs
(LOGGER_LOG_ERROR() was already checking against LOG_LEVEL_INFO).

Signed-off-by: Razvan Cojocaru <razvan.cojocaru@openvpn.com>
2024-08-05 16:51:55 +03:00
RenovateBot
4e643142aa chore(deps): update github actions 2024-08-01 00:00:38 +00:00
Arne Schwabe
5e968be14e Report run-time OpenSSL version instead of compile time version
Returning OPENSSL_VERSION_TEXT will return the value of the library at
compile time. We rather want to know the version of the library that is
actually running, so use OpenSSL_version instead.

Jira: OVPN3-1227
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-07-29 13:40:32 +00:00
Arne Schwabe
b43851c7a0 Disable swig warnings for ClangCL
Swig under windows add a lot of code that clang does not like, so disable those warning

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-07-29 13:40:30 +00:00
Arne Schwabe
6f6cedc2a6 Make building with clang-cl under windows -Werror clean
Use empty braces to initalise the structs to zero since they
use sub structs and clang wants us to otherwise use {{ 0 }}

Ensure that methods with a return value do not return without a
value or exception by throwing an exception.

Add missing override in the unit test

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-07-29 13:40:30 +00:00
Leonard Ossa
b550d6bf7f IP Refactor
Signed-off-by: Leonard Ossa <leonard.ossa@openvpn.com>
2024-07-29 13:40:29 +00:00
Charlie Vigue
0faf0f89de Make runtime range check only happen if needed
In numeric_cast when casting from signed to unsigned, the second part
of the conditional might be const in some cases. This is intended to
ensure the second runtime check is only present if possibly needed.

This is better and avoids a Coverity performance warning

Signed-off-by: Charlie Vigue <charlie.vigue@openvpn.com>
2024-07-25 16:39:46 +00:00
Frank Lichtenheld
20260b27f6 CodeCoverage.cmake: Import coverage helper code
From https://github.com/bilke/cmake-modules/blob/master/CodeCoverage.cmake

Jira: OVPN3-1237
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2024-07-25 13:43:22 +00:00
Charlie Vigue
4aca9606c6 Change ::value --> _v and ::type --> _t
Also add doxygen and make requested changes from code review

Signed-off-by: Charlie Vigue <charlie.vigue@openvpn.com>
2024-07-22 17:36:18 +00:00
Charlie Vigue
18c3dfe103 Respect data encapsulation 2024-07-22 17:36:18 +00:00
Charlie Vigue
6b3db207d2 Move all impl to bottom 2024-07-22 17:36:18 +00:00
Charlie Vigue
8443be9f6d Move BufferType impl into ConstBufferType 2024-07-22 17:36:18 +00:00
Charlie Vigue
28787e03a1 Move all impl from declarations
Move ConstBufferType BufferType BufferAllocatedType member function
implementations out of declaration
2024-07-22 17:36:18 +00:00
RenovateBot
13d6b06e1c chore(deps): update dependency google/googletest to v1.15.0 2024-07-17 10:00:24 +00:00
Frank Lichtenheld
bf6f42dc19 Merge current state of releaseprep/3.10 to master
* origin/releaseprep/3.10:
  Do not reject control message with trailing newlines
  aws: account for RandomAPI change
  Allow disabling TLS 1.3 in certcheck to more easily debug problems
  Implement changes to allow test dpc certcheck to be tested
  Allow setting a maximum TLS version
  Change cxa1 protocol tag to dpc1
  Fix spelling errors raised by Debian linter
  mac agent: reinstall host route during restart
  Preparing QA cycle for OpenVPN 3 Core library release v3.10

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2024-07-16 17:19:49 +02:00
Frank Lichtenheld
27ceba227a Release Merge: OpenVPN 3 Core library version 3.9
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2024-07-16 17:19:23 +02:00
Razvan Cojocaru
f15261b8dd Fix crash if no tls-auth section is present in the config
We are now only initializing TLS-related objects if TLS auth mode
is enabled.

This fixes internal Jira issue PG-122.

Signed-off-by: Razvan Cojocaru <razvan.cojocaru@openvpn.com>
2024-07-12 09:29:27 +00:00
Leonard Ossa
e929058607 Refactor by getting rid of redundant value in loop
Signed-off-by: Leonard Ossa <leonard.ossa@openvpn.com>
2024-07-10 16:43:19 +02:00
Leonard Ossa
a8b6cb01fc Refactor iterating to range-based loop in find()
Signed-off-by: Leonard Ossa <leonard.ossa@openvpn.com>
2024-07-10 16:43:19 +02:00
Leonard Ossa
c52419411e Refactor enum to enum class in addrspacesplit
Signed-off-by: Leonard Ossa <leonard.ossa@openvpn.com>
2024-07-10 16:43:19 +02:00
Leonard Ossa
a00a4c6241 Refactor empty constructor to default
Signed-off-by: Leonard Ossa <leonard.ossa@openvpn.com>
2024-07-10 16:43:19 +02:00
Razvan Cojocaru
5329d67521 Update the copyright years used by core consumers
Signed-off-by: Razvan Cojocaru <razvan.cojocaru@openvpn.com>
2024-07-09 15:28:13 +00:00
Leonard Ossa
3819357192 Refactor iterating to range-based loop
Do we actually need / use this code?

Signed-off-by: Leonard Ossa <leonard.ossa@openvpn.com>
2024-07-09 14:39:33 +02:00
Leonard Ossa
f2856ec8ba Refactor exists method in AddrList to use std::find
Signed-off-by: Leonard Ossa <leonard.ossa@openvpn.com>
2024-07-09 14:33:52 +02:00
Arne Schwabe
b201027807 Do not reject control message with trailing newlines
The previous fix to reject invalid control message was a bit too aggressive
as scripts often accidentally include an extra newline at the end of the
control message.

Jira: OVPN3-1225
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-07-05 12:54:03 +02:00
Leonard Ossa
3646265d15 Refactor nested namespace to C++17 style
Signed-off-by: Leonard Ossa <leonard.ossa@openvpn.com>
2024-07-03 10:20:11 +00:00
Frank Lichtenheld
a89b6cb184 Update Linux build instructions in README.rst
- Remove dependency build. For normal use cases on a
  recent distro, installing all dependencies from distro
  should be fine. Tested on Ubuntu 20.04 (mbedTLS too old,
  otherwise okay) and Ubuntu 22.04.
- Document more dependencies. With the added dependencies a
  clean build and ctest run is possible starting with the
  default ubuntu:<version> containers.
- Use ninja. We use this for all of our non-VC builds, so
  recommend it here as well.

Based on a smaller change proposed in Github#301
by Scruel Tao.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2024-07-03 10:20:10 +00:00
Frank Lichtenheld
5d60f0dbee openvpn_PRF: Tell compiler some restrictions on arguments
To avoid false-positives.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2024-07-03 10:20:10 +00:00
RenovateBot
dd9ca30871 Update vcpkg digest to e3ad383 2024-06-27 23:00:24 +00:00
Charlie Vigue
62c9da1879 Add unit tests to show tag works
Signed-off-by: Charlie Vigue <charlie.vigue@openvpn.com>
2024-06-26 15:19:36 +00:00
Lev Stipakov
5022f305f5 aws: account for RandomAPI change
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2024-06-26 11:06:20 +00:00
Arne Schwabe
dca41905a5
Allow disabling TLS 1.3 in certcheck to more easily debug problems
Jira: OVPN3-1216
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-06-25 19:06:31 +02:00
Arne Schwabe
2747bfc1d1
Implement changes to allow test dpc certcheck to be tested
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-06-25 19:06:14 +02:00
Arne Schwabe
fdead3f04c
Allow setting a maximum TLS version
This is something useful for debugging. We do not expose this feature
to avoid it being used for real connections.

Signed-off-by: Arne Schwabe <arne@openvpn.net>
2024-06-25 19:05:31 +02:00
Charlie Vigue
c7e1dce5b3 Use LoggerMixin tag to segregate SSLAPI log
Prior to this branch the various instances of the LoggerMixin were
coincidentally shared, depending on whether the default levels had
the same values in the template arguments or not. Since it's not clear
this sharing was intended or accidental I made it possible to tag if
desired to ensure the similarly tagged instances are unique.
2024-06-22 04:04:56 +00:00