Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for OpenVPN3 #327

Merged
merged 1 commit into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@ jobs:
matrix:
arch: [x86, x64, arm64]
ossl: [ossl1.1.1, ossl3]
ovpn3:
- preset: ""
name: ""
upload_name: ""
- preset: -ovpn3
name: " - ovpn3"
upload_name: "_ovpn3"

env:
# Indicates the location of the vcpkg as a Git submodule of the project repository.
VCPKG_ROOT: ${{ github.workspace }}/vcpkg

name: 'msvc - ${{matrix.arch}} - ${{ matrix.ossl }}'
name: 'msvc - ${{matrix.arch}} - ${{ matrix.ossl }}${{ matrix.ovpn3.name }}'
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
Expand All @@ -28,15 +35,15 @@ jobs:
- name: Run CMake consuming CMakePreset.json and vcpkg.json by mean of vcpkg.
uses: lukka/run-cmake@v10
with:
configurePreset: '${{ matrix.arch }}-release-${{ matrix.ossl }}'
buildPreset: '${{ matrix.arch }}-release-${{ matrix.ossl }}'
configurePreset: '${{ matrix.arch }}-release-${{ matrix.ossl }}${{ matrix.ovpn3.preset }}'
buildPreset: '${{ matrix.arch }}-release-${{ matrix.ossl }}${{ matrix.ovpn3.preset }}'

- uses: actions/upload-artifact@v3
with:
name: openvpn-gui_${{ matrix.arch }}_${{ matrix.ossl }}
name: openvpn-gui_${{ matrix.arch }}_${{ matrix.ossl }}${{ matrix.ovpn3.upload_name }}
path: |
out/build/${{ matrix.arch }}-release-${{ matrix.ossl }}/*.dll
out/build/${{ matrix.arch }}-release-${{ matrix.ossl }}/*.exe
out/build/${{ matrix.arch }}-release-${{ matrix.ossl }}${{ matrix.ovpn3.preset }}/*.dll
out/build/${{ matrix.arch }}-release-${{ matrix.ossl }}${{ matrix.ovpn3.preset }}/*.exe
mingw:
strategy:
Expand Down
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
option(CLI_OVPN3 "Build ${PROJECT_NAME} with OpenVPN3 support" OFF)

cmake_minimum_required(VERSION 3.10)

if(NOT VCPKG_MANIFEST_DIR)
Expand Down Expand Up @@ -32,7 +34,7 @@ find_package(OpenSSL REQUIRED)

set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")

target_link_libraries(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME} PRIVATE
OpenSSL::SSL
Wtsapi32.lib
Netapi32.lib
Expand Down Expand Up @@ -71,6 +73,16 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE
WIN32_LEAN_AND_MEAN
HAVE_CONFIG_H)

if (${CLI_OVPN3})
find_package(json-c REQUIRED)

target_link_libraries(${PROJECT_NAME} PRIVATE
json-c::json-c)

target_compile_definitions(${PROJECT_NAME} PRIVATE
ENABLE_OVPN3)
endif ()

if(MSVC)
# work around msvc generator Debug/Release directory ugliness, doesn't apply for Ninja
set_target_properties(${PROJECT_NAME} PROPERTIES
Expand Down
116 changes: 116 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "ovpn3",
"hidden": true,
"cacheVariables": {
"CLI_OVPN3": "ON"
}
},
{
"name": "x64-debug-ossl3",
"inherits": [ "base", "ossl3", "x64", "debug" ]
Expand Down Expand Up @@ -110,6 +117,54 @@
{
"name": "x86-release-ossl1.1.1",
"inherits": [ "base", "ossl1.1.1", "x86", "release" ]
},
{
"name": "x64-debug-ossl3-ovpn3",
"inherits": [ "x64-debug-ossl3", "ovpn3" ]
},
{
"name": "x64-debug-ossl1.1.1-ovpn3",
"inherits": [ "x64-debug-ossl1.1.1", "ovpn3" ]
},
{
"name": "arm64-debug-ossl3-ovpn3",
"inherits": [ "arm64-debug-ossl3", "ovpn3" ]
},
{
"name": "arm64-debug-ossl1.1.1-ovpn3",
"inherits": [ "arm64-debug-ossl1.1.1", "ovpn3" ]
},
{
"name": "x86-debug-ossl3-ovpn3",
"inherits": [ "x86-debug-ossl3", "ovpn3" ]
},
{
"name": "x86-debug-ossl1.1.1-ovpn3",
"inherits": [ "x86-debug-ossl1.1.1", "ovpn3" ]
},
{
"name": "x64-release-ossl3-ovpn3",
"inherits": [ "x64-release-ossl3", "ovpn3" ]
},
{
"name": "x64-release-ossl1.1.1-ovpn3",
"inherits": [ "x64-release-ossl1.1.1", "ovpn3" ]
},
{
"name": "arm64-release-ossl3-ovpn3",
"inherits": [ "arm64-release-ossl3", "ovpn3" ]
},
{
"name": "arm64-release-ossl1.1.1-ovpn3",
"inherits": [ "arm64-release-ossl1.1.1", "ovpn3" ]
},
{
"name": "x86-release-ossl3-ovpn3",
"inherits": [ "x86-release-ossl3", "ovpn3" ]
},
{
"name": "x86-release-ossl1.1.1-ovpn3",
"inherits": [ "x86-release-ossl1.1.1", "ovpn3" ]
}
],
"buildPresets": [
Expand Down Expand Up @@ -172,6 +227,67 @@
"name": "arm64-debug-ossl1.1.1",
"configurePreset": "arm64-debug-ossl1.1.1",
"configuration": "Debug"
},

{
"name": "x64-release-ossl3-ovpn3",
"configurePreset": "x64-release-ossl3-ovpn3",
"configuration": "Release"
},
{
"name": "x64-release-ossl1.1.1-ovpn3",
"configurePreset": "x64-release-ossl1.1.1-ovpn3",
"configuration": "Release"
},
{
"name": "x86-release-ossl3-ovpn3",
"configurePreset": "x86-release-ossl3-ovpn3",
"configuration": "Release"
},
{
"name": "x86-release-ossl1.1.1-ovpn3",
"configurePreset": "x86-release-ossl1.1.1-ovpn3",
"configuration": "Release"
},
{
"name": "arm64-release-ossl3-ovpn3",
"configurePreset": "arm64-release-ossl3-ovpn3",
"configuration": "Release"
},
{
"name": "arm64-release-ossl1.1.1-ovpn3",
"configurePreset": "arm64-release-ossl1.1.1-ovpn3",
"configuration": "Release"
},
{
"name": "x64-debug-ossl3-ovpn3",
"configurePreset": "x64-debug-ossl3-ovpn3",
"configuration": "Debug"
},
{
"name": "x64-debug-ossl1.1.1-ovpn3",
"configurePreset": "x64-debug-ossl1.1.1-ovpn3",
"configuration": "Debug"
},
{
"name": "x86-debug-ossl3-ovpn3",
"configurePreset": "x86-debug-ossl3-ovpn3",
"configuration": "Debug"
},
{
"name": "x86-debug-ossl1.1.1-ovpn3",
"configurePreset": "x86-debug-ossl1.1.1-ovpn3",
"configuration": "Debug"
},
{
"name": "arm64-debug-ossl3-ovpn3",
"configurePreset": "arm64-debug-ossl3-ovpn3",
"configuration": "Debug"
},
{
"name": "arm64-debug-ossl1.1.1-ovpn3",
"configurePreset": "arm64-debug-ossl1.1.1-ovpn3",
"configuration": "Debug"
}
]
}
5 changes: 3 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dist_doc_DATA = \
COPYRIGHT.GPL \
COPYING

AM_CPPFLAGS = $(OPENSSL_CRYPTO_CFLAGS) -D_UNICODE
AM_CPPFLAGS = $(OPENSSL_CRYPTO_CFLAGS) -D_UNICODE $(JSON_CFLAGS)
AM_CFLAGS = -municode

openvpn_gui_RESOURCES = \
Expand Down Expand Up @@ -110,7 +110,8 @@ openvpn_gui_LDADD = \
-lole32 \
-lshlwapi \
-lsecur32 \
-lwininet
-lwininet \
$(JSON_LIBS)

openvpn-gui-res.o: $(openvpn_gui_RESOURCES) $(srcdir)/openvpn-gui-res.h
$(RCCOMPILE) -i $< -o $@
9 changes: 9 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ AC_ARG_ENABLE(
[enable_password_change="yes"]
)

AC_ARG_ENABLE(
[ovpn3],
[AS_HELP_STRING([--enable-ovpn3], [enable openvpn3 agent and client @<:@default=no@:>@])],
[
AC_DEFINE([ENABLE_OVPN3], 1, [Use openvpn3 agent instead of interactive service])
PKG_CHECK_MODULES([JSON], [json-c])
]
)

case "$host" in
*-mingw*)
CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN"
Expand Down
1 change: 1 addition & 0 deletions manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ OnManagement(SOCKET sk, LPARAM lParam)
{
ManagementCommand(c, c->manage.password, NULL, regular);
*c->manage.password = '\0';

continue;
}

Expand Down
3 changes: 3 additions & 0 deletions openvpn-gui-res.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@
#define ID_EDT_MGMT_PORT 285
#define ID_TXT_FOLDER1 286
#define ID_EDT_POPUP_MUTE 287
#define ID_RB_ENGINE_SELECTION 288
#define ID_RB_ENGINE_OVPN2 289
#define ID_RB_ENGINE_OVPN3 290

/* Connections dialog */
#define ID_DLG_CONNECTIONS 290
Expand Down
Loading