]> git.ipfire.org Git - thirdparty/openvpn.git/log
thirdparty/openvpn.git
3 weeks agoPUSH_UPDATE server: bug-fix, reset buffer after processing
Marco Baffo [Fri, 10 Oct 2025 14:19:56 +0000 (16:19 +0200)] 
PUSH_UPDATE server: bug-fix, reset buffer after processing

In the send_single_push_update() function the buffer containing
the message was not reset after processing, so o in a push-update-broad
the messages sent starting from the second client would have been
shrunk (offset advanced and size decreased).

Change-Id: I41d08a9a2e79ac1f1104e72dd5b7b7617e2071a0
Signed-off-by: Marco Baffo <marco@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1264
Message-Id: <20251010142002.27308-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59244933/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agosocks: Fix conversion warnings with MinGW
Frank Lichtenheld [Fri, 10 Oct 2025 09:57:00 +0000 (11:57 +0200)] 
socks: Fix conversion warnings with MinGW

The winsock2 APIs are a bit weird at times...

Change-Id: I977bab08cb614c2d59c34ceebc112f3add9bd168
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1262
Message-Id: <20251010095706.3779-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59244802/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoconsole: Simplify query_user_add interface
Frank Lichtenheld [Fri, 10 Oct 2025 09:47:44 +0000 (11:47 +0200)] 
console: Simplify query_user_add interface

- Removes unused field prompt_len
- Change field reponse_len to int since that
  is what the code actually expects. Most callers
  user a constant either way.

Change-Id: I04542e678f81d5d4a853b4370d9b8adc4dac1212
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1216
Message-Id: <20251010094753.2825-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59244794/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agooptions: Review use of positive_atoi vs atoi_constrained
Frank Lichtenheld [Thu, 9 Oct 2025 20:59:46 +0000 (22:59 +0200)] 
options: Review use of positive_atoi vs atoi_constrained

Replace where it is useful.

While here also add a missing cast in atoi_constrained.

Change-Id: Id440917f433aab1a7db608ba04fa95ba47c2ddde
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1153
Message-Id: <20251009205951.32301-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59244617/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoFix PIN cache time in test_pkcs11.c
Selva Nair [Fri, 10 Oct 2025 06:39:27 +0000 (08:39 +0200)] 
Fix PIN cache time in test_pkcs11.c

Github: closes OpenVPN/openvpn#861

Change-Id: Ic6fd6ba676b4741da7811ffc7c9688d4673465f8
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1263
Message-Id: <20251010063934.18197-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33306.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoPreserve ifconfig(_ipv6)_local across reconnect
Lev Stipakov [Thu, 9 Oct 2025 17:19:11 +0000 (19:19 +0200)] 
Preserve ifconfig(_ipv6)_local across reconnect

Turns out that ifconfig_(ipv6)_local options are set once
and are not reset on a reconnect.

Consider following scenario:

 - connect first time, server pushes ifconfig-ipv6
 - add a ipv6 network route because ifconfig_ipv6_local is set
 - reconnect, server doesn't push ifconfig-ipv6

Because of ifconfig_ipv6_local is not reset and holds the value
set by the first connect, client adds a ipv6 network route -
but this is wrong, since ipv6 wasn't pushed this time by the server.

Fix by saving/restoring ifconfig(_ipv6)_local in a
struct options_pre_connect along with other options which
preserves the initial values until --pull modifications
are applied.

Github: OpenVPN/openvpn#850
Change-Id: I9b099924286f9bccb6833e1e40606abe72714bbb
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1248
Message-Id: <20251009171916.12811-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59244523/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agooptions_util: Fix conversion warning in atoi_constrained
Frank Lichtenheld [Wed, 8 Oct 2025 17:01:57 +0000 (19:01 +0200)] 
options_util: Fix conversion warning in atoi_constrained

The whole purpose of the function is to make sure
that cast is safe.

Change-Id: Id08524661aa5bcc5cd42f27a1aacc636e2b2b004
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1261
Message-Id: <20251008170202.10333-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59244107/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agolzo: Fix conversion warning
Frank Lichtenheld [Wed, 8 Oct 2025 17:01:44 +0000 (19:01 +0200)] 
lzo: Fix conversion warning

We already have an assert ensuring the value is sane,
so just add the cast.

Change-Id: I4a5c46f321709c83a4a921366630fb8e02834701
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1260
Message-Id: <20251008170149.10301-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59244106/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agotest_options_parse: Remove --wrap
Frank Lichtenheld [Wed, 8 Oct 2025 16:13:52 +0000 (18:13 +0200)] 
test_options_parse: Remove --wrap

After removing --wrap from some other tests in
a previous commit I got confused here myself.
--wrap is really only needed when you have the
original function linked in. Somehow I thought
the call ordering and mocking logic needed this.

But this is wrong, so no need to use --wrap here
since we currently do not link any of those
functions.

Change-Id: I60df1e61ed89be52e9d032b5b49133a784f9811e
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1258
Message-Id: <20251008161357.5679-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59244071/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoproto: Clean up conversion warnings related to checksum macros
Frank Lichtenheld [Fri, 26 Sep 2025 11:17:26 +0000 (13:17 +0200)] 
proto: Clean up conversion warnings related to checksum macros

These should not change any behavior, they mostly clarify
the used types and silence warnings, since these casts are
deliberate.

Change-Id: Ica721a51b00d5314125bcaf5a586e718c5982aef
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: MaxF <max@max-fillinger.net>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1164
Message-Id: <20250926111726.153603-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33218.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agotest_options_parse: Do not use uintmax_t instead of LargestIntegralType
Frank Lichtenheld [Wed, 8 Oct 2025 13:33:31 +0000 (15:33 +0200)] 
test_options_parse: Do not use uintmax_t instead of LargestIntegralType

At least on OpenBSD it seems that uintmax_t maps
to unsigned long long always, but LargestIntegralType
is unsigned long. So if we have a version of cmocka.h
that defines LargestIntegralType then respect that.

Change-Id: I59a49696acd665d43b21e5c23f24b86c15989cd6
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1256
Message-Id: <20251008133338.23652-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243971/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoGHA: Run options_parse test for MinGW
Frank Lichtenheld [Wed, 8 Oct 2025 13:10:54 +0000 (15:10 +0200)] 
GHA: Run options_parse test for MinGW

Github: closes OpenVPN/openvpn#859
Change-Id: I7d9ffdc7d109b3fcbd91543506f16d23000fb136
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1257
Message-Id: <20251008131101.21498-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243956/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agodco-win: support for epoch data channel
Lev Stipakov [Wed, 8 Oct 2025 12:37:51 +0000 (14:37 +0200)] 
dco-win: support for epoch data channel

Starting from 2.8.0, dco-win driver supports epoch data channel.

This commit adds missing userspace part to query DCO drivers for epoch
data format support (always "false" for now for Linux and FreeBSD, true
if Win-DCO driver is 2.8 or later), and pass "CRYPTO_OPTIONS_EPOCH"
flag via a new OVPN_IOCTL_NEW_KEY_V2 ioctl() to windows driver to turn
it on, if negotiated.

Change-Id: Ib5ed5969dcd405a47e34ed8479b7ffaaa5c43080
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1219
Message-Id: <20251008123757.18670-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243920/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agovlan: Remove -Wconversion override
Frank Lichtenheld [Wed, 8 Oct 2025 10:55:01 +0000 (12:55 +0200)] 
vlan: Remove -Wconversion override

Only Debian 11 (GCC 10) complains about this.
We decided not to add work-arounds for GCC 10
and older and instead accept that they do not
build -Werror clean.

Change-Id: I73c46ac630834a8cf8894aaa2dcc429fbedd3db7
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1179
Message-Id: <20251008105507.9997-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33285.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agotest_options_parse: Add test for read_config_string
Frank Lichtenheld [Wed, 8 Oct 2025 10:02:16 +0000 (12:02 +0200)] 
test_options_parse: Add test for read_config_string

The <inlineopt> test discovered the issue
fixed by commit "buffer: Fix buf_parse eating input".

Change-Id: Icb91d9c560b6f78f16571ac3052cc566d94afe99
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1247
Message-Id: <20251008100222.4610-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243809/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agobuffer: Fix buf_parse eating input
Frank Lichtenheld [Wed, 8 Oct 2025 10:29:55 +0000 (12:29 +0200)] 
buffer: Fix buf_parse eating input

When parsing a "line" that is longer than the
available line buffer, then buf_parse was
eating up to 2 characters. It advanced past
them but they were not part of the output.

This can lead to unexpected results if buf_parse
is used in a while loop on unrestricted input,
like e.g. when reading configs (see in_src_get()
used for check_inline_file_via_buf()).

Change-Id: I3724660bf0f8336ee58c172acfb7c4f38e457393
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1246
Message-Id: <20251008103001.7696-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243829/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agotest_options_parse: Start new UT for options_parse.c
Frank Lichtenheld [Wed, 8 Oct 2025 10:10:09 +0000 (12:10 +0200)] 
test_options_parse: Start new UT for options_parse.c

For now contains one test case for parse_line.

Change-Id: I95032d2539d994abf69fc17319ed1a429c3bb948
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1244
Message-Id: <20251008101014.5691-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243816/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agocrypto: Make some casts to int explicit
Frank Lichtenheld [Wed, 8 Oct 2025 09:28:54 +0000 (11:28 +0200)] 
crypto: Make some casts to int explicit

In all of these cases the cast is safe to do
since we have limits imposed in other ways.

And we want those values as int, so no
alternative to casting.

Change-Id: I3b8dd8d5671e31dba2a23a0a78f36d9dda034b88
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1217
Message-Id: <20251008092859.875-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243794/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoPUSH_UPDATE: disabling PUSH_UPDATE server and client if DCO is enabled
Marco Baffo [Wed, 8 Oct 2025 08:30:41 +0000 (10:30 +0200)] 
PUSH_UPDATE: disabling PUSH_UPDATE server and client if DCO is enabled

The PUSH_UPDATE currently doesn't work with DCO.
For example, in server, if a new ifconfig is sent, the DCO
doesn't receive the new peer address and the connection drops.
Similarly in the client when a PUSH_UPDATE is received, the tun is
closed and reopened but the DCO doesn't receive the peer info.

Change-Id: Ibe78949435bb2f26ad68301e2710321bf37c9486
Signed-off-by: Marco Baffo <marco@mandelbit.com>
Acked-by: Antonio Quartulli <antonio@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1245
Message-Id: <20251008083046.27209-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243711/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoDocument that tls-crypt-v2 can be used in connection profile
Steffan Karger [Tue, 7 Oct 2025 20:28:10 +0000 (22:28 +0200)] 
Document that tls-crypt-v2 can be used in connection profile

As reported in https://github.com/OpenVPN/openvpn/issues/795,
tls-crypt-v2 was not documented as an option that was allowed to be used
in <connection> blocks. This is a documentation mistake - it has from
it's introduction been possible to do so.

Verified in the code and tested locally.

Github: closes OpenVPN/openvpn#795
Change-Id: Ie8c6381e66d57e0c1ec31132fad8277e0133283f
Signed-off-by: Steffan Karger <steffan@karger.me>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1254
Message-Id: <20251007202816.27730-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243550/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agounit_tests: Remove useless wrapping for argv/buffer tests
Frank Lichtenheld [Tue, 7 Oct 2025 18:52:09 +0000 (20:52 +0200)] 
unit_tests: Remove useless wrapping for argv/buffer tests

If not using mock() or check_expected(), and
not linking the original function, then there
is no need for wrapping support.

Change-Id: I937105abeb5e8f796bf6bbe8432972adb60b3e2a
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1243
Message-Id: <20251007185217.19381-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243508/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agooptions: Factor out parsing code to separate options_parse.c
Frank Lichtenheld [Tue, 7 Oct 2025 18:51:04 +0000 (20:51 +0200)] 
options: Factor out parsing code to separate options_parse.c

For easier testability. And because everything that
reduces the length of that file in a sensible manner
is a good idea.

Change-Id: I18e38862df1318740928c6cfa21dc4dcd7d44b89
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1242
Message-Id: <20251007185110.19267-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243506/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoAllow route_ipv6_match_host to be used outside of route.c
Arne Schwabe [Tue, 7 Oct 2025 16:08:18 +0000 (18:08 +0200)] 
Allow route_ipv6_match_host to be used outside of route.c

Also adjust style a bit to C99

Change-Id: Ief1495b52ea81cac35d78e40264372d3869423f1
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1191
Message-Id: <20251007160826.4614-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243387/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agositnl: Clean up type handling
Frank Lichtenheld [Tue, 7 Oct 2025 12:27:41 +0000 (14:27 +0200)] 
sitnl: Clean up type handling

- Make some type casts explicit. Due to the types used
  in our networking API and the netlink APIs respectively
  this can't be avoided.
- In many cases just use correct types from the start, e.g.
  where we use constants anyway.

Change-Id: I20205ebd06bbf7cbee8c9be93f399961f5b74fcc
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Antonio Quartulli <antonio@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1251
Message-Id: <20251007122747.16064-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243289/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoCOPYING: Remove licenses for software bundled in the Windows client
Frank Lichtenheld [Tue, 7 Oct 2025 10:48:10 +0000 (12:48 +0200)] 
COPYING: Remove licenses for software bundled in the Windows client

This is wildly outdated:
 - we do not use NSIS or devcon.exe,
 - the OpenSSL license hasn't been updated

In general this file is confusing, since clearly it only
applies to the Windows client. It does not document the
licenses used throughout the source code.

So instead of updating it here, move the duty of documenting
the licenses to the Windows installer build (in
openvpn-build repository).

v2:
 - add back LZO linking exception, this is required for anyone
   who wants to distribute openvpn binaries not just us.

Change-Id: I1aeed74dedf6dd5f559f4eb5cc84645f149ba788
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1249
Message-Id: <20251007104820.7781-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243256/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agodhcp: Fix conversion warnings
Frank Lichtenheld [Mon, 6 Oct 2025 21:01:21 +0000 (23:01 +0200)] 
dhcp: Fix conversion warnings

- Use correct type for pointer difference
- Make sure that small sizeof sum is treated as int

Change-Id: Ie0c0fbf4f7f8b379d46b6755c4eff209acc20fef
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1241
Message-Id: <20251006210127.28679-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243110/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoReview CMocka assertion usage
Frank Lichtenheld [Mon, 6 Oct 2025 20:41:09 +0000 (22:41 +0200)] 
Review CMocka assertion usage

Replace some assert_true calls with more specific
assertions. This should improve reporting in case
of problems and also just makes the code nicer.

Change-Id: Ia2f374476c87855bba6c0f9d3e2f28a5fe62a152
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1141
Message-Id: <20251006204118.26237-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243096/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agomtu: Trivial -Wconversion fix
Frank Lichtenheld [Mon, 6 Oct 2025 17:04:58 +0000 (19:04 +0200)] 
mtu: Trivial -Wconversion fix

Just use the correct type.

Change-Id: I8919c9efdf85424a124a0d54593cd1dbf3bc2341
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1250
Message-Id: <20251006170504.7235-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59242982/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoAllowing installing FreeBSD routes with interface instead of next-hop
Arne Schwabe [Mon, 6 Oct 2025 14:58:37 +0000 (16:58 +0200)] 
Allowing installing FreeBSD routes with interface instead of next-hop

This matches the Linux behaviour of the net_route add/delete commands

Change-Id: I88e16e15fad065cb310d38f09924053efc3a6ce5
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1193
Message-Id: <20251006145844.27794-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59242876/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoplatform: Do not assume uid_t/gid_t are signed
Frank Lichtenheld [Fri, 3 Oct 2025 10:06:02 +0000 (12:06 +0200)] 
platform: Do not assume uid_t/gid_t are signed

uid_t/gid_t are int on many platform but unsigned
on at least Linux. So rewrite the code in a way that
does not make any assumptions about the types. Mainly
this means storing the information whether the value
is valid in a separate bool and not in the value
itself.

Note that this changes the return behavior of
platform_{user,group}_get but a review of the
callers determined that this makes no actual
difference.

Change-Id: Ie6b4c41d13544d5ba71d441cc794c7abd12408f3
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: MaxF <max@max-fillinger.net>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1206
Message-Id: <20251003100602.375062-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33266.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoroute: Fix a unused-but-set-variable warning on OpenBSD
Frank Lichtenheld [Sat, 4 Oct 2025 14:19:30 +0000 (16:19 +0200)] 
route: Fix a unused-but-set-variable warning on OpenBSD

So we could enable -Werror for OpenBSD builds.

Change-Id: Ic971604beb1320d7b9d6121cd8e8519ccc1a7eb9
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: MaxF <max@max-fillinger.net>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1214
Message-Id: <20251004141935.17815-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59242246/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agocrypto_epoch: Clean up type handling in ovpn_expand_label()
Frank Lichtenheld [Sat, 4 Oct 2025 06:15:38 +0000 (08:15 +0200)] 
crypto_epoch: Clean up type handling in ovpn_expand_label()

- Add explicit casts where we have checked the value and
  need to put it into a smaller type.
- Adapt some types to actual usage.

Change-Id: Iad717f0ff3c79ae199c8be5f93bc51bf258c68c3
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: MaxF <max@max-fillinger.net>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1218
Message-Id: <20251004061545.7277-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59242119/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agodco-win: fix broken ASSERT in dco_new_key
Lev Stipakov [Mon, 29 Sep 2025 15:28:41 +0000 (17:28 +0200)] 
dco-win: fix broken ASSERT in dco_new_key

Commit

  e77c343 ("dco_win: In dco_new_key, document size assumptions for the integer casts")

has added an ASSERT on key-id, but didn't take into account that
key-id 0 is a perfectly valid value and is the first key-id. This
essentially broke dco-win.

Fix by adjusting ASSERT to >= 0.

Change-Id: I3b1243461ec9b6e85897f452f78dc4b05f7e126d
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1223
Message-Id: <20250929152841.177424-1-frank@lichtenheld.com>
URL: https://sourceforge.net/p/openvpn/mailman/message/59240115/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agodco: Change sd argument to dco_new_peer from int to socket_descriptor_t
Frank Lichtenheld [Wed, 24 Sep 2025 15:10:44 +0000 (17:10 +0200)] 
dco: Change sd argument to dco_new_peer from int to socket_descriptor_t

Doesn't change anything for non-Win32 platforms.

Change-Id: I28f856c1c156b54089d95b2e2539ecdb374cdd37
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Antonio Quartulli <antonio@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1195
Message-Id: <20250924151044.50567-1-frank@lichtenheld.com>
URL: https://sourceforge.net/p/openvpn/mailman/message/59238248/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agossl_openssl: Use uint16_t internally for TLS versions
Frank Lichtenheld [Wed, 24 Sep 2025 15:02:55 +0000 (17:02 +0200)] 
ssl_openssl: Use uint16_t internally for TLS versions

libressl changed the API for the involved functions. Since
uint16_t is a true subset of int it should be safe to switch
to that for all OpenSSL variants.

One trivial drive-by fix in unrelated code to be able
to enable -Wconversion fully for the file. This just
adds a cast where the comment says we intend a cast.

Change-Id: I9ea87531afb553f789289787403900a4758b8e1c
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: MaxF <max@max-fillinger.net>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1212
Message-Id: <20250924150300.29318-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59238230/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agodco_linux: Fix -Wconversion warnings
Frank Lichtenheld [Fri, 26 Sep 2025 14:24:36 +0000 (16:24 +0200)] 
dco_linux: Fix -Wconversion warnings

Combination of using the correct types and some
unavoidable safe size_t->int casts.

Change-Id: I473d345d10fc406f76fbdb131c28cc4fc54822fd
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Antonio Quartulli <antonio@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1220
Message-Id: <20250926142442.20796-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59239172/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agodco_win: In dco_new_key, document size assumptions for the integer casts
Frank Lichtenheld [Fri, 26 Sep 2025 16:51:46 +0000 (18:51 +0200)] 
dco_win: In dco_new_key, document size assumptions for the integer casts

And make all casts explicit so that compiler doesn't complain.

Change-Id: I612bf3b1c56d70a89fc04fad6fe36fd9fadfd258
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: MaxF <max@max-fillinger.net>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1221
Message-Id: <20250926165151.1502-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33229.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agocomp-lz4: Fix types in call to LZ4_decompress_safe
Frank Lichtenheld [Fri, 26 Sep 2025 16:48:39 +0000 (18:48 +0200)] 
comp-lz4: Fix types in call to LZ4_decompress_safe

This is ints all around but we uselessly threw some
size_t conversions in there.

Change-Id: Ie550dd4df65dc4fc13c839c3e745ba96e0c5c564
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: MaxF <max@max-fillinger.net>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1215
Message-Id: <20250926164845.1215-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33228.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agoGHA: Dependency updates September 2025
Frank Lichtenheld [Fri, 26 Sep 2025 11:54:15 +0000 (13:54 +0200)] 
GHA: Dependency updates September 2025

chore(deps): update dependency aws/aws-lc to v1.61.3
chore(deps): update vcpkg digest to 9c5c2a0
chore(deps): update github actions

Change-Id: I6725b55c9e7bf5410bde09659131590d40bfee4d
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Yuriy Darnobyt <yura.uddr@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1211
Message-Id: <20250926115415.158817-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33220.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoOpenVPN Release 2.7_beta2 v2.7_beta2
Gert Doering [Wed, 24 Sep 2025 20:35:52 +0000 (22:35 +0200)] 
OpenVPN Release 2.7_beta2

version.m4, ChangeLog, Changes.rst

Changes.rst has not received an "2.7_beta2" section - it has the
"highlevel" overview of what is new in 2.7, but for alpha/beta releases
it's better to look at git log to see what has been added/fixed.

Notable changes beta1 -> beta2 are:
   - even more of signed/unsigned related warnings have been fixed
   - #pragmas have been added to all to-be-fixed source files, so we can
     now always enable -Wconversion to see if new code brings new warnings
     (and the CI infra builds with -Werror)
   - add proper input sanitation to DNS strings to prevent an attack
     coming from a trusted-but-malicous OpenVPN server (CVE: 2025-10680,
     affects unixoid systems with --dns-updown scripts and windows using
     the built-in powershell call)
   - greatly improved event log handling for the Windows interactive service
     - this brings build system changes and a new openvpnservmsg.dll
   - bugfixes when using multi-socket on windows
     (properly recognize that TCP server mode does not work with DCO,
     properly handle TCP multi-socket server setups without DCO)
   - bring back configuring of IPv4 broadcast addresses on Linux
     (also backported to 2.6.15)
   - Rename Fox Crypto to Sentyron in copyright notices
   - Switch test_ssl certificate from RSA 2048 to secp384r1
     (so "make check" runs with OpenSSL set to @SECLEVEL=3)
   - repair "--dhcp-option DNS" setting in combination with DHCP (TAP)
     or --up scripts (GH issue #839, #840)
   - clean up MI prefix handling
   - replace all assert() calls with OpenVPN ASSERT()

6 weeks agoValidate DNS parameters
Lev Stipakov [Wed, 24 Sep 2025 20:15:56 +0000 (22:15 +0200)] 
Validate DNS parameters

This adds validation of following DNS options:

 --dns search-domains
 --dns server N resolve-domains
 --dns server N sni

 --dhcp-option DOMAIN
 --dhcp-option ADAPTER_DOMAIN_SUFFIX
 --dhcp-option DOMAIN-SEARCH

On Linux (and similar platforms), those options are written to a tmp file,
which is later sourced by a script running as root. Since options are
controlled by the server, it is possible for a malicious server to
execute script injection attack by pushing something like

 --dns search-domains x;id

in which case "id" command will be executed as a root.

On Windows, the value of DOMAIN/ADAPTER_DOMAIN_SUFFIX is passed to
a powershell script. A malicious server could push:

 --dhcp-option DOMAIN a';Restart-Computer'

and if openvpn is not using DHCP (this is the default, with dco-win driver)
and running without interactive service, that powershell command will be
executed.

Validation is performed in a way that value only contains following
symbols:

  [A-Za-z0-9.-_\x80-\0xff]

Reported-By: Stanislav Fort <disclosure@aisle.com>
CVE: 2025-10680
Change-Id: I09209ccd785cc368b2fcf467a3d211fbd41005c6
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1213
Message-Id: <20250924201601.25304-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59238367/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoevent: Silence conversion warning in tv_to_ms_timeout
Frank Lichtenheld [Wed, 24 Sep 2025 14:57:09 +0000 (16:57 +0200)] 
event: Silence conversion warning in tv_to_ms_timeout

The APIs want int (at least on unixy systems), so we
use int. max_int() protects us against negative values.

Change-Id: Ie8a242838b6f8b42f36327c33fc62bb5f94ec43f
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: MaxF <max@max-fillinger.net>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1178
Message-Id: <20250924145715.28701-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33193.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agops: Fix conversion warnings related to send/recv return values
Frank Lichtenheld [Wed, 24 Sep 2025 08:21:15 +0000 (10:21 +0200)] 
ps: Fix conversion warnings related to send/recv return values

We know that these values can't be big since they are limited
to the size of the input buffer. So we can explicitly cast
them to int if required.

Change-Id: Id070d1a45d45f9029309d23df7f3cab9ce792205
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1194
Message-Id: <20250924082121.23139-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59237926/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoMake unit tests -Wconversion clean
Frank Lichtenheld [Wed, 24 Sep 2025 12:41:48 +0000 (14:41 +0200)] 
Make unit tests -Wconversion clean

Only trivial problems left after the other patches
have been merged.

Change-Id: Iab9e780d9649d7581e5f6aa4b23e72bbed5e145b
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1205
Message-Id: <20250924124154.15963-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59238128/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoEnable -Wconversion -Wno-sign-conversion by default
Frank Lichtenheld [Wed, 24 Sep 2025 12:27:47 +0000 (14:27 +0200)] 
Enable -Wconversion -Wno-sign-conversion by default

Grand-father all known locations of existing errors,
so that -Werror builds still pass and we do not spam
build logs.

Still, this should give us a much better roadmap to
work on these issues one by one while still enabling
the warnings for a lot of code-paths.

In general I did go for least amount of pragmas, so
usually there is only one override per file, covering
ALL of the failures in that file. While this protects
a lot of code that doesn't need it, it also cut down
the amount of pragmas by a lot.

This does cover gcc builds including mingw and clang
builds. Does not cover MSVC.

Once the amount of issues has been suitable reduced
more warnings could be enabled.

Change-Id: Iad5b00c35a1f1993b1fa99e8b945ab17b230ef59
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1168
Message-Id: <20250924122755.14391-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33181.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agodns: Fix bug in error handling when talking to script
Frank Lichtenheld [Wed, 24 Sep 2025 12:18:55 +0000 (14:18 +0200)] 
dns: Fix bug in error handling when talking to script

Comparing the result of read/write to a size_t value
is dangerous C. Since ssize_t and size_t have the same
size ssize_t is promoted to size_t, so -1 becomes
size_t max value and is not smaller than the expected
length.

Make sure to compare ssize_t to ssize_t to avoid any
suprises.

Change-Id: Ic395b6d1dce510bb4b499c5beba61f033a2a860b
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Heiko Hund <heiko@openvpn.net>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1208
Message-Id: <20250924121901.13532-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59238099/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agomulti_io_init: simplify
Frank Lichtenheld [Tue, 23 Sep 2025 16:04:53 +0000 (18:04 +0200)] 
multi_io_init: simplify

We take two values and try to massage them in various
ways. But this function only has one caller and that
puts exactly the same value into both of them. So
simplify the code.

Change-Id: I9cb8aa6ef01445cb99758583aba8ae8f9ded0862
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1209
Message-Id: <20250923160459.32273-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33176.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agosocks: factor out socks_proxy_recv_char()
Frank Lichtenheld [Tue, 23 Sep 2025 15:10:44 +0000 (17:10 +0200)] 
socks: factor out socks_proxy_recv_char()

This is basically identical code duplicated three
times.

Change-Id: I6e848df8104b6e3a6e2c3245ece91a20e473fb40
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1165
Message-Id: <20250923151050.27336-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33171.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoEnable a subset of -Wextra
Frank Lichtenheld [Tue, 23 Sep 2025 14:08:48 +0000 (16:08 +0200)] 
Enable a subset of -Wextra

- Includes fixes for
  - -Wimplicit-fallthrough=2
    (=3 is default but requires replacing all
     fallthrough comments)
  - -Wmissing-field-initializers
  - -Wold-style-declaration
- All other warnings that would need fixes are
  disabled for now.

Change-Id: I9ce664d073a4e6a6d433e9e6f986a5086dae8aa1
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1202
Message-Id: <20250923140854.21766-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59237558/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoconfigure.ac: Make ACL_CHECK_ADD_COMPILE_FLAGS append instead of prepend
Frank Lichtenheld [Tue, 23 Sep 2025 12:20:00 +0000 (14:20 +0200)] 
configure.ac: Make ACL_CHECK_ADD_COMPILE_FLAGS append instead of prepend

The prepend behavior is surprising. If there is a difference
in behavior at least make it easy to understand what happens
why.

Change-Id: I1ce408d4473874d88a348308503527ef7eb8c1ff
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1204
Message-Id: <20250923122006.12212-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59237450/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoClean up conversion warnings related to base64_{en, de}code
Frank Lichtenheld [Tue, 23 Sep 2025 10:34:23 +0000 (12:34 +0200)] 
Clean up conversion warnings related to base64_{en, de}code

It seems unlikely that we can change the API at this point,
especially with the integration into the plugin API.

So
 - clean up the functions internally to not throw -Wconversion
   warnings
 - clean up any warnings on the caller side

Change-Id: Id7a5b2d8dea01bd532f5bcc8abea0e52b00d1169
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1148
Message-Id: <20250923103429.1257-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59237399/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoHandle return type of EVP_MD_size
Frank Lichtenheld [Mon, 22 Sep 2025 20:40:53 +0000 (22:40 +0200)] 
Handle return type of EVP_MD_size

Return type is int, but we often use it in contexts
where we expect size_t. So just cast it. Nothing else
to do really.

Change-Id: I22b93c807f1be99fab450708f686fce4aa6d5cef
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1133
Message-Id: <20250922204059.23226-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59237213/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agossl_verify: Change backend_x509_* functions to size_t for lengths
Frank Lichtenheld [Mon, 22 Sep 2025 20:43:23 +0000 (22:43 +0200)] 
ssl_verify: Change backend_x509_* functions to size_t for lengths

Fix conversion warnings without actual code changes.

Change-Id: If971006b6d3a1a93d87b29627d91dd72faf5ceb2
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1138
Message-Id: <20250922204329.23460-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33152.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agossl: Fix -Wconversion warnings in pem_password_callback
Frank Lichtenheld [Mon, 22 Sep 2025 20:41:52 +0000 (22:41 +0200)] 
ssl: Fix -Wconversion warnings in pem_password_callback

The OpenSSL API is how it is, so adapt with casts.

Change-Id: I053ddbb71cc5b9ae16c5a49be833035d943d7eba
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1137
Message-Id: <20250922204158.23319-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33154.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoFix t_net.sh / networking_testdriver after 'broadcast' change
Gert Doering [Mon, 22 Sep 2025 08:02:59 +0000 (10:02 +0200)] 
Fix t_net.sh / networking_testdriver after 'broadcast' change

Commit 0df0edc49c re-introduced explicit setting of broadcast addresses
for Linux IPv4 interfaces.  t_net.sh verifies that the built-in netlink
code (sitnl) achieves the same result as "equivalent" iproute2 statements
- and we missed adjusting of these iproute2 statements (printed by
networking_testdriver).  Done.

Change-Id: I5fea6ca1ccadb434b5c4f4b49881524a079a9d15
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Antonio Quartulli <antonio@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1203
Message-Id: <20250922080305.18477-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59236810/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoBugfix: Set broadcast address on interface.
Sebastian Marsching [Mon, 15 Sep 2025 11:05:07 +0000 (13:05 +0200)] 
Bugfix: Set broadcast address on interface.

This fixes a problem that was introduced in OpenVPN 2.5. Previously,
the ifconfig utility was used for adding the local address to an
interface. This utility automatically sets the correct broadcast address
based on the given unicast address and netmask.

Due to switching to iproute and Netlink, this does not happen
automatically any longer, which means that applications that rely on
broadcasts do not work correctly.

This patch fixes this issue both when using iproute (by telling iproute
to set the broadcast address based on the local address and prefix) and
when using Netlink (by calculating the correct broadcast address and
setting it).

Signed-off-by: Sebastian Marsching <sebastian-git-2016@marsching.com>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Message-Id: <20250915110507.20557-1-sebastian-git-2016@marsching.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33131.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agolist: Make types of hash elements consistent
Frank Lichtenheld [Fri, 19 Sep 2025 17:38:32 +0000 (19:38 +0200)] 
list: Make types of hash elements consistent

Really no use in having the indices and limits in int.

Change-Id: I3334465738fb1fbf508dfd719b6a238b500cc0ae
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1119
Message-Id: <20250919173838.28092-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33108.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoRename Fox Crypto to Sentyron in copyright notices
Max Fillinger [Fri, 19 Sep 2025 16:44:34 +0000 (18:44 +0200)] 
Rename Fox Crypto to Sentyron in copyright notices

Fox Crypto has been renamed to Sentyron on September 4th 2025.

See https://sentyron.com/press-release-foxcrypto-sentyron/ for the
announcement.

Change-Id: Ic9912627b707bf4edd4fe4bfc37b8a639feaba08
Signed-off-by: MaxF <max@max-fillinger.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1047
Message-Id: <20250919164440.23251-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33102.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agosocket: Change resolve flags to unsigned int
Frank Lichtenheld [Fri, 19 Sep 2025 15:40:34 +0000 (17:40 +0200)] 
socket: Change resolve flags to unsigned int

And use them consistently so to avoid conversion
warnings.

Change-Id: I5ef21e425786a49c90d4b7305c3fb174ab6ddf92
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1131
Message-Id: <20250919154040.17684-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33098.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoIntroduce msglvl_t to unify msglevel type handling
Frank Lichtenheld [Wed, 17 Sep 2025 17:04:19 +0000 (19:04 +0200)] 
Introduce msglvl_t to unify msglevel type handling

msglevel was definitely unsigned as the first
argument to msg(), but many parts of the code
had it as signed. So this produced a LOT of
warnings when enabling -Wsign-conversion.

Introduce a msglvl_t typedef and switch all
users to it. This includes any values that
are stored in the msglevel field, including
debug level and mute level.

There is one exception in struct status_output
where -1 is a valid value in the API. Only
positive values are translated into standard
message levels.

Change-Id: Id492cb774c6d022d06bb3cf5fec2a4bdd410e619
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1110
Message-Id: <20250917170428.3310-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33028.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoGHA: collect more artifacts for mingw builds
Lev Stipakov [Thu, 18 Sep 2025 13:59:03 +0000 (15:59 +0200)] 
GHA: collect more artifacts for mingw builds

Collect also binaries for openvpnserv, tapctl and openvpnmsica.

Change-Id: Iaebc46f9156657128dc52c979202545be8865656
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1200
Message-Id: <20250918135908.14364-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33058.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agofix building of openvpnsrvmsg.dll from eventmsg.mc in mingw builds
Gert Doering [Fri, 19 Sep 2025 11:24:19 +0000 (13:24 +0200)] 
fix building of openvpnsrvmsg.dll from eventmsg.mc in mingw builds

commit 06919a60ae61 introduces .mc files that need to be compiled to
.h and .bin by the windows "mc.exe" tool, and from there into a new
.dll.  This worked for MSVC builds, did nothing for cmake/mingw builds,
and broke compilation on autoconf/mingw builds.

This patch consists of two parts:

1. add building of openvpnsrvmsg.dll to autoconf/mingw builds

   Add logic to configure.ac to find the "windmc" binary in the linux or
   mingw variants, add rules to src/openvpnserv/Makefile.am so make knows
   what to do.

   Libtool is getting in the way when "openvpnsrvmsg.dll" is created as
   anything listed in ...BIN or ...LIB, so decare it as "DATA" and make
   the necessary rules explicit.

2. fix building of openvpnsrvmsg.dll on cmake/mingw builds

   Fix "find_program()" invocation to avoid using "midnight commander"
   binary (mc) on Linux (called "windmc" there).

   Change from "-Wl,--noentry" to linker invocation that works.

See also:
https://learn.microsoft.com/en-us/cpp/build/creating-a-resource-only-dll?view=msvc-170

Change-Id: I071e8190dac28f429257b8af1c6f9e68f8896bc0
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1197
Message-Id: <20250919112424.24728-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33083.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoopenvpnserv: Fix writing messages to the event log
Lev Stipakov [Wed, 17 Sep 2025 09:05:48 +0000 (11:05 +0200)] 
openvpnserv: Fix writing messages to the event log

There are two problems with the current implementation:

 - due to the code bug, we never display actual error message
corresponding to the Windows error code. We use
FORMAT_MESSAGE_ALLOCATE_BUFFER, in which case we must pass
a pointer to the LPTSTR, not the LPTSTR itself.

 - The error is not displayed in the "General" tab, which is very confusing.
One needs to go to the "Details" tab to see what is wrong.

This commit solves both problems. We now display a proper error
message in addition to the text provided by the service ("what went wrong").
While on it, remove trailing symbols Ã­n a safer way.

To display the message in "General" tab, we create a registered message file
(openvpnservmsg.dll), which contains message template. Note that this requires
changes to the installer - we need to install the new DLL and
add a registry entry.

GitHub: https://github.com/OpenVPN/openvpn/issues/842

Change-Id: I423c9880def0eb479abb72bef2e8034a73cf5905
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Selva Nair <selva.nair@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1188
Message-Id: <20250917090557.25414-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59234559/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agodev-tools/gerrit-send-mail.py: include Gerrit URL into the commit message
Gert Doering [Wed, 17 Sep 2025 12:07:15 +0000 (14:07 +0200)] 
dev-tools/gerrit-send-mail.py: include Gerrit URL into the commit message

We used to reference to one of the mailing list archives as the formal
reference for the patch and the review discussions.  With the problematic
reliability of the archives, I've started to manually add the URLs in
the OpenVPN Gerrit to the commits because they give a better reference
and (usually) all the feedback is there in a useful format.

So, enhance this dev-tool script to do this automatically.

Change-Id: Idb137ecbade4b0584a4d74aee34978062e247bc5
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1196
Message-Id: <20250917120720.30738-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59234672/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agowin: replace wmic invocation with powershell
Lev Stipakov [Mon, 15 Sep 2025 13:03:38 +0000 (15:03 +0200)] 
win: replace wmic invocation with powershell

Since wmic has been recently deprecated and is absent on new
systems, replace setting DNS domain "old-style" with powershell.

This is based on 2.6 patch which replaces wmic with powershell

    d383d6e "win: replace wmic invocation with powershell"

except that here we only touch openvpn process code. There is no
wmic calls in 2.7 service.

Github: fixes OpenVPN/openvpn#642

Change-Id: Ibb126e9ca4548aeb8b60df226e37c9b414698247
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1187
Message-Id: <20250915130344.2906-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32951.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agomanage: Change command_line_* API to use size_t for lengths
Frank Lichtenheld [Sun, 14 Sep 2025 17:46:29 +0000 (19:46 +0200)] 
manage: Change command_line_* API to use size_t for lengths

The used functions already expect this.

Change-Id: Ifc183e42b190e19e1d8c351d1cd460a038626e63
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1136
Message-Id: <20250914174638.6867-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32929.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoevents: Make sure rwflags are treated as unsigned
Frank Lichtenheld [Sun, 14 Sep 2025 13:51:20 +0000 (15:51 +0200)] 
events: Make sure rwflags are treated as unsigned

event_set_return.rwflags is already unsigned, make sure the
flags are as well to avoid spurious conversion warnings.

Requires to change rwflags in proxy_connection struct as
well since those use the same flags.

Change-Id: I0272b709b907545de05bfded03a649b259ce5af6
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
URL: https://gerrit.openvpn.net/c/openvpn/+/1107
Message-Id: <20250914135128.19621-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32918.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agops: Clean up conversion warnings in journal_add function
Frank Lichtenheld [Sun, 14 Sep 2025 13:47:08 +0000 (15:47 +0200)] 
ps: Clean up conversion warnings in journal_add function

Since these are only local variables, these are trivial
changes.

Change-Id: I0f2fff8358d4645c4ace504c65ae8559a68794cc
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250914134713.19315-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32916.html
URL: https://gerrit.openvpn.net/c/openvpn/+/1163
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoSwitch test_ssl certificate from RSA 2048 to secp384r1
Arne Schwabe [Mon, 8 Sep 2025 18:18:46 +0000 (20:18 +0200)] 
Switch test_ssl certificate from RSA 2048 to secp384r1

This allow the unit test to also run in environments that have seclevel
(SSL_CTX_set_security_level) set to 3.

Closes: OpenVPN/openvpn#830
Change-Id: I327ecc9a85dd906517c28e71fe500883bfa028a4
Signed-off-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
URL: https://gerrit.openvpn.net/c/openvpn/+/1172
Message-Id: <20250908181852.5054-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32838.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agooptions: Factor out usages of strtoll and atoll
Frank Lichtenheld [Thu, 11 Sep 2025 20:15:00 +0000 (22:15 +0200)] 
options: Factor out usages of strtoll and atoll

This covers the cases where we actually want to
allow numbers > 2^31

Change-Id: I454126b3f8fa9d14501f6c4b1ed9ce7b2904be61
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: MaxF <max@max-fillinger.net>
URL: https://gerrit.openvpn.net/c/openvpn/+/1154
Message-Id: <20250911201505.25582-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32858.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agossl_common: Make sure ssl flags are treated as unsigned
Frank Lichtenheld [Thu, 11 Sep 2025 20:16:52 +0000 (22:16 +0200)] 
ssl_common: Make sure ssl flags are treated as unsigned

tls_options.ssl_flags is already unsigned, make sure the
flags are as well to avoid spurious conversion warnings.

Also fix various warning regarding the use of the flags
for TLS version handling.

Change-Id: I03e5ece7580ca4ebd41a7928ead544df46e8bad1
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: MaxF <max@max-fillinger.net>
Message-Id: <20250911201658.25736-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59232184/
URL: https://gerrit.openvpn.net/c/openvpn/+/1104
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoFix multi-socket and dco-win interaction
Gianmarco De Gregori [Fri, 12 Sep 2025 13:10:56 +0000 (15:10 +0200)] 
Fix multi-socket and dco-win interaction

The dco_check_option_ce(), for dco_win, checked only
the global protocol of the current connection entry,
but now it should be extended to the local_list
and since dco_win does not support more than 1
socket, checking the first entry of the local_list
will be enough.

Change-Id: I74e2b6aed3c7454e897db57f777e6a191be3d87f
Signed-off-by: Gianmarco De Gregori <gianmarco@mandelbit.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20250912131056.42342-1-frank@lichtenheld.com>
URL: https://sourceforge.net/p/openvpn/mailman/message/59232442/
URL: https://gerrit.openvpn.net/c/openvpn/+/1173
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoPreserve --dhcp-option values from local config
Lev Stipakov [Fri, 12 Sep 2025 13:22:35 +0000 (15:22 +0200)] 
Preserve --dhcp-option values from local config

Commit

  2dfc4f8 ("dns: deal with --dhcp-options when --dns is active")

has changed the way how --dhcp-option values are stored. Instead of
storing them directly in tuntap_options, they are now stored in
dns_options->from_dhcp.

Before connect, we save options before --pull is applied, and for that
we call clone_dns_options(). However, this was missing to clone the
"from_dhcp" struct, and as a result, the values of --dhcp-option from
the local config have been lost.

Fix by adding shallow-copying of dhcp_options to clone_dns_options(). It
is safe to do because it only contains fixed-size arrays, scalar types
and pointers to the strings which this struct doesn't own.

Github: closes OpenVPN/openvpn#839
Github: closes OpenVPN/openvpn#840

Change-Id: I815e68dd5d365743faff2b80783b776d9e8a645c
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20250912132235.44304-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32879.html
URL: https://gerrit.openvpn.net/c/openvpn/+/1181
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agodco: add standard mi prefix handling to multi_process_incoming_dco()
Antonio Quartulli [Thu, 11 Sep 2025 20:12:16 +0000 (22:12 +0200)] 
dco: add standard mi prefix handling to multi_process_incoming_dco()

Our code generally expects functions that deal with a multi instance
to set up a log prefix at the beginning with set_prefix(mi) and clear
it at the end with clear_prefix().

Add the calls to multi_process_incoming_dco() in a similar way to
what is done for multi_process_incoming_link() - handling "link
events" and "dco events" the same, with correct prefix in the
function and no leftover prefix afterwards.

Github: closes OpenVPN/openvpn#799
Change-Id: I1ad5df0f6785ffe9becd9f83329a9335d1a36f24
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250911201222.25382-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32859.html
URL: https://gerrit.openvpn.net/c/openvpn/+/1116
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoremove newline characters at the end of msg() calls
Gert Doering [Fri, 12 Sep 2025 13:16:09 +0000 (15:16 +0200)] 
remove newline characters at the end of msg() calls

Unlike debugging with printf(), or msg() calls do not need or want
a '\n' at the end of the string.  Remove those that were overlooked.

Change-Id: I889b53ed72efaec546a6609491fae9715726ea00
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20250912131609.43444-1-frank@lichtenheld.com>
URL: https://sourceforge.net/p/openvpn/mailman/message/59232448/
URL: https://gerrit.openvpn.net/c/openvpn/+/1180
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agopush-update-server: comment about buf_string_compare_advance() usage in send_single_p...
Marco Baffo [Fri, 12 Sep 2025 13:15:19 +0000 (15:15 +0200)] 
push-update-server: comment about buf_string_compare_advance() usage in send_single_push_update()

Change-Id: I73f8ad9bf105920f4bde357ea9dcf0e485f3f3cb
Signed-off-by: Marco Baffo <marco@mandelbit.com>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20250912131519.43222-1-frank@lichtenheld.com>
URL: https://sourceforge.net/p/openvpn/mailman/message/59232447/
URL: https://gerrit.openvpn.net/c/openvpn/+/1177
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoMulti-socket win: avoid repeated socket_set()
Gianmarco De Gregori [Fri, 12 Sep 2025 13:12:07 +0000 (15:12 +0200)] 
Multi-socket win: avoid repeated socket_set()

On Windows, multi-socket support failed with mixed protocols due
to repeated socket_set() calls, which caused accept() to be triggered
before having an event to process.  This fix skips socket_set()
calls for non-UDP sockets in MODE_SERVER inside multi_io_process_flags().

Change-Id: Ia389fcec50fb2bbc0aa5ad41a2c23c17c04e6e9b
Signed-off-by: Gianmarco De Gregori <gianmarco@mandelbit.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20250912131207.42597-1-frank@lichtenheld.com>
URL: https://sourceforge.net/p/openvpn/mailman/message/59232443/
URL: https://gerrit.openvpn.net/c/openvpn/+/1174
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoopenvpn_PRF: Change API to use size_t for lengths
Frank Lichtenheld [Thu, 11 Sep 2025 20:17:13 +0000 (22:17 +0200)] 
openvpn_PRF: Change API to use size_t for lengths

Basically all users already wanted that anyway. And most
of the library functions also take size_t nowadays.

Change-Id: Ic88cd6e143bc48cab3c9ebb7c7007513803bd199
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: MaxF <max@max-fillinger.net>
Message-Id: <20250911201719.25773-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59232185/
URL: https://gerrit.openvpn.net/c/openvpn/+/1135
Signed-off-by: Gert Doering <gert@greenie.muc.de>
8 weeks agoreplace assert() calls with ASSERT()
Gert Doering [Sun, 7 Sep 2025 21:12:46 +0000 (23:12 +0200)] 
replace assert() calls with ASSERT()

OpenVPN's ASSERT() macro will do a bit more than the standard-libc
assert() call, namely print out which function and what expression
failed, before calling _exit(1).  Also, it can not be accidentially
compiled-away (-DNDEBUG).

Use of ASSERT() is generally only advised in cases of "this must not
happen, but if it does, it's a programming or state corruption error
that we must know about".  Use of assert() is lacking the extra debug
info, and as such, not advised at all.

Change-Id: I6480d6f741c2368a0d951004b91167d5943f8f9d
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: mandree <matthias.andree@gmx.de>
Message-Id: <20250907211252.23924-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32824.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agoOpenVPN Release 2.7_beta1 v2.7_beta1
Gert Doering [Wed, 3 Sep 2025 17:03:39 +0000 (19:03 +0200)] 
OpenVPN Release 2.7_beta1

version.m4, ChangeLog, Changes.rst

Changes.rst has not received an "2.7_beta1" section - it has the
"highlevel" overview of what is new in 2.7, but for alpha/beta releases
it's better to look at git log to see what has been added/fixed.

New features alpha3 -> beta1 are
  - a large number of signed/unsigned related warnings have been fixed
  - bugfixes in --dns-updown script for linux systems using resolvconf
  - rewrite of the management interface "bytecount" infastructure to better
    interact with DCO
  - PUSH_UPDATE server support (via management interface)
  - introduction of route_redirect_gateway_ipv4 and _ipv6 env variables
  - speeding up t_client tests by reducing per-test startup delay 3s -> 1s

The biggest noticeable difference in beta1 is the reformatting using
clang-format, leaving uncrustify as that wasn't stable across versions.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agoPUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Marco Baffo [Wed, 3 Sep 2025 16:48:20 +0000 (18:48 +0200)] 
PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages

Using the management interface you can now target one or more clients
(via broadcast or via cid) and send a PUSH_UPDATE control message
to update some options.  See doc/management-notes.txt for details.

Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Signed-off-by: Marco Baffo <marco@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250903164826.13284-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32807.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agossl_openssl: Fix type of sslopts argument to SSL_CTX_set_options
Frank Lichtenheld [Tue, 26 Aug 2025 18:41:38 +0000 (20:41 +0200)] 
ssl_openssl: Fix type of sslopts argument to SSL_CTX_set_options

The argument changed type in OpenSSL 3.0.

Change-Id: Ia5e0aad8a97d38f8d309a29ecfe3c578edff9595
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Message-Id: <20250826184148.21534-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32690.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agooptions: Introduce atoi_constrained and review usages of atoi_warn
Frank Lichtenheld [Tue, 2 Sep 2025 14:46:50 +0000 (16:46 +0200)] 
options: Introduce atoi_constrained and review usages of atoi_warn

This is a more powerful version of atoi_warn that can
- check minimum and maximum values
- report error seperately from parsed value

This can be used to simplify a lot of option parsing.

Change-Id: Ibc7526d59c1de17a0f9d8ed88f75c6f070ab11e7
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Message-Id: <20250902144657.11854-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59228172/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agomanagement: stop bytecount on client disconnection
Ralf Lici [Tue, 2 Sep 2025 16:35:09 +0000 (18:35 +0200)] 
management: stop bytecount on client disconnection

When a management interface client requests periodic bytecount
notifications, openvpn continues to emit them even after the client has
disconnected. Additionally, upon reconnecting, the client starts
receiving these notifications without having issued a new bytecount
command.

Stop the periodic bytecount operation when the management interface
client disconnects, preventing unnecessary stats polling when using DCO
and ensuring that clients only receive notifications they have
explicitly requested.

Change-Id: I1474d232278433d097baf85352dfc9a79853bad1
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250902163514.22339-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32765.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agodco_linux: validate tun interface before fetching stats
Ralf Lici [Tue, 2 Sep 2025 16:45:15 +0000 (18:45 +0200)] 
dco_linux: validate tun interface before fetching stats

If dco_get_peer_stats() is called with an uninitialized c->c1.tuntap it
results in a segfault. This issue happens when a client who has not
connected to any server:
  - has --management and exits,
  - has --management and a management interface client issues either
    `bytecount` or `status` or
  - if SIGUSR2 is sent to it.

Add a check to ensure the tun interface was set up before attempting to
retrieve peer statistics.

Change-Id: I40c11864745cc1619cb9cbf490b168f90feb5eac
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250902164521.23145-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32768.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agodco: avoid printing mi prefix on debug messages
Gianmarco De Gregori [Tue, 2 Sep 2025 11:59:49 +0000 (13:59 +0200)] 
dco: avoid printing mi prefix on debug messages

On messages printed for async DCO events, the currently-set mi prefix
does not (always) belong to the peer that the async messages refer to,
creating confusion.

To avoid this, the M_NOIPREFIX flag is now used along with msglevel.

Change-Id: I84a73d625c79d6a6a19122e48c91960dbe01ec49
Signed-off-by: Gianmarco De Gregori <gianmarco@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250902115954.29021-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59228149/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agomanagement: resync timer on bytecount interval change
Ralf Lici [Tue, 2 Sep 2025 16:00:44 +0000 (18:00 +0200)] 
management: resync timer on bytecount interval change

coarse_timer_wakeup tracks when the next timer-driven task will occur.
If a user issues `bytecount n` via the management interface, but the
next scheduled wakeup is more than n seconds away, bandwidth logging
will be delayed until that timer fires.

To ensure timely logging, reset the timer whenever a new `bytecount`
command is received. This guarantees that logging begins exactly n
seconds after the command, matching the user-defined interval.

Change-Id: Ic0035d52e0ea123398318870d2f4d21af927a602
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250902160050.18640-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59228306/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agoRefactor management bytecount tracking
Lev Stipakov [Tue, 2 Sep 2025 10:36:01 +0000 (12:36 +0200)] 
Refactor management bytecount tracking

There are few issues with it:

 - when using DCO, the server part doesn't output BYTECOUNT_CLI since
   process_incoming_link_part1/process_outgoing_link are not called

 - when using DCO, the server part applies bytecount timer to the each
   connection, unneccessary making too many calls to the kernel and also
   uses incorrect BYTECOUNT output.

 - client part outputs counters using timer, server part utilizes
   traffic activity -> inconsistency

Following changes have been made:

 - Use timer to output counters in client and server mode. Code which
   deals with bytecount on traffic activity has been removed. This unifies
   DCO and non-DCO, as well as client and server mode

 - In server mode, peers stats are fetched with the single ioctl call

 - Per-packet stats are not persisted anymore in the client mode during
   traffic activity. Instead cumulative stats (including DCO stats) are
   persisted when the session closes.

GitHub: closes OpenVPN/openvpn#820

Change-Id: I43a93f0d84f01fd808a64115e1b8c3b806706491
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250902103606.22181-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59228150/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agodco-win: add support for multipeer stats
Lev Stipakov [Tue, 2 Sep 2025 12:25:36 +0000 (14:25 +0200)] 
dco-win: add support for multipeer stats

Use the new driver API to fetch per-peer link and VPN byte counters
in both client and server modes.

Two usage modes are supported:

 - Single peer: pass the peer ID and a fixed-size output buffer. If the
   IOCTL is not supported (old driver), fall back to the legacy API.

 - All peers: first call the IOCTL with a small output buffer to get
   the required size, then allocate a buffer and call again to fetch
   stats for all peers.

Change-Id: I525d7300e49f9a5a18e7146ee35ccc2af8184b8a
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250902122542.31023-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32744.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agoforward: Make sure pip flags are treated as unsigned
Frank Lichtenheld [Mon, 1 Sep 2025 19:45:25 +0000 (21:45 +0200)] 
forward: Make sure pip flags are treated as unsigned

process_ip_header already expects them to be unsigned,
make sure the flags are to avoid spurious conversion warnings.

Change-Id: I6d42c67b8dc5512933bed482bd9c2be80c63e993
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250901194531.13683-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32740.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agomanage: Make sure various management flags are treated as unsigned
Frank Lichtenheld [Tue, 26 Aug 2025 18:48:57 +0000 (20:48 +0200)] 
manage: Make sure various management flags are treated as unsigned

The variables that hold them are already unsigned, make sure
the flags are as well to avoid spurious conversion warnings.

Change-Id: I0937165c5efa95136bd951345a076e33e396f26a
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Message-Id: <20250826184904.22057-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32687.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agosocket_util: Clean up conversion warnings in add_in6_addr
Frank Lichtenheld [Sun, 31 Aug 2025 15:12:52 +0000 (17:12 +0200)] 
socket_util: Clean up conversion warnings in add_in6_addr

Change-Id: Id3b8719ee6b457ce2d85156b39e0cea771a97e74
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250831151259.25788-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32725.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agoAdd new unit test module test_socket
Frank Lichtenheld [Sun, 31 Aug 2025 15:11:26 +0000 (17:11 +0200)] 
Add new unit test module test_socket

With a first UT that tests add_in6_addr() (and
print_in6_addr implicitly).

Change-Id: If546f64a4554b292623bfcfe9ee53bac17dfa803
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250831151133.25684-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32723.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agosocket: Create socket_util with non-socket functions
Frank Lichtenheld [Sun, 31 Aug 2025 15:59:32 +0000 (17:59 +0200)] 
socket: Create socket_util with non-socket functions

This extracts a lot of the helper functions that do not
actually work on sockets, but instead on addresses or
similar.

This includes

- openvpn_getaddrinfo and related functions
- print_*
- setenv_*

And lots of the inline functions.

This move will make it easier to add unit tests
for these moved functions.

Change-Id: I7393459b975fb9b3e0a42743f58645f769d1be5a
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250831155939.29240-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32727.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agoIntroduce env variables to communicate desired gateway redirection to NM.
Gert Doering [Tue, 26 Aug 2025 18:40:38 +0000 (20:40 +0200)] 
Introduce env variables to communicate desired gateway redirection to NM.

When run under Network Manager control, OpenVPN is not allowed to
control routing.  Instead, NM uses the OpenVPN-set environment variables
("route_network_1" etc) to set up routes as requested.  This method never
worked properly for "redirect-gateway", as the information was not made
available in environment variables.

Introduce new env vars:

 route_redirect_gateway_ipv4
 route_redirect_gateway_ipv6

to communicate desired state:

 <not set> = no gateway redirection desired
 1 = "redirect-gateway for that protocol in question"
 2 = "include block-local to redirect the local LAN as well"

We intentionally do not expose all the IPv4 flags ("local", "def1", ...)
as this is really internal OpenVPN historical cruft.

Change-Id: I1e623b4a836f7216750867243299c7e4d0bd32d0
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Message-Id: <20250826184046.21434-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32686.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agoroute: Make sure various route flags are treated as unsigned
Frank Lichtenheld [Tue, 26 Aug 2025 18:38:41 +0000 (20:38 +0200)] 
route: Make sure various route flags are treated as unsigned

The variables that hold them are already unsigned, make sure
the flags are as well to avoid spurious conversion warnings.

Change-Id: Ib7f78abbcd52c00a32afdea36ef635681ac8e127
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Message-Id: <20250826183902.21252-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32684.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agooptions: Make sure option types are treated as unsigned
Frank Lichtenheld [Tue, 26 Aug 2025 18:39:33 +0000 (20:39 +0200)] 
options: Make sure option types are treated as unsigned

verify_permissions already expects them to be unsigned,
make sure they are to avoid spurious conversion warnings.

Change-Id: I1d27cb81d32058e40147e1d6dcd12df7f6cb2b30
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Message-Id: <20250826183941.21338-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32685.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agocrypto: Make sure crypto flags are treated as unsigned
Frank Lichtenheld [Tue, 26 Aug 2025 18:49:29 +0000 (20:49 +0200)] 
crypto: Make sure crypto flags are treated as unsigned

crypto_options.flags is already unsigned, make sure the
flags are as well to avoid spurious conversion warnings.

Change-Id: I89820c76e2e099f7acb817c71c8aeb83736ac556
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Message-Id: <20250826184935.22110-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32688.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agocomp: Make sure comp flags are treated as unsigned
Frank Lichtenheld [Tue, 26 Aug 2025 18:50:00 +0000 (20:50 +0200)] 
comp: Make sure comp flags are treated as unsigned

compress_options.flags is already unsigned. Make sure
the individual flags are as well to avoid spurious
conversion warnings.

Change-Id: I6a0d352a039a0936cb9bbedf6168cd6eecd053ea
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Message-Id: <20250826185007.22157-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32689.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agoCheck message id/acked ids too when doing sessionid cookie checks
Arne Schwabe [Tue, 19 Aug 2025 21:22:09 +0000 (23:22 +0200)] 
Check message id/acked ids too when doing sessionid cookie checks

This fixes that control packets on a floating client can trigger
creating a new session in special circumstances:

To trigger this circumstance a connection needs to

- starts on IP A
- successfully floats to IP B by data packet
- then has a control packet from IP A before any
  data packet can trigger the float back to IP A

and all of this needs to happen in the 60s time
that hmac cookie is valid in the default
configuration.

In this scenario we would trigger a new connection as the HMAC
session id would be valid.

This patch adds checking also of the message-id and acked ids to
discern packet from the initial three-way handshake where these
ids are 0 or 1 from any later packet.

This will now trigger (at verb 4 or higher) a messaged like:

   Packet (P_ACK_V1) with invalid or missing SID

instead.

Also remove a few duplicated free_tls_pre_decrypt_state in test_ssl.

Reported-By: Walter Doekes <walter.openvpn@wjd.nu>
Tested-By: Walter Doekes <walter.openvpn@wjd.nu>
Change-Id: I6752dcd5aff3e5cea2b439366479e86751a1c403
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: MaxF <max@max-fillinger.net>
Message-Id: <20250819212214.16218-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32626.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>