-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[openvpn3] Update, adapt upstream build, cleanup, test
- Loading branch information
Showing
14 changed files
with
200 additions
and
58 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
diff --git a/cmake/findcoredeps.cmake b/cmake/findcoredeps.cmake | ||
index b7d00d4..b13eed1 100644 | ||
--- a/cmake/findcoredeps.cmake | ||
+++ b/cmake/findcoredeps.cmake | ||
@@ -30,7 +30,7 @@ endif () | ||
function(add_ssl_library target) | ||
if (${USE_MBEDTLS}) | ||
find_package(mbedTLS REQUIRED) | ||
- set(SSL_LIBRARY mbedTLS::mbedTLS) | ||
+ set(SSL_LIBRARY "${MBEDTLS_LIBRARIES}") | ||
target_compile_definitions(${target} PRIVATE -DUSE_MBEDTLS) | ||
else () | ||
find_package(OpenSSL REQUIRED) | ||
@@ -38,7 +38,7 @@ function(add_ssl_library target) | ||
target_compile_definitions(${target} PRIVATE -DUSE_OPENSSL) | ||
endif () | ||
|
||
- target_link_libraries(${target} ${SSL_LIBRARY}) | ||
+ target_link_libraries(${target} PRIVATE ${SSL_LIBRARY}) | ||
endfunction() | ||
|
||
|
||
@@ -93,10 +93,10 @@ function(add_core_dependencies target) | ||
# a patched version. So we want to prefer its include | ||
# directories. | ||
find_package(asio REQUIRED) | ||
- target_link_libraries(${target} asio::asio) | ||
+ target_link_libraries(${target} PRIVATE asio::asio) | ||
|
||
find_package(lz4 REQUIRED) | ||
- target_link_libraries(${target} lz4::lz4) | ||
+ target_link_libraries(${target} PRIVATE lz4::lz4) | ||
|
||
add_ssl_library(${target}) | ||
|
||
@@ -105,14 +105,14 @@ function(add_core_dependencies target) | ||
find_library(iokit IOKit) | ||
find_library(coreServices CoreServices) | ||
find_library(systemConfiguration SystemConfiguration) | ||
- target_link_libraries(${target} ${coreFoundation} ${iokit} ${coreServices} ${systemConfiguration} ${lz4}) | ||
+ target_link_libraries(${target} PRIVATE ${coreFoundation} ${iokit} ${coreServices} ${systemConfiguration} ${lz4}) | ||
endif() | ||
|
||
if(UNIX) | ||
- target_link_libraries(${target} pthread) | ||
+ target_link_libraries(${target} PRIVATE pthread) | ||
endif() | ||
|
||
- target_link_libraries(${target} ${EXTRA_LIBS}) | ||
+ target_link_libraries(${target} PRIVATE ${EXTRA_LIBS}) | ||
|
||
if (USE_WERROR) | ||
if (MSVC) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
diff --git a/openvpn/mbedtls/mbedtls_compat.hpp b/openvpn/mbedtls/mbedtls_compat.hpp | ||
index 19e6f25..9db4e01 100644 | ||
--- a/openvpn/mbedtls/mbedtls_compat.hpp | ||
+++ b/openvpn/mbedtls/mbedtls_compat.hpp | ||
@@ -27,11 +27,11 @@ | ||
#include <mbedtls/version.h> | ||
#include <mbedtls/pem.h> | ||
|
||
-#if not defined(MBEDTLS_ERR_SSL_BAD_PROTOCOL_VERSION) | ||
+#if ! defined(MBEDTLS_ERR_SSL_BAD_PROTOCOL_VERSION) | ||
#define MBEDTLS_ERR_SSL_BAD_PROTOCOL_VERSION MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION | ||
#endif | ||
|
||
-#if not defined(MBEDTLS_OID_X509_EXT_EXTENDED_KEY_USAGE) | ||
+#if ! defined(MBEDTLS_OID_X509_EXT_EXTENDED_KEY_USAGE) | ||
#define MBEDTLS_OID_X509_EXT_EXTENDED_KEY_USAGE MBEDTLS_X509_EXT_KEY_USAGE | ||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 6cf519d..d07321c 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -32,11 +32,13 @@ include(ovpn-doxygen) | ||
|
||
add_subdirectory(client) | ||
add_subdirectory(test/unittests) | ||
+if(BUILD_TOOLS) | ||
add_subdirectory(test/ovpncli) | ||
|
||
add_subdirectory(openvpn/omi) | ||
add_subdirectory(openvpn/ovpnagent/win) | ||
add_subdirectory(openvpn/ovpnagent/mac) | ||
+endif() | ||
|
||
if (ENABLE_DOXYGEN) | ||
# Exclude some project specific directories | ||
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt | ||
index e1ecf8f..5afe6ec 100644 | ||
--- a/client/CMakeLists.txt | ||
+++ b/client/CMakeLists.txt | ||
@@ -1,5 +1,27 @@ | ||
include(findcoredeps) | ||
include(findswigdeps) | ||
+add_library(ovpnclilib ovpncli.cpp) | ||
+add_core_dependencies(ovpnclilib) | ||
+target_compile_features(ovpnclilib PUBLIC cxx_std_17) | ||
+target_include_directories(ovpnclilib PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}" PUBLIC "$<INSTALL_INTERFACE:include>") | ||
+set_target_properties(ovpnclilib PROPERTIES | ||
+ OUTPUT_NAME ovpncli | ||
+ EXPORT_NAME ovpncli | ||
+) | ||
+install(TARGETS ovpnclilib EXPORT unofficial-openvpn3-targets) | ||
+install(EXPORT unofficial-openvpn3-targets | ||
+ NAMESPACE unofficial::openvpn3:: | ||
+ DESTINATION share/unofficial-openvpn3 | ||
+) | ||
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/unofficial-openvpn3-config.cmake" "\ | ||
+if(NOT \"${BUILD_SHARED_LIBS}\") | ||
+ include(CMakeFindDependencyMacro) | ||
+ find_dependency(asio CONFIG) | ||
+ find_dependency(lz4 CONFIG) | ||
+endif() | ||
+include(\"\${CMAKE_CURRENT_LIST_DIR}/unofficial-openvpn3-targets.cmake\") | ||
+") | ||
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/unofficial-openvpn3-config.cmake" DESTINATION share/unofficial-openvpn3) | ||
|
||
if (BUILD_SWIG_LIB) | ||
set_property(SOURCE ovpncli.i PROPERTY CPLUSPLUS ON) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
file(READ "${CMAKE_CURRENT_LIST_DIR}/usage" usage) | ||
message(WARNING "find_package(${CMAKE_FIND_PACKAGE_NAME}) is deprecated. Use find_package(unofficial-openvpn3) instead.") | ||
include(CMakeFindDependencyMacro) | ||
find_dependency(unofficial-openvpn3 CONFIG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled) | ||
|
||
vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project") | ||
vcpkg_cmake_build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.7) | ||
project(openvpn3-test CXX) | ||
|
||
add_executable(main main.cpp) | ||
|
||
find_package(unofficial-openvpn3 CONFIG REQUIRED) | ||
target_link_libraries(main PRIVATE unofficial::openvpn3::ovpncli) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include <openvpn/ovpncli.hpp> | ||
|
||
using namespace openvpn::ClientAPI; | ||
|
||
// Cf. https://github.com/OpenVPN/openvpn3/blob/master/README.rst#openvpn-3-client-core | ||
class Client : public OpenVPNClient | ||
{ | ||
public: | ||
void acc_event(const AppCustomControlMessageEvent &) override {} | ||
void event(const Event&) override {} | ||
void external_pki_cert_request(ExternalPKICertRequest &) override {} | ||
void external_pki_sign_request(ExternalPKISignRequest &) override {} | ||
void log(const LogInfo&) override {} | ||
bool pause_on_connection_timeout() override { return false; } | ||
}; | ||
|
||
int main() | ||
{ | ||
Client c; | ||
return OpenVPNClient::stats_n(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "vcpkg-ci-openvpn3", | ||
"version-string": "ci", | ||
"description": "Validates openvpn3", | ||
"dependencies": [ | ||
"openvpn3", | ||
{ | ||
"name": "vcpkg-cmake", | ||
"host": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters