[Openvpn-devel] [L] Change in openvpn[master]: Manually reformat some long trailing comments
Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/792?usp=email to review the following change. Change subject: Manually reformat some long trailing comments .. Manually reformat some long trailing comments When trying to reformat the code with a formatter that actually checks line-lengths, these never come out nice otherwise. Change-Id: I7f0ba2261b61f6eed511cbd8bb2e880d774d1365 Signed-off-by: Frank Lichtenheld --- M sample/sample-plugins/simple/base64.c M src/openvpn/comp.h M src/openvpn/errlevel.h M src/openvpn/fragment.h M src/openvpn/init.c M src/openvpn/manage.c M src/openvpn/misc.h M src/openvpn/options.c M src/openvpn/ssl_common.h 9 files changed, 152 insertions(+), 134 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/92/792/12 diff --git a/sample/sample-plugins/simple/base64.c b/sample/sample-plugins/simple/base64.c index 291f9e1..3a09eb5 100644 --- a/sample/sample-plugins/simple/base64.c +++ b/sample/sample-plugins/simple/base64.c @@ -31,10 +31,14 @@ #define PLUGIN_NAME "base64.c" /* Exported plug-in v3 API functions */ -plugin_log_t ovpn_log = NULL; /**< Pointer to the OpenVPN log function. See plugin_log() */ -plugin_vlog_t ovpn_vlog = NULL;/**< Pointer to the OpenVPN vlog function. See plugin_vlog() */ -plugin_base64_encode_t ovpn_base64_encode = NULL; /**< Pointer to the openvpn_base64_encode () function */ -plugin_base64_decode_t ovpn_base64_decode = NULL; /**< Pointer to the openvpn_base64_decode () function */ +/** Pointer to the OpenVPN log function. See plugin_log() */ +plugin_log_t ovpn_log = NULL; +/** Pointer to the OpenVPN vlog function. See plugin_vlog() */ +plugin_vlog_t ovpn_vlog = NULL; +/** Pointer to the openvpn_base64_encode () function */ +plugin_base64_encode_t ovpn_base64_encode = NULL; +/** Pointer to the openvpn_base64_decode () function */ +plugin_base64_decode_t ovpn_base64_decode = NULL; /** * Search the environment pointer for a specific env var name diff --git a/src/openvpn/comp.h b/src/openvpn/comp.h index 7eed331..f9f9598 100644 --- a/src/openvpn/comp.h +++ b/src/openvpn/comp.h @@ -36,20 +36,27 @@ #define COMP_F_ADAPTIVE (1<<0) / * COMP_ALG_LZO only * / #define COMP_F_ALLOW_COMPRESS (1<<1) / * not only incoming is compressed but also outgoing * / */ -#define COMP_F_SWAP (1<<2) /* initial command byte is swapped with last byte in buffer to preserve payload alignment */ -#define COMP_F_ADVERTISE_STUBS_ONLY (1<<3) /* tell server that we only support compression stubs */ -#define COMP_F_ALLOW_STUB_ONLY (1<<4) /* Only accept stub compression, even with COMP_F_ADVERTISE_STUBS_ONLY -* we still accept other compressions to be pushed */ -#define COMP_F_MIGRATE (1<<5) /* push stub-v2 or comp-lzo no when we see a client with comp-lzo in occ */ -#define COMP_F_ALLOW_ASYM (1<<6) /* Compression was explicitly set to allow asymetric compression */ -#define COMP_F_ALLOW_NOCOMP_ONLY(1<<7) /* Do not allow compression framing (breaks DCO) */ +/** initial command byte is swapped with last byte in buffer to preserve payload alignment */ +#define COMP_F_SWAP (1<<2) +/** tell server that we only support compression stubs */ +#define COMP_F_ADVERTISE_STUBS_ONLY (1<<3) +/** Only accept stub compression, even with COMP_F_ADVERTISE_STUBS_ONLY + * we still accept other compressions to be pushed */ +#define COMP_F_ALLOW_STUB_ONLY (1<<4) +/** push stub-v2 or comp-lzo no when we see a client with comp-lzo in occ */ +#define COMP_F_MIGRATE (1<<5) +/** Compression was explicitly set to allow asymetric compression */ +#define COMP_F_ALLOW_ASYM (1<<6) +/** Do not allow compression framing (breaks DCO) */ +#define COMP_F_ALLOW_NOCOMP_ONLY(1<<7) /* algorithms */ #define COMP_ALG_UNDEF 0 -#define COMP_ALG_STUB 1 /* support compression command byte and framing without actual compression */ -#define COMP_ALG_LZO2 /* LZO algorithm */ -#define COMP_ALG_SNAPPY 3 /* Snappy algorithm (no longer supported) */ -#define COMP_ALG_LZ44 /* LZ4 algorithm */ +/** support compression command byte and framing without actual compression */ +#define COMP_ALG_STUB 1 +#define COMP_ALG_LZO2 /**< LZO algorithm */ +#define COMP_ALG_SNAPPY 3 /**< Snappy algorithm (no longer supported) */ +#define COMP_ALG_LZ44 /**< LZ4 algorithm */ /* algorithm v2 */ @@ -106,7 +113,8 @@ #define LZO_COMPRESS_BYTE 0x66 #define LZ4_COMPRESS_BYTE 0x69 #define NO_COMPRESS_BYTE 0xFA -#define NO_COMPRESS_BYTE_SWAP 0xFB /* to maintain payload alignment, replace this byte with last byte of packet */ +/** to maintain payload alignment, replace this byte with last byte of packet */
[Openvpn-devel] [S] Change in openvpn[master]: Post tchar.h removal cleanup
Attention is currently required from: flichtenheld, plaisthos, stipa. cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/854?usp=email ) Change subject: Post tchar.h removal cleanup .. Patch Set 4: Code-Review+2 -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/854?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ib3a166ead912beb2a591105c84d96d342664c05f Gerrit-Change-Number: 854 Gerrit-PatchSet: 4 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-Reviewer: stipa Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-Attention: stipa Gerrit-Comment-Date: Wed, 19 Mar 2025 14:22:11 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [PATCH v4] Post tchar.h removal cleanup
From: Frank Lichtenheld Remove some unused defines. Change-Id: Ib3a166ead912beb2a591105c84d96d342664c05f Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/854 This mail reflects revision 4 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpnserv/service.h b/src/openvpnserv/service.h index b2b706b..7112f26 100644 --- a/src/openvpnserv/service.h +++ b/src/openvpnserv/service.h @@ -24,11 +24,6 @@ #ifndef _SERVICE_H #define _SERVICE_H -/* We do not support non-unicode builds */ -#ifndef UNICODE -#define UNICODE -#endif - #ifdef HAVE_CONFIG_H #include "config.h" #endif diff --git a/src/tapctl/basic.h b/src/tapctl/basic.h index ca5c6d4..49a3cf6 100644 --- a/src/tapctl/basic.h +++ b/src/tapctl/basic.h @@ -22,13 +22,11 @@ #ifndef BASIC_H #define BASIC_H -#ifdef _UNICODE -#define PRIsLPWSTR "ls" -#define PRIsLPOLESTR"ls" -#else -#define PRIsLPWSTR "s" -#define PRIsLPOLESTR"ls" +/* We do not support non-unicode builds */ +#ifndef UNICODE +#define UNICODE #endif + #define PRIXGUID "{%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}" #define PRIGUID_PARAM(g) \ (g).Data1, (g).Data2, (g).Data3, (g).Data4[0], (g).Data4[1], (g).Data4[2], (g).Data4[3], (g).Data4[4], (g).Data4[5], (g).Data4[6], (g).Data4[7] ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [M] Change in openvpn[master]: Define a .clang-format file for the project
Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/790?usp=email to review the following change. Change subject: Define a .clang-format file for the project .. Define a .clang-format file for the project Each of these statements has been reviewed but not all of them are obvious. Also add a pre-commit config to easily check the formatting. Change-Id: I40f6af10c5ee2f5aed4185d783fc622a2e3c19ff Signed-off-by: Frank Lichtenheld --- A .clang-format A .pre-commit-config.yaml 2 files changed, 54 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/90/790/9 diff --git a/.clang-format b/.clang-format new file mode 100644 index 000..0960fe7 --- /dev/null +++ b/.clang-format @@ -0,0 +1,46 @@ +--- +BasedOnStyle: Mozilla +AccessModifierOffset: '-4' +AlignAfterOpenBracket: Align +AlignConsecutiveMacros: + Enabled: true + AcrossEmptyLines: false + AcrossComments: true +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: + Kind: Always + OverEmptyLines: 1 +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: None +BreakBeforeBinaryOperators: NonAssignment +BreakBeforeBraces: Allman +BreakBeforeTernaryOperators: true +BreakStringLiterals: false +ColumnLimit: '100' +ContinuationIndentWidth: '4' +DerivePointerAlignment: false +IndentCaseLabels: true +IndentGotoLabels: false +IndentWidth: '4' +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +Language: Cpp +MaxEmptyLinesToKeep: '2' +PointerAlignment: Right +ReflowComments: true +SortIncludes: false +SpaceAfterCStyleCast: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpacesBeforeTrailingComments: '2' +SpacesInParens: Never +TabWidth: '4' +TypeNames: [DWORD] +UseTab: Never +WhitespaceSensitiveMacros: [_STRINGIFY] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000..0f09a06 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +repos: + - repo: https://github.com/pre-commit/mirrors-clang-format +rev: 'v19.1.4' +hooks: + - id: clang-format +files: \.[ch]$ +# preserve upstream formatting +exclude: ^(src/compat/compat-lz4\.[ch]|src/openvpn/ovpn_dco_(linux|win)\.h)$ -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/790?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I40f6af10c5ee2f5aed4185d783fc622a2e3c19ff Gerrit-Change-Number: 790 Gerrit-PatchSet: 9 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-MessageType: newchange ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [L] Change in openvpn[master]: dns: apply settings via script on unixoid systems
Attention is currently required from: cron2, flichtenheld, plaisthos. Hello cron2, flichtenheld, plaisthos, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/838?usp=email to look at the new patch set (#16). The following approvals got outdated and were removed: Code-Review-1 by cron2 Change subject: dns: apply settings via script on unixoid systems .. dns: apply settings via script on unixoid systems This introduces a new script hook, the dns-updown, and implements such a command script for a few popular systems (and a default for the not so popular ones). Like the name suggests this hook is soleley for dealing with modifying how names are resolved when the VPN pushes some --dns settings. The default dns updown command is part of the distribution and is installed with openvpn. You can change the path the command is located at as a compile time option, defaults to libexecdir. You can disable the dns-updown hook at compile time by passing --disable-dns-updown to configure or ccmake ENABLE_DNS_UPDOWN to OFF. There's also a new runtime option --dns-updown, which can run a custom command or disable execution of it altogether. Change-Id: Ifbe4ffb44d3bfcaa50adb38cacb3436fcdc71b10 Signed-off-by: Heiko Hund --- M .gitignore M CMakeLists.txt M config.h.cmake.in M configure.ac M distro/Makefile.am A distro/dns-scripts/Makefile.am A distro/dns-scripts/haikuos_file-dns-updown.sh A distro/dns-scripts/openresolv-dns-updown.sh A distro/dns-scripts/resolvconf_file-dns-updown.sh A distro/dns-scripts/systemd-dns-updown.sh M doc/man-sections/script-options.rst M src/openvpn/Makefile.am M src/openvpn/dns.c M src/openvpn/dns.h M src/openvpn/options.c 15 files changed, 647 insertions(+), 9 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/38/838/16 diff --git a/.gitignore b/.gitignore index db8bb73..04523af 100644 --- a/.gitignore +++ b/.gitignore @@ -49,6 +49,7 @@ /doc/doxygen/latex/ /doc/doxygen/openvpn.doxyfile distro/systemd/*.service +distro/dns-scripts/dns-updown sample/sample-keys/sample-ca/ vendor/cmocka_build vendor/dist diff --git a/CMakeLists.txt b/CMakeLists.txt index b04adce..adf6e26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,10 @@ option(USE_WERROR "Treat compiler warnings as errors (-Werror)" ON) option(FAKE_ANDROID "Target Android but do not use actual cross compile/Android cmake to build for simple compile checks on Linux") -set(PLUGIN_DIR /usr/local/lib/openvpn/plugins CACHE FILEPATH "Location of the plugin directory") +option(ENABLE_DNS_UPDOWN "BUILD with --dns-updown support" ON) +set(DNS_UPDOWN_PATH "${CMAKE_INSTALL_PREFIX}/libexec/openvpn/dns-updown" CACHE STRING "Default location for the DNS up/down script") + +set(PLUGIN_DIR "${CMAKE_INSTALL_PREFIX}/lib/openvpn/plugins" CACHE FILEPATH "Location of the plugin directory") # Create machine readable compile commands option(ENABLE_COMPILE_COMMANDS "Generate compile_commands.json and a symlink for clangd to find it" OFF) @@ -577,6 +580,8 @@ add_library_deps(openvpn) +target_compile_options(openvpn PRIVATE -DDNS_UPDOWN_PATH=\"${DNS_UPDOWN_PATH}\") + if(MINGW) target_compile_options(openvpn PRIVATE -municode -UUNICODE) target_link_options(openvpn PRIVATE -municode) diff --git a/config.h.cmake.in b/config.h.cmake.in index 2f7b43d..5164ce3 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -35,6 +35,9 @@ /* Enable LZO compression library */ #cmakedefine ENABLE_LZO +/* Enable dns-updown script hook */ +#cmakedefine ENABLE_DNS_UPDOWN + /* Enable NTLMv2 proxy support */ #define ENABLE_NTLM 1 diff --git a/configure.ac b/configure.ac index 9777e36..17565ea 100644 --- a/configure.ac +++ b/configure.ac @@ -96,6 +96,13 @@ ) AC_ARG_ENABLE( + [dns-updown], + [AS_HELP_STRING([--disable-dns-updown], [disable the --dns-updown hook @<:@default=no@:>@])], + , + [enable_dns_updown="yes"] +) + +AC_ARG_ENABLE( [ntlm], [AS_HELP_STRING([--disable-ntlm], [disable NTLMv2 proxy support @<:@default=yes@:>@])], , @@ -315,37 +322,50 @@ plugindir="\${libdir}/openvpn/plugins" fi +AC_ARG_VAR([SCRIPTDIR], [Path of script directory @<:@default=PKGLIBEXECDIR@:>@]) +if test -n "${SCRIPTDIR}"; then + scriptdir="${SCRIPTDIR}" +else + scriptdir="\${pkglibexecdir}" +fi + AC_DEFINE_UNQUOTED([TARGET_ALIAS], ["${host}"], [A string representing our host]) -AM_CONDITIONAL([TARGET_LINUX], [false]) +AM_CONDITIONAL([ENABLE_DNS_UPDOWN],[true]) case "$host" in *-*-linux*) AC_DEFINE([TARGET_LINUX], [1], [Are we running on Linux?]) - AM_CONDITIONAL([TARGET_LINUX], [true]) AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["L"], [Target prefix]) + AC_SUBST([DNS_UPDOWN_TYPE], ["systemd"]) have_sitnl="yes" pkg_config_required="yes"
[Openvpn-devel] [L] Change in openvpn[master]: dns: apply settings via script on unixoid systems
Attention is currently required from: cron2, flichtenheld, plaisthos. d12fk has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/838?usp=email ) Change subject: dns: apply settings via script on unixoid systems .. Patch Set 15: (3 comments) File CMakeLists.txt: http://gerrit.openvpn.net/c/openvpn/+/838/comment/46a4965c_d67b6a1d : PS15, Line 582: > does this need some sort of magic to enable `-DENABLE_DNS_UPDOWN`? Now you can disable the feature with ccmake or `-DENABLE_DNS_UPDOWN=ON`, just like the others. File src/openvpn/options.c: http://gerrit.openvpn.net/c/openvpn/+/838/comment/929d0d87_38955934 : PS15, Line 926: #ifdef ENABLE_DNS_SCRIPT > should that be ENABLE_DNS_UPDOWN? Done http://gerrit.openvpn.net/c/openvpn/+/838/comment/b0363c3c_449e72d0 : PS15, Line 8227: #ifdef ENABLE_DNS_SCRIPT > same here Done -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/838?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ifbe4ffb44d3bfcaa50adb38cacb3436fcdc71b10 Gerrit-Change-Number: 838 Gerrit-PatchSet: 15 Gerrit-Owner: d12fk Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: cron2 Gerrit-Attention: flichtenheld Gerrit-Comment-Date: Wed, 19 Mar 2025 22:45:28 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: cron2 Gerrit-MessageType: comment ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [XL] Change in openvpn[master]: win: implement --dns option support with NRPT
Attention is currently required from: plaisthos, stipa. d12fk has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/837?usp=email ) Change subject: win: implement --dns option support with NRPT .. Patch Set 13: (2 comments) File src/openvpnserv/interactive.c: http://gerrit.openvpn.net/c/openvpn/+/837/comment/b96c8df4_7beb686c : PS13, Line 2602: free(wide_domains); > If domains is not set, we're freeing stack-allocated wide_domains (PWSTR > wide_domains = L".\0";). Done http://gerrit.openvpn.net/c/openvpn/+/837/comment/8eed4464_e3ea759f : PS13, Line 2782: DWORD iid_err = InterfaceIdString(msg->iface.name, iid, sizeof(iid)); > We pass sizeof(iid) as count to wcsncpy and it should be count of wide chars, > not the buffer size. […] Done -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/837?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I576e74f3276362606e9cbd50bb5adbebaaf209cc Gerrit-Change-Number: 837 Gerrit-PatchSet: 13 Gerrit-Owner: d12fk Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-Reviewer: stipa Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: stipa Gerrit-Comment-Date: Wed, 19 Mar 2025 22:45:41 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: stipa Gerrit-MessageType: comment ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [XS] Change in openvpn[master]: socket: use remote proto when creating client sockets
Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/911?usp=email to review the following change. Change subject: socket: use remote proto when creating client sockets .. socket: use remote proto when creating client sockets When creating a socket to connect to a remote (this happens in client mode) always use the protocol specified for the remote. The listening protocol in this case is just ignored as it does not make any sense. Change-Id: I6d2ec69ac7a9ef5900d8f1d8541d6a19c9cb7df9 Signed-off-by: Antonio Quartulli --- M src/openvpn/socket.c 1 file changed, 5 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/11/911/1 diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 6b32e30..ad97830 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -1886,6 +1886,11 @@ const char *remote_host = o->ce.remote; const char *remote_port = o->ce.remote_port; +if (remote_host) +{ +proto = o->ce.proto; +} + if (c->mode == CM_CHILD_TCP || c->mode == CM_CHILD_UDP) { struct link_socket *tmp_sock = NULL; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/911?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I6d2ec69ac7a9ef5900d8f1d8541d6a19c9cb7df9 Gerrit-Change-Number: 911 Gerrit-PatchSet: 1 Gerrit-Owner: ordex Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [M] Change in openvpn[master]: dns: don't publish env vars to non-dns scripts
Attention is currently required from: cron2, d12fk, flichtenheld, plaisthos. Hello cron2, flichtenheld, plaisthos, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/840?usp=email to look at the new patch set (#17). Change subject: dns: don't publish env vars to non-dns scripts .. dns: don't publish env vars to non-dns scripts With --dns-updown in place we no longer need --dns option related vars in the environment for other script hooks. Code for doing that is removed and the function to set --dns stuff made static, for internal use only. Change-Id: I3fb01ab76cf3df0874ba92e08f371d17607a8369 Signed-off-by: Heiko Hund --- M src/openvpn/dns.c M src/openvpn/dns.h M src/openvpn/options.c 3 files changed, 87 insertions(+), 101 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/40/840/17 diff --git a/src/openvpn/dns.c b/src/openvpn/dns.c index b45c290..0ad8e44 100644 --- a/src/openvpn/dns.c +++ b/src/openvpn/dns.c @@ -350,93 +350,6 @@ } } -static void -setenv_dns_option(struct env_set *es, - const char *format, int i, int j, - const char *value) -{ -char name[64]; -bool name_ok = false; - -if (j < 0) -{ -name_ok = snprintf(name, sizeof(name), format, i); -} -else -{ -name_ok = snprintf(name, sizeof(name), format, i, j); -} - -if (!name_ok) -{ -msg(M_WARN, "WARNING: dns option setenv name buffer overflow"); -} - -setenv_str(es, name, value); -} - -void -setenv_dns_options(const struct dns_options *o, struct env_set *es) -{ -struct gc_arena gc = gc_new(); -const struct dns_server *s; -const struct dns_domain *d; -int i, j; - -for (i = 1, d = o->search_domains; d != NULL; i++, d = d->next) -{ -setenv_dns_option(es, "dns_search_domain_%d", i, -1, d->name); -} - -for (i = 1, s = o->servers; s != NULL; i++, s = s->next) -{ -for (j = 0; j < s->addr_count; ++j) -{ -if (s->addr[j].family == AF_INET) -{ -setenv_dns_option(es, "dns_server_%d_address_%d", i, j + 1, - print_in_addr_t(s->addr[j].in.a4.s_addr, IA_NET_ORDER, &gc)); -} -else -{ -setenv_dns_option(es, "dns_server_%d_address_%d", i, j + 1, - print_in6_addr(s->addr[j].in.a6, 0, &gc)); -} -if (s->addr[j].port) -{ -setenv_dns_option(es, "dns_server_%d_port_%d", i, j + 1, - print_in_port_t(s->addr[j].port, &gc)); -} -} - -if (s->domains) -{ -for (j = 1, d = s->domains; d != NULL; j++, d = d->next) -{ -setenv_dns_option(es, "dns_server_%d_resolve_domain_%d", i, j, d->name); -} -} - -if (s->dnssec) -{ -setenv_dns_option(es, "dns_server_%d_dnssec", i, -1, - dnssec_value(s->dnssec)); -} - -if (s->transport) -{ -setenv_dns_option(es, "dns_server_%d_transport", i, -1, - transport_value(s->transport)); -} -if (s->sni) -{ -setenv_dns_option(es, "dns_server_%d_sni", i, -1, s->sni); -} -} - -gc_free(&gc); -} - #ifdef _WIN32 static void @@ -554,6 +467,93 @@ #else /* ifdef _WIN32 */ static void +setenv_dns_option(struct env_set *es, + const char *format, int i, int j, + const char *value) +{ +char name[64]; +bool name_ok = false; + +if (j < 0) +{ +name_ok = snprintf(name, sizeof(name), format, i); +} +else +{ +name_ok = snprintf(name, sizeof(name), format, i, j); +} + +if (!name_ok) +{ +msg(M_WARN, "WARNING: dns option setenv name buffer overflow"); +} + +setenv_str(es, name, value); +} + +static void +setenv_dns_options(const struct dns_options *o, struct env_set *es) +{ +struct gc_arena gc = gc_new(); +const struct dns_server *s; +const struct dns_domain *d; +int i, j; + +for (i = 1, d = o->search_domains; d != NULL; i++, d = d->next) +{ +setenv_dns_option(es, "dns_search_domain_%d", i, -1, d->name); +} + +for (i = 1, s = o->servers; s != NULL; i++, s = s->next) +{ +for (j = 0; j < s->addr_count; ++j) +{ +if (s->addr[j].family == AF_INET) +{ +setenv_dns_option(es, "dns_server_%d_address_%d", i, j + 1, + print_in_addr_t(s->addr[j].in.a4.s_addr, IA_NET_ORDER, &gc)); +} +else +{ +setenv_dns_option(es, "dns_server_%d_address_%d", i, j + 1, +
[Openvpn-devel] [L] Change in openvpn[master]: Remove uncrustify config and scripts, switch GHA
Attention is currently required from: plaisthos. flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/830?usp=email ) Change subject: Remove uncrustify config and scripts, switch GHA .. Set Ready For Review -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/830?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I15d4946800cbfaead67a73450ff3b12193814e54 Gerrit-Change-Number: 830 Gerrit-PatchSet: 3 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Comment-Date: Wed, 19 Mar 2025 14:31:40 + Gerrit-HasComments: No Gerrit-Has-Labels: No Gerrit-MessageType: comment ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [S] Change in openvpn[master]: Post tchar.h removal cleanup
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/854?usp=email ) Change subject: Post tchar.h removal cleanup .. Post tchar.h removal cleanup Remove some unused defines. Change-Id: Ib3a166ead912beb2a591105c84d96d342664c05f Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Message-Id: <20250319142234.25046-1-g...@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31172.html Signed-off-by: Gert Doering --- M src/openvpnserv/service.h M src/tapctl/basic.h 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/openvpnserv/service.h b/src/openvpnserv/service.h index b2b706b..7112f26 100644 --- a/src/openvpnserv/service.h +++ b/src/openvpnserv/service.h @@ -24,11 +24,6 @@ #ifndef _SERVICE_H #define _SERVICE_H -/* We do not support non-unicode builds */ -#ifndef UNICODE -#define UNICODE -#endif - #ifdef HAVE_CONFIG_H #include "config.h" #endif diff --git a/src/tapctl/basic.h b/src/tapctl/basic.h index ca5c6d4..49a3cf6 100644 --- a/src/tapctl/basic.h +++ b/src/tapctl/basic.h @@ -22,13 +22,11 @@ #ifndef BASIC_H #define BASIC_H -#ifdef _UNICODE -#define PRIsLPWSTR "ls" -#define PRIsLPOLESTR"ls" -#else -#define PRIsLPWSTR "s" -#define PRIsLPOLESTR"ls" +/* We do not support non-unicode builds */ +#ifndef UNICODE +#define UNICODE #endif + #define PRIXGUID "{%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}" #define PRIGUID_PARAM(g) \ (g).Data1, (g).Data2, (g).Data3, (g).Data4[0], (g).Data4[1], (g).Data4[2], (g).Data4[3], (g).Data4[4], (g).Data4[5], (g).Data4[6], (g).Data4[7] -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/854?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ib3a166ead912beb2a591105c84d96d342664c05f Gerrit-Change-Number: 854 Gerrit-PatchSet: 5 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-Reviewer: stipa Gerrit-CC: openvpn-devel Gerrit-MessageType: merged ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [S] Change in openvpn[master]: Post tchar.h removal cleanup
cron2 has uploaded a new patch set (#5) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/854?usp=email ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: Post tchar.h removal cleanup .. Post tchar.h removal cleanup Remove some unused defines. Change-Id: Ib3a166ead912beb2a591105c84d96d342664c05f Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Message-Id: <20250319142234.25046-1-g...@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31172.html Signed-off-by: Gert Doering --- M src/openvpnserv/service.h M src/tapctl/basic.h 2 files changed, 4 insertions(+), 11 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/54/854/5 diff --git a/src/openvpnserv/service.h b/src/openvpnserv/service.h index b2b706b..7112f26 100644 --- a/src/openvpnserv/service.h +++ b/src/openvpnserv/service.h @@ -24,11 +24,6 @@ #ifndef _SERVICE_H #define _SERVICE_H -/* We do not support non-unicode builds */ -#ifndef UNICODE -#define UNICODE -#endif - #ifdef HAVE_CONFIG_H #include "config.h" #endif diff --git a/src/tapctl/basic.h b/src/tapctl/basic.h index ca5c6d4..49a3cf6 100644 --- a/src/tapctl/basic.h +++ b/src/tapctl/basic.h @@ -22,13 +22,11 @@ #ifndef BASIC_H #define BASIC_H -#ifdef _UNICODE -#define PRIsLPWSTR "ls" -#define PRIsLPOLESTR"ls" -#else -#define PRIsLPWSTR "s" -#define PRIsLPOLESTR"ls" +/* We do not support non-unicode builds */ +#ifndef UNICODE +#define UNICODE #endif + #define PRIXGUID "{%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}" #define PRIGUID_PARAM(g) \ (g).Data1, (g).Data2, (g).Data3, (g).Data4[0], (g).Data4[1], (g).Data4[2], (g).Data4[3], (g).Data4[4], (g).Data4[5], (g).Data4[6], (g).Data4[7] -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/854?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ib3a166ead912beb2a591105c84d96d342664c05f Gerrit-Change-Number: 854 Gerrit-PatchSet: 5 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-Reviewer: stipa Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [PATCH applied] Re: Post tchar.h removal cleanup
"Clean up the rest" - it looks a bit confusing at first, why the UNICODE stuff is removed from service.h - but that's just because "everything!" includes ../tapctl/basic.h, including service.h Your patch has been applied to the master branch. commit 6bb20fa8bebc29d8b3103662ffba4904d03e852d Author: Frank Lichtenheld Date: Wed Mar 19 15:22:24 2025 +0100 Post tchar.h removal cleanup Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Message-Id: <20250319142234.25046-1-g...@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31172.html Signed-off-by: Gert Doering -- kind regards, Gert Doering ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [XL] Change in openvpn[master]: win: implement --dns option support with NRPT
Attention is currently required from: d12fk, plaisthos. stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/837?usp=email ) Change subject: win: implement --dns option support with NRPT .. Patch Set 13: Code-Review-2 (2 comments) File src/openvpnserv/interactive.c: http://gerrit.openvpn.net/c/openvpn/+/837/comment/527430f0_4471f7d6 : PS13, Line 2602: free(wide_domains); If domains is not set, we're freeing stack-allocated wide_domains (PWSTR wide_domains = L".\0";). http://gerrit.openvpn.net/c/openvpn/+/837/comment/828a5a05_4a81dca3 : PS13, Line 2782: DWORD iid_err = InterfaceIdString(msg->iface.name, iid, sizeof(iid)); We pass sizeof(iid) as count to wcsncpy and it should be count of wide chars, not the buffer size. This causes crash. -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/837?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I576e74f3276362606e9cbd50bb5adbebaaf209cc Gerrit-Change-Number: 837 Gerrit-PatchSet: 13 Gerrit-Owner: d12fk Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-Reviewer: stipa Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: d12fk Gerrit-Comment-Date: Wed, 19 Mar 2025 13:58:01 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [L] Change in openvpn[master]: Remove uncrustify config and scripts, switch GHA
Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/830?usp=email to review the following change. Change subject: Remove uncrustify config and scripts, switch GHA .. Remove uncrustify config and scripts, switch GHA Replaced with clang-format and pre-commit. Change-Id: I15d4946800cbfaead67a73450ff3b12193814e54 Signed-off-by: Frank Lichtenheld --- M .github/workflows/build.yaml D dev-tools/git-pre-commit-uncrustify.sh D dev-tools/reformat-all.sh D dev-tools/special-files.lst D dev-tools/uncrustify.conf 5 files changed, 12 insertions(+), 402 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/30/830/3 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b1af7ec..b33e0ce 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -5,35 +5,26 @@ pull_request: jobs: - checkuncrustify: -name: "Check code style with Uncrustify" -# Ubuntu 22.04 has uncrustify 0.72_f -runs-on: ubuntu-22.04 + clang-format: +name: Check code style with clang-format +runs-on: ubuntu-24.04 steps: - name: Install dependencies -run: sudo apt update && sudo apt install -y uncrustify +run: | + sudo apt update && sudo apt install -y python3-pip + pip3 install pre-commit - name: Checkout OpenVPN uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 -with: - path: openvpn - - name: Show uncrustify version -run: uncrustify --version - - name: Run uncrustify -run: ./dev-tools/reformat-all.sh -working-directory: openvpn + - name: Run clang-format +run: pre-commit run -a --show-diff-on-failure || true - name: Check for changes -run: git diff --output=uncrustify-changes.patch -working-directory: openvpn - - name: Show changes on standard output -run: git diff -working-directory: openvpn +run: git diff --output=format-changes.patch - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 with: - name: uncrustify-changes.patch - path: 'openvpn/uncrustify-changes.patch' + name: format-changes.patch + path: format-changes.patch - name: Set job status -run: test ! -s uncrustify-changes.patch -working-directory: openvpn +run: test ! -s format-changes.patch android: strategy: diff --git a/dev-tools/git-pre-commit-uncrustify.sh b/dev-tools/git-pre-commit-uncrustify.sh deleted file mode 100755 index 9851c21..000 --- a/dev-tools/git-pre-commit-uncrustify.sh +++ /dev/null @@ -1,161 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2015, David Martin -# 2022, Heiko Hund -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -# git pre-commit hook that runs an Uncrustify stylecheck. -# Features: -# - abort commit when commit does not comply with the style guidelines -# - create a patch of the proposed style changes -# -# More info on Uncrustify: http://uncrustify.sourceforge.net/ - -# This file was taken from a set of unofficial pre-commit hooks available -# at https://github.com/avidmartin/Pre-commit-hooks and modified to -# fit the openvpn project's needs - -# exit on error -set -e - - -# If called so, install this script as pre-commit hook -if [ "$1" = "install" ] ; then -TARGET="$(git rev-parse --git-path hooks)/pre-commit" - -if [ -e "$TARGET" ] ; then -printf "$TARGET file exists. Won't over
[Openvpn-devel] [L] Change in openvpn[master]: dns: apply settings via script on unixoid systems
Attention is currently required from: d12fk, flichtenheld, plaisthos. cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/838?usp=email ) Change subject: dns: apply settings via script on unixoid systems .. Patch Set 15: Code-Review-1 (4 comments) Patchset: PS15: Overall it looks good, but I'm afraid the change from ENABLE_DNS_SCRIPT to ENABLE_DNS_UPDOWN broke options.c File CMakeLists.txt: http://gerrit.openvpn.net/c/openvpn/+/838/comment/4b69602a_38fa67d4 : PS15, Line 582: does this need some sort of magic to enable `-DENABLE_DNS_UPDOWN`? File src/openvpn/options.c: http://gerrit.openvpn.net/c/openvpn/+/838/comment/f473ebac_d6d18ad0 : PS15, Line 926: #ifdef ENABLE_DNS_SCRIPT should that be ENABLE_DNS_UPDOWN? http://gerrit.openvpn.net/c/openvpn/+/838/comment/de0f1212_6e2780f2 : PS15, Line 8227: #ifdef ENABLE_DNS_SCRIPT same here -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/838?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ifbe4ffb44d3bfcaa50adb38cacb3436fcdc71b10 Gerrit-Change-Number: 838 Gerrit-PatchSet: 15 Gerrit-Owner: d12fk Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-Attention: d12fk Gerrit-Comment-Date: Wed, 19 Mar 2025 14:41:16 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel