]> git.ipfire.org Git - thirdparty/openvpn.git/log
thirdparty/openvpn.git
2 days agoClarify operator precedence in a & b ? c : d master
Frank Lichtenheld [Tue, 7 Apr 2026 20:52:28 +0000 (22:52 +0200)] 
Clarify operator precedence in a & b ? c : d

As suggested by cppcheck.

Change-Id: Ia153e0de888c0ee21199b192f3471ce4c08cb5c7
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1619
Message-Id: <20260407205235.31126-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36545.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 days agoopenvpnserv: Remove redundant bit-wise operation
Frank Lichtenheld [Tue, 7 Apr 2026 20:53:36 +0000 (22:53 +0200)] 
openvpnserv: Remove redundant bit-wise operation

Found by cppcheck.

Change-Id: I7f983168c263e49da7665fc20bd1ecdd426c21d0
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1623
Message-Id: <20260407205344.31263-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36547.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 days agotest_buffer: Add test for buf_null_terminate
Frank Lichtenheld [Tue, 7 Apr 2026 09:50:38 +0000 (11:50 +0200)] 
test_buffer: Add test for buf_null_terminate

Change-Id: I01683153a68e1809a4d7ab455eb346f53780e219
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1580
Message-Id: <20260407095044.28528-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36532.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 days agomanagement: add base64 multi-line input for passwords
Luca Boccassi [Mon, 30 Mar 2026 18:08:54 +0000 (20:08 +0200)] 
management: add base64 multi-line input for passwords

Allow management clients to send long passwords via the
usual multi-line base64 encoded protocol.

A client declares MCV 5 support and sends a 'password <type>'
line, followed by as many lines (each up to 1024 bytes) as
needed, in base64 encoded format, terminated by 'END'.

This is useful when a password is a JIT-generated use-once
token.

Declare management version 6 for this feature.

Change-Id: Ib99f171fb69d51f2260b44edf8ebe21ac958f233
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Acked-by: Selva Nair <selva.nair@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1593
Message-Id: <20260330180900.16608-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36360.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 days agopush: Make prepare_push_reply return void
Frank Lichtenheld [Mon, 6 Apr 2026 07:26:11 +0000 (09:26 +0200)] 
push: Make prepare_push_reply return void

It returned a constant value so it didn't actually
mean anything.

While here also make it static.

Identified by cppcheck.

Change-Id: Ied966413948cf3c935a8a1eb91172ef7a6948bdd
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1616
Message-Id: <20260406072617.27790-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36514.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 days agotest_packet_id: Add a check after malloc to ensure value is valid
Frank Lichtenheld [Mon, 6 Apr 2026 07:47:24 +0000 (09:47 +0200)] 
test_packet_id: Add a check after malloc to ensure value is valid

cppcheck complains about a potential null pointer dereference
in reliable_get_num_output_sequenced_available. That is mostly
theoretical, but still add a check.

Change-Id: I64da2328591ef2b9ee7502e574c878651cdf356a
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1621
Message-Id: <20260406074729.29903-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36516.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 days agowin: Fix nrpt_dnssec flag handling
Frank Lichtenheld [Sun, 5 Apr 2026 10:22:04 +0000 (12:22 +0200)] 
win: Fix nrpt_dnssec flag handling

By default the first enum value is 0.
But we check whether we set the flag by doing
BOOL dnssec = (msg->flags & nrpt_dnssec) != 0;
This can't ever be true.

Found by cppcheck.

Change-Id: Iff5be978817bfc0cd4d78818e7be7b90bad71f3c
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1606
Message-Id: <20260405102209.31528-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36487.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 days agocrypto_backend: Remove md_full
Frank Lichtenheld [Sun, 5 Apr 2026 10:31:04 +0000 (12:31 +0200)] 
crypto_backend: Remove md_full

There was only one user for mbedtls < 4.0,
so remove all the unused implementations.

Identified by cppcheck.

Change-Id: Ie2285f5bf52f5c669fb01f9ae36d6aa1674f0929
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1612
Message-Id: <20260405103110.32401-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36495.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 days agomtcp: Remove noop statement in multi_tcp_process_outgoing_link_ready
Frank Lichtenheld [Sat, 4 Apr 2026 20:33:30 +0000 (22:33 +0200)] 
mtcp: Remove noop statement in multi_tcp_process_outgoing_link_ready

Assigning to a parameter here has no effect. I can see no
obvious alternative statement that might have been intended.

Found by cppcheck.

Change-Id: I04a01cf536ee6d48d54ba623dda460c4a98859f9
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1609
Message-Id: <20260404203335.30650-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36478.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 days agoRemove various unused structs
Frank Lichtenheld [Sat, 4 Apr 2026 20:36:09 +0000 (22:36 +0200)] 
Remove various unused structs

Change-Id: I46499ff1f40dbdb94b84d58d17457d0ccdd75288
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1607
Message-Id: <20260404203615.30863-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36468.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 days agoopenvpnmsica: Fix setting of iTicks in schedule_adapter_delete
Frank Lichtenheld [Sat, 4 Apr 2026 20:35:19 +0000 (22:35 +0200)] 
openvpnmsica: Fix setting of iTicks in schedule_adapter_delete

Increase the integer, not the pointer.

Found by cppcheck.

Change-Id: I4d6501ddfb321f57a76841f29ff92c5a412908bb
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1608
Message-Id: <20260404203525.30790-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36476.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 days agoDo not access internals of ASN1_INTEGER to print hex of serial
Arne Schwabe [Sat, 4 Apr 2026 15:57:19 +0000 (17:57 +0200)] 
Do not access internals of ASN1_INTEGER to print hex of serial

OpenSSL 4.0 does not allow internal access to to these data structures
anymore. So use public methods to get the serial data and convert it to
hex.

Change-Id: I5158fbb0762443ea4954e5745f520e83e019ed30
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1589
Message-Id: <20260404155726.7696-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36459.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 days agodoc: Remove some explanations for pre-2.3 configurations
Frank Lichtenheld [Thu, 2 Apr 2026 12:04:35 +0000 (14:04 +0200)] 
doc: Remove some explanations for pre-2.3 configurations

Just streamline the documentation a bit.

Change-Id: Ieaaf3a79642c8f7914f9bfc6762ad601c4f5695b
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1603
Message-Id: <20260402120435.39983-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36434.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 days agoOpenSSL 4.0: Make X509 objects const
Arne Schwabe [Thu, 2 Apr 2026 12:10:49 +0000 (14:10 +0200)] 
OpenSSL 4.0: Make X509 objects const

In OpenSSL 4.0 a lot of the APIs have changed to return const objects.
Adjust our source code to use const objects as well.

Change-Id: Iea1d13c160599f134587c6f1c2f4a90e7f5e3991
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1596
Message-Id: <20260402121049.41102-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36437.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 days agoAdd unit test for printing various details of certificates
Arne Schwabe [Tue, 31 Mar 2026 17:33:57 +0000 (19:33 +0200)] 
Add unit test for printing various details of certificates

These unit tests will ensure that refactoring of these methods does not
change the output.

Change-Id: Iacbd8195cdedc7226bddc686ca8dccf9f25f8842
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1598
Message-Id: <20260331173403.3082-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36389.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 days agoRename key* to privkey* in cert_data.h
Arne Schwabe [Wed, 1 Apr 2026 10:22:42 +0000 (12:22 +0200)] 
Rename key* to privkey* in cert_data.h

The name key2 conflicts with our struct key2 and prevents these
test keys from being used in test_ssl.c

Change-Id: Id8680e6555a66024417d6eb9322d4fde79922453
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1597
Message-Id: <20260401102247.21915-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36401.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 days agoUse ASN1_BIT_STRING_get_bit to check for netscape certificate usage
Arne Schwabe [Sat, 4 Apr 2026 07:23:30 +0000 (09:23 +0200)] 
Use ASN1_BIT_STRING_get_bit to check for netscape certificate usage

The ASN_BIT_STRING object has become opaque in OpenSSL 4.0. So instead
of accessing the internal, we have to use a method now to check these
attributes.

The bit counting in ASN.1 and of this method is a bit strange and
it will count bits from the left instead of the right, so the previous
mask of 0x80 for clients is now 0 and 0x40 for server is now 1.

Change-Id: I77500d435f212a4bf42ee8cfca07d0285fe694f2
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1587
Message-Id: <20260404072336.30014-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36446.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
10 days agoUpdate --learn-address man page with ipv6 information
Greg Cox [Mon, 30 Mar 2026 23:13:56 +0000 (23:13 +0000)] 
Update --learn-address man page with ipv6 information

The `--learn-address` option is very v4-specific in its man page.
This expands the docs based on things I tripped over when bringing
up a dual-stack server.

Signed-off-by: Greg Cox <gcox@mozilla.com>
Github: closes OpenVPN/openvpn#1009

Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20260330231355.84547-2-gcox@mozilla.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36363.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
10 days agossl_ncp: Fix type of "found" parameter of check_pull_client_ncp
Frank Lichtenheld [Tue, 31 Mar 2026 06:01:05 +0000 (08:01 +0200)] 
ssl_ncp: Fix type of "found" parameter of check_pull_client_ncp

In commit 91fd9614f980b02772e4dfbb09144c822ec97df0 type
of "found" was changed to uint64_t. But due to -Wconversion
not yet enabled in all of init.c one occurence of the old
type was missed.

Change-Id: I1a6dfc175075636bc7a5761215547077a9dc397a
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1594
Message-Id: <20260331060112.5195-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36364.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 days agobuffer: Avoid sign-compare warnings
Frank Lichtenheld [Mon, 30 Mar 2026 11:36:39 +0000 (13:36 +0200)] 
buffer: Avoid sign-compare warnings

- Switch buffer_list size and max_size to size_t
- Guard some unavoidable size_t -> int conversions

Change-Id: Iecc3e3d5d13cb85c1f287ad4816e1e6a7b2bcdef
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1561
Message-Id: <20260330113648.19896-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36335.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 days agowfp_block: Avoid sign-compare warning with Fwpm* return types
Frank Lichtenheld [Mon, 30 Mar 2026 11:38:19 +0000 (13:38 +0200)] 
wfp_block: Avoid sign-compare warning with Fwpm* return types

FWP_E_ALREADY_EXISTS is explictly casted to HRESULT which
is LONG. But Fwpm* return DWORD. So if you compare an expected
result with the actual result you get an sign-compare warning...

Change-Id: I2f6502da1832edcb273a0dfa9b3ef940bec2d711
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1506
Message-Id: <20260330113826.20057-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36337.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 days agoAdd an optional username-only flag for auth-user-pass
Selva Nair [Tue, 3 Mar 2026 14:28:14 +0000 (15:28 +0100)] 
Add an optional username-only flag for auth-user-pass

Specify "--auth-user-pass username-only" for openvpn to prompt
for only username, not password. Prompt via management interface
uses the usual ">PASSWORD 'Auth' " prompt with type "username"
instead of "username/password".

Internally, the password gets set as "[[BLANK]]" which is currently
used as tag for blank password.

Not compatible with --static-challenge or when username and
password are inlined or read from a file. In such cases, the user
hard-code a dummy password in the file instead.

Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
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/+/1548
Message-Id: <20260303142819.6123-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35855.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 days agosocket: restore per-connection lport override over global default
Gianmarco De Gregori [Mon, 16 Mar 2026 13:48:36 +0000 (14:48 +0100)] 
socket: restore per-connection lport override over global default

OpenVPN 2.7.x introduced a regression where --lport specified
inside a <connection> block did not override a globally defined
local port. As a result, the socket was bound to the global
default port instead of the per-connection value.

Adjust the socket local_port selection logic to honour
local_port_defined when set for the active connection profile.

This change restores the documented and previously working
behaviour from 2.6.x, where connection-level lport takes
precedence over global defaults.

Github: closes OpenVPN/openvpn#995

Change-Id: I7cf5d5ef7e2531f397ad97baf4663e3763072f6b
Signed-off-by: Gianmarco De Gregori <gianmarco@mandelbit.com>
Acked-by: Antonio Quartulli <antonio@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1555
Message-Id: <20260316134841.28362-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36164.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
11 days agotests: skip test execution when cross-compiling
Haixiao Yan [Thu, 26 Mar 2026 06:20:16 +0000 (14:20 +0800)] 
tests: skip test execution when cross-compiling

The auth-pam unit test Makefile.am unconditionally assigns the TESTS variable,
causing test execution to fail during cross-compilation because the target
binaries are not executable on the build host.

Signed-off-by: Haixiao Yan <haixiao.yan.cn@windriver.com>
Acked-By: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20260326062016.3856597-1-haixiao.yan.cn@windriver.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36288.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
13 days agoChange type of option flag from unsigned int to uint64_t
Arne Schwabe [Wed, 25 Mar 2026 12:43:38 +0000 (13:43 +0100)] 
Change type of option flag from unsigned int to uint64_t

We currently use all 32 bits of the unsigned int for option classes.
While we can probably can retire 2-3 of the existing options, at some
point we will hit the limit again.

Instead of fully rewriting this logic to use a different approach or
structure, changing the type from unsigned int to uint64_t seem to be
a lot less intrusive approach.

Change-Id: I8ca07e2bbb5de229204191d61e90f084a58969af
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1583
Message-Id: <20260325124338.123477-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36266.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoauth_token: Clean up type handling in verify_auth_token and its UT
Frank Lichtenheld [Thu, 12 Mar 2026 17:31:38 +0000 (18:31 +0100)] 
auth_token: Clean up type handling in verify_auth_token and its UT

First of all remove the testing of renegotiation_seconds.
Commit 9a5161704173e31f2510d3f5c29361f76e275d0f made it
irrelevant for verify_auth_token but still left UTs for it.
But AFAICT these UTs only test that renegotiation_seconds
is bigger than auth_token_renewal, so it tests the UT
setup routine...

Also improve the code to require less casts under
-Wsign-compare.

Add a comment that this code is not y38 safe if time_t
is 32bit. Probably nothing we want to do from our side
since in that case everything that uses "now" is borked.
So we trust in the OS here...

Change-Id: I73dba29719ea685f0427a3c479e7f1f176f09eba
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1510
Message-Id: <20260312173144.15602-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36079.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoIncrease default size of internal hash maps to 4 * --max-clients
Arne Schwabe [Wed, 25 Mar 2026 12:45:26 +0000 (13:45 +0100)] 
Increase default size of internal hash maps to 4 * --max-clients

The default of 256 seems quite low as with (at least) 1024 possible
entries (the --max-clients default setting) we have a guaranteed
collisions. Using 4 times the number of possible entries for real
addresses should reduce collisions quite a bit while also leaving
some headroom for the virtual addresses hash where a client might
have more than one address.

A reason to keep the limit so low are the memory requirements. Each
bucket has the size of one linked-list pointer (4 byte or 32 bit and
8 byte for 64 bit). So 256 buckets use 1 or 2 kB while 4096 will use
16 kB or 32 kB.

When the current limit was set 20 years ago this might have been a
meaningful memory saving but today the collision probability is
more important.

Change-Id: Ia699b0dfa407ac377970bb130434298eaaec592b
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Antonio Quartulli <antonio@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1563
Message-Id: <20260325124526.124049-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36268.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoUse const specifices in extract_x509_field_ssl
Arne Schwabe [Thu, 26 Mar 2026 11:06:52 +0000 (12:06 +0100)] 
Use const specifices in extract_x509_field_ssl

The new OpenSSL 4.0 will return const objects from these objects, so
make them const in our code as well.

Change-Id: Ia43bb88d9ddf2e82c638011353a64c770f2c2c0a
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1588
Message-Id: <20260326110658.25741-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36291.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoDo not support tls_ctx_set_cert_profile on AWS-LC
Arne Schwabe [Sun, 22 Mar 2026 11:12:01 +0000 (12:12 +0100)] 
Do not support tls_ctx_set_cert_profile on AWS-LC

SSL_CTX_set_security_level does nothing on AWS-LC and gives a deprecated
warning on compile. It is better to give the user a warning than to
effectively silently ignore it as well.

Change-Id: I74841d3611c62d3c59fc839bc73a0c83ce025262
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1579
Message-Id: <20260322111207.8346-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36243.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agossl_verify_openssl: use official ASN1_STRING_ API
Rudi Heitbaum [Mon, 23 Mar 2026 12:19:00 +0000 (13:19 +0100)] 
ssl_verify_openssl: use official ASN1_STRING_ API

ASN1_STRING are now opaque types in OpenSSL 4.x â€” the internal data and
length fields are no longer directly accessible. Use the accessor API
instead. Accessors have been available since OpenSSL 1.1.0

The ASN1_STRING_length accessor is already in use, but not consistently
applied. Standardise on using ASN1_STRING_length and ASN1_STRING_get0_data
which allows for successful build of OpenSSL 4.x

Change-Id: I8adffc3152b5b502a820a8ae0f901717e4831f81
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1584
Message-Id: <20260323121908.730-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36254.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoUse openssl_err_t typedef to deal with difference between TLS libraries
Arne Schwabe [Sun, 22 Mar 2026 11:11:15 +0000 (12:11 +0100)] 
Use openssl_err_t typedef to deal with difference between TLS libraries

AWS-LC and OpenSSL disagree on the type of that errors are reported in.

Instead of having a lot of glue code and casting back and forth, use a
typedef to always use the right type.

Change-Id: I4adbdf0c8b82fd7de309aa5f6f3b0c8157c5ffe7
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1578
Message-Id: <20260322111131.8251-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36242.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoGHA: Cache built crypto libraries
Arne Schwabe [Sun, 22 Mar 2026 10:38:13 +0000 (11:38 +0100)] 
GHA: Cache built crypto libraries

Semver code changes by Frank

Change-Id: Ie21fdb01b843a7af09fcd469b08c775eee7e3745
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1577
Message-Id: <20260322103820.4717-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36238.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agossl_mbedtls: Avoid conversion and sign-compare warnings
Frank Lichtenheld [Sat, 14 Mar 2026 17:09:43 +0000 (18:09 +0100)] 
ssl_mbedtls: Avoid conversion and sign-compare warnings

Change-Id: I777a3a5f4f137432a19746972e2aad1732184feb
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1559
Message-Id: <20260314170948.2898-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36137.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoRemove unnecessary OpenSSL init and cleanup commands in unit tests
Arne Schwabe [Mon, 16 Mar 2026 12:11:48 +0000 (13:11 +0100)] 
Remove unnecessary OpenSSL init and cleanup commands in unit tests

After the removal of OpenSSL 1.0.2 support these instructions are
no longer needed and the main OpenVPN program also no longer calls
them in init_ssl_lib or free_ssl_lib.

Also remove them from the unit tests. This also solves a
deprecation warning on EVP_cleanup when compiling with aws-lc

Change-Id: I228f6fd9ff18256f09d4348df1fc48853f8e7306
Signed-off-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1568
Message-Id: <20260316121148.25189-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36153.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agocrypto: Change cipher_kt_*_size to return unsigned instead of int
Frank Lichtenheld [Fri, 13 Mar 2026 17:52:04 +0000 (18:52 +0100)] 
crypto: Change cipher_kt_*_size to return unsigned instead of int

OpenSSL uses int but never returns negative values.
mbedTLS < 4 uses size_t and mbedTLS >= 4 doesn't have
its own implementation, so we can choose.

We chose unsigned int since size_t seems a bit silly for
values that are never even close to UINT_MAX.
Making it unsigned makes it easier in most cases to write
code that doesn't have sign-compare issues.

Also change cipher_ctx_iv_length and cipher_ctx_block_size
to return an unsigned value for similar reasons.

v7:
 - switch to unsigned int instead of size_t

Change-Id: I1bc576c4c7ffacbb9300608d98b06b22f2475fd9
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1508
Message-Id: <20260313175209.12024-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36114.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agodoc: fix typo with --ingore-unknown-option
Heiko Hund [Fri, 13 Mar 2026 10:46:15 +0000 (11:46 +0100)] 
doc: fix typo with --ingore-unknown-option

Change-Id: Ie502c982bda67d55ee74e4f2f66c26ea82698e60
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1575
Message-Id: <20260313104615.15951-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36085.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agodoc: improve Windows-specific options section
Heiko Hund [Fri, 13 Mar 2026 10:37:07 +0000 (11:37 +0100)] 
doc: improve Windows-specific options section

Change-Id: I29a33ac23f3c1a7cf16196aecc46ec3597a22175
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1574
Message-Id: <20260313103707.14534-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36084.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agosystemd: Change LimitNPROC to TasksMax and increase limit
Frank Lichtenheld [Fri, 13 Mar 2026 22:38:28 +0000 (23:38 +0100)] 
systemd: Change LimitNPROC to TasksMax and increase limit

There were some complaints about valid setups
that ran into problems with LimitNPROC. This
is especially true since LimitNPROC limits
the total amounts of threads running for the
same uid, so if multiple openvpn services run
under the same user, they will compete for
resources. As suggested in the systemd
documentation change this to TasksMax which
really counts the threads running in one
specific service.

Also increase the limit. When using e.g.
resolvconf for DNS configuration the limit
can be exhausted just due to the amount of
nested shell scripts.

Github: Fixes OpenVPN/openvpn#929
Change-Id: Ic877f9a9c6459c6eb97cde1099f47f0b196b8084
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1539
Message-Id: <20260313223833.3813-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36123.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoShow version and double check we use the right TLS library in Github Actions
Arne Schwabe [Fri, 13 Mar 2026 17:53:16 +0000 (18:53 +0100)] 
Show version and double check we use the right TLS library in Github Actions

We recently discovered that the AWS-LC builds in Github Actions were
actually using OpenSSL. This will now cause an error if something like
this happens in the future again.

Change-Id: Ia929c949cceaabe21a2937ad3217052aec4b2b4c
Signed-off-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1566
Message-Id: <20260313175324.12121-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36115.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoGHA: Install aws-lc under /opt/aws-lc
Arne Schwabe [Fri, 13 Mar 2026 15:30:01 +0000 (16:30 +0100)] 
GHA: Install aws-lc under /opt/aws-lc

The previous installation inside the OpenVPN workspace directory
caused the AWS-LC installation to be deleted. And that caused to OpenSSL
to be used instead of AWS-LC during the build

This also removes the --enable-werror flag from AWS-LC because it
currently not even close to build without warnings.

Change-Id: I090f5b201d67f51d2e42df1914a8466bcfcb6bf8
Signed-off-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1565
Message-Id: <20260313153007.31810-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36106.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoAWS-LC: Add missing return and cast in ssl_tls1_PRF
Arne Schwabe [Fri, 13 Mar 2026 15:30:27 +0000 (16:30 +0100)] 
AWS-LC: Add missing return and cast in ssl_tls1_PRF

Change-Id: I7843ff1422cc3b46870749b2daab1698646d43eb
Signed-off-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1567
Message-Id: <20260313153034.31872-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36107.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoAdd siphash reference implementation
Arne Schwabe [Thu, 12 Mar 2026 15:33:23 +0000 (16:33 +0100)] 
Add siphash reference implementation

OpenSSL only supports SIPHASH with OpenSSL 3.1 and newer. The source code of
siphash is quite small and has very liberal CC0 license, so include it instead
of pulling an extra library for it.

Change-Id: I1292894fe7f537049a97bee97af4419e5e854a00
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: MaxF <max@max-fillinger.net>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/29
Message-Id: <20260312153329.4700-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36072.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoerror: Use SOCKET_UNDEFINED instead of -1 to avoid sign error on Windows
Frank Lichtenheld [Thu, 12 Mar 2026 07:41:18 +0000 (08:41 +0100)] 
error: Use SOCKET_UNDEFINED instead of -1 to avoid sign error on Windows

While here also mark a comparison we know is safe
with an explicit cast.

Change-Id: I96b6acffd7e5149d4c9488a06e43c62711b31cfc
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1501
Message-Id: <20260312074123.30838-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36046.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agotls_crypt: Avoid a sign-compare warning
Frank Lichtenheld [Fri, 6 Mar 2026 16:30:04 +0000 (17:30 +0100)] 
tls_crypt: Avoid a sign-compare warning

We already checked that this isn't negative
so just use a cast.

Change-Id: Ibc7a6d8c61b9e584bf5d2d13fb5072b7a28fc53b
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1524
Message-Id: <20260306163010.2437-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35959.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agosocket: Avoid sign-compare issue by comparing before assignment
Frank Lichtenheld [Fri, 6 Mar 2026 16:31:56 +0000 (17:31 +0100)] 
socket: Avoid sign-compare issue by comparing before assignment

The assignment implicitly converts the values, but
we can just do the comparison before the assignment.

Change-Id: Idf5ce8f82e7727505cce67560e0b7423b8e41a40
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1523
Message-Id: <20260306163202.2586-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35961.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoDNS/DHCP: Make _len attributes consistently unsigned
Frank Lichtenheld [Wed, 11 Mar 2026 19:59:20 +0000 (20:59 +0100)] 
DNS/DHCP: Make _len attributes consistently unsigned

Use unsigned int instead of size_t since 32bit
values are quite enough here and this avoids some
unneccesary casts.

Change-Id: Id2c5df9df32a02e944e13b55f57a2c1928b652f4
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1520
Message-Id: <20260311195925.5600-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36038.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoWin32: Make interface index DWORD consistently
Frank Lichtenheld [Wed, 11 Mar 2026 16:38:45 +0000 (17:38 +0100)] 
Win32: Make interface index DWORD consistently

Previously we had a weird mix of int and DWORD. But the
Win32 APIs seem to be consistent (they have different names,
but NET_IFINDEX is ULONG is DWORD). So use that.

Note that this fixes some smaller issues in surrounding
code that are not strictly related but were found while
scanning the code. Mostly about needlessly converting
all DWORD values to int for printf().

Change-Id: I38bb2d1fa66c543e8bcf47b7d77b6154d1895f81
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1519
Message-Id: <20260311163852.21387-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36021.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agotun: Avoid sign-compare issues in tun_read_queue
Frank Lichtenheld [Fri, 6 Mar 2026 16:29:19 +0000 (17:29 +0100)] 
tun: Avoid sign-compare issues in tun_read_queue

Just use the same type that the other values
already have.

While here review and remove some other useless
casts in msg() calls.

Change-Id: Ifc7ad2407b9cca8cfcef79d7392a058735416139
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1525
Message-Id: <20260306162925.2359-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35956.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agossl_verify_openssl: Clean up extract_x509_extension
Frank Lichtenheld [Mon, 9 Mar 2026 13:32:36 +0000 (14:32 +0100)] 
ssl_verify_openssl: Clean up extract_x509_extension

* Avoid sign-compare warning when comparing string
  lengths
* Use the nicer alias rfc822Name instead of the general ia5
  from the GENERAL_NAME union.
* Use the official ASN1_STRING_length API instead of accessing
  the struct directly.
* C11 changes

Change-Id: I23cc00aee47aef007ab2e7d50b52c6de299505db
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1507
Message-Id: <20260309133236.29732-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35980.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoopenvpnmscia: Improve check of vsnprintf return value
Frank Lichtenheld [Sat, 7 Mar 2026 09:16:44 +0000 (10:16 +0100)] 
openvpnmscia: Improve check of vsnprintf return value

Avoid sign-compare warning and do not ignore error
return values.

Change-Id: Ia57fa6d2469be08343c0457dd0213f062bc4cfa5
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1504
Message-Id: <20260307091654.21823-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35972.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agodoc: fix client-nat syntax and examples
Ralf Lici [Mon, 9 Mar 2026 13:05:40 +0000 (14:05 +0100)] 
doc: fix client-nat syntax and examples

The client-nat documentation uses an incorrect command form and
incomplete examples.

Document the actual syntax accepted by openvpn:
  client-nat snat|dnat network netmask alias

Update examples to include all required arguments and rewrite the
explanatory text to describe 'network', 'netmask', and 'alias'
separately.

Documentation-only change; no behavior change.

Change-Id: I89f0aa9a23915c7783ae03793080ee989a437208
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1560
Message-Id: <20260309130546.7735-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35966.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoFix various sign-compare warnings due to write return value
Frank Lichtenheld [Fri, 6 Mar 2026 16:33:31 +0000 (17:33 +0100)] 
Fix various sign-compare warnings due to write return value

write takes size_t as count (unsigned int on
Windows) and returns ssize_t (int on Windows).
But we often want to compare the return value
to the count.

Generally we can just rely on the fact that
sizeof(ssize_t) == sizeof(size_t) and use that
for all values. (Until we want to introduce
-Wsign-conversion that is...)

Change-Id: I3eb4581980f532cb2960b37a6fa43a7baee4b603
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1513
Message-Id: <20260306163337.2756-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35963.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoUse USER_PASS_LEN for private key password buffer size
Selva Nair [Thu, 5 Mar 2026 06:59:45 +0000 (07:59 +0100)] 
Use USER_PASS_LEN for private key password buffer size

GitHub: fixes OpenVPN/openvpn#993

Change-Id: I5e17e184f666317df21460108da4f70670358ece
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/+/1553
Message-Id: <20260305065952.24348-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35914.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoroute: Fix type of rgi_needed variables
Frank Lichtenheld [Thu, 5 Mar 2026 08:49:08 +0000 (09:49 +0100)] 
route: Fix type of rgi_needed variables

To avoid unneccesary sign-compare warnings.

Change-Id: I2b2a931e13670d753aa9570efe498647ba1a4a7f
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1505
Message-Id: <20260305084914.1327-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35926.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoopenvpnserv: Improve sanity check for addr_len in HandleWINSConfigMessage
Frank Lichtenheld [Thu, 5 Mar 2026 08:46:04 +0000 (09:46 +0100)] 
openvpnserv: Improve sanity check for addr_len in HandleWINSConfigMessage

Handle the case where the int is negative
explicitly. Zero is probably a safer value
to assume in this case.

Change-Id: I03f4c640a2adbea9bbb6f6334f12375041ec429c
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1496
Message-Id: <20260305084610.1038-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35923.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agopush: Improve check of vsnprintf return value
Frank Lichtenheld [Wed, 4 Mar 2026 16:48:58 +0000 (17:48 +0100)] 
push: Improve check of vsnprintf return value

Avoid sign-compare warning and do not ignore error
return values.

Change-Id: I7be033bc88e9a6ba474916c8be039c126e8bc574
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1502
Message-Id: <20260304164904.15743-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35905.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agocryptoapi: Change signature of parse_hexstring to match code
Frank Lichtenheld [Wed, 4 Mar 2026 16:44:55 +0000 (17:44 +0100)] 
cryptoapi: Change signature of parse_hexstring to match code

parse_hexdigest is a function that is used in
exactly one place (not counting tests). So
change the types in a way that they match what
the caller actually wants (DWORD) and so we
do not have any unnecessary conversions.

Change-Id: I525a5b1b9b6f173cdf12341aefc44d58f0d43aed
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Antonio Quartulli <antonio@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1492
Message-Id: <20260304164502.15449-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35901.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agowin32-util: Handle return value from WideCharToMultiByte better
Frank Lichtenheld [Wed, 4 Mar 2026 16:49:22 +0000 (17:49 +0100)] 
win32-util: Handle return value from WideCharToMultiByte better

Handle the case where the return value is zero
and avoid sign-compare warning.

Change-Id: I4ff7983a33426fda9a138fe6e56a1c03522836d3
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1495
Message-Id: <20260304164928.15819-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35906.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agovcpkg-ports: Review pkcs11-helper port
Frank Lichtenheld [Thu, 12 Feb 2026 11:09:35 +0000 (12:09 +0100)] 
vcpkg-ports: Review pkcs11-helper port

- Replace deprecated functions with newer alternatives
- Improve vcpkg.json by documenting openssl dependency
- Remove unnecessary duplicated version number
- Fix whitespaces

Change-Id: I7462869a473a7afe2e9ed9474c69de0af96c011c
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Yuriy Darnobyt <yura.uddr@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1518
Message-Id: <20260212110935.19541-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35599.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agoargv: Fix one type to avoid sign-compare warning
Frank Lichtenheld [Wed, 4 Mar 2026 14:40:54 +0000 (15:40 +0100)] 
argv: Fix one type to avoid sign-compare warning

len is already int, no need to throw another
type into the mix.

Change-Id: Ida8e587a095bdfb821ee0a4783633f026d310476
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1494
Message-Id: <20260304144059.2518-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35891.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agossl_openssl: Use correct return type for RSA_size
Frank Lichtenheld [Wed, 4 Mar 2026 14:40:21 +0000 (15:40 +0100)] 
ssl_openssl: Use correct return type for RSA_size

It returns int, so use that. Avoids a sign-compare
warning.

Change-Id: Ie8135a31b1f8f70ce0ddf63d7653f3d84a9e983f
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1493
Message-Id: <20260304144028.2459-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35890.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agossl_ncp: Fix length check in mutate_ncp_cipher_list
Frank Lichtenheld [Mon, 2 Mar 2026 18:16:22 +0000 (19:16 +0100)] 
ssl_ncp: Fix length check in mutate_ncp_cipher_list

* Make it more readable by removing a level of negation
* Fix an off-by-one error. It accepted one char fewer than
  allowed.
* Slightly improve the UT.

Change-Id: Ib0d2b9520e4a77a9f4bf70ce092f76ca73608537
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1503
Message-Id: <20260302181627.29008-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35828.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agoEnable -Wsign-compare
Frank Lichtenheld [Wed, 4 Mar 2026 14:27:12 +0000 (15:27 +0100)] 
Enable -Wsign-compare

As we did before with -Wconversion, ignore existing
issues for now so that we can tackle them one-by-one.

Change-Id: I880cf01b0db80fc9b40ca4afa30aa51e3fb8ce3b
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1386
Message-Id: <20260304142720.1311-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35888.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agobuffer: Add checked_snprintf function and use it in the code
Frank Lichtenheld [Wed, 4 Mar 2026 11:04:49 +0000 (12:04 +0100)] 
buffer: Add checked_snprintf function and use it in the code

This reintroduces a function that converts the result
of snprintf to a boolean since the check is always the
same but annoyingly verbose. And it gets worse when you add
-Wsign-compare.

So in preparation of introducing -Wsign-compare wrap this
check in the function.

This somewhat reverts the removal of openvpn_snprintf.
But note that that was originally introduced to work
around the broken snprintf of Windows. So this is not
exactly the same. For this reason I also classified this
as a buffer function and not a compat function.

Change-Id: Ia3477b8ee7a637c15aad7f285144280595cda5d5
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1489
Message-Id: <20260304110455.15859-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35872.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agobuffer: Add BLENZ macro that returns size_t and use it where required
Frank Lichtenheld [Wed, 4 Mar 2026 10:59:38 +0000 (11:59 +0100)] 
buffer: Add BLENZ macro that returns size_t and use it where required

The big int-vs-size_t length confusion in buffer and its
users can't be solved easily or quickly. So as a first step
document which users of BLEN actually already want a size_t
return. This is better than adding manual size_t casts since
it should be easier to change the API later.

This will also help with the -Wsign-compare introduction.

This does not actually change any behavior. The compiler
already did all of these casts implicitly. We just make
them explicit.

Change-Id: I4e75ba1dbc6d9a0f75298bc900f713b67e60d096
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1132
Message-Id: <20260304105944.15386-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35870.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agobuffer: Clarify usage of char_class
Frank Lichtenheld [Wed, 4 Mar 2026 10:50:01 +0000 (11:50 +0100)] 
buffer: Clarify usage of char_class

Silence compiler warnings due to conversion from
char to unsigned char. In this case we actually
depend on this conversion.

Change-Id: I73bc163d48b2d6a954cd231961826f33143fcd12
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1142
Message-Id: <20260304105007.14485-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35867.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agoMerge stream_buf_get_next and stream_buf_set_next
Arne Schwabe [Mon, 16 Feb 2026 16:22:31 +0000 (17:22 +0100)] 
Merge stream_buf_get_next and stream_buf_set_next

The stream_buf_set_next prepares a buffer in the stream_buf
structure that will be retrieved by stream_buf_get the next
time it is used.

This temporary copy of the buffer is unnecessary as the buffer
next can also be constructed on the fly.

This also fixes a rare crash when read buffer are not initialised and
read is still signalled as the initialisation of next will now happen
whenever it is required.

This assertion happens when we do not expect a read event from the socket
and then in link_socket_read_tcp the function stream_buf_get_next can
trigger an assert on ASSERT(buf_defined(&sb->next));

To avoid this weird corner case, just always initialise the read buffer
whether or not we expect a read to occur.

This also adds documentation about the methods and field associated with
the stream_buf structure.

Reproducing this bug requires very special circumstances.  To reproduce,
run a client with

    openvpn --client --proto tcp --dev tap --ifconfig noexec ...

The client side must be on Linux. Other platforms do not reproduce this
bug.

Note that the client will not configure any IP or IPv6 on the interface
and will also not bring up the interface. The server must also send at least
one real data packet to the client (no keepalive ping). Just having the
interface up normally produces enough traffic.

Now forcefully reset the TCP connection. E.g. by executing on the client

    sudo ss --kill dport <server port>

This will now trigger the assertion. This happens since OpenVPN waits
forever to get a write back from the poll from the tun/tap device but
this never happens since the device is not up.

As long as we do not get back the tun device for writing, we also do
not put the socket back into the EVENT_READ state. And this also means
that code to initialise the read buffer (stream_buf_set_next) is never
run.

But the reset on the TCP socket triggers the TCP socket to be available
for read, even if it is just for a read of 0 bytes to indicate the reset.
So the function link_socket_read_tcp will run into the assert.

Change-Id: Ifd3e953104a67c8bf2a225e179865e3dbd0dbfbc
Signed-off-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1477
Message-Id: <20260216162236.22304-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35673.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agoDocument management client versions
Selva Nair [Mon, 2 Mar 2026 14:18:02 +0000 (15:18 +0100)] 
Document management client versions

Also add an enum to keep track of client version updates.

Change-Id: I1c01fa1bc7d65ac060b334724feb56ef4d0b5d35
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/+/1552
Message-Id: <20260302141811.5697-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35805.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agoAvoid unbounded allocations in pkcs11_mbedtls.c
Max Fillinger [Mon, 2 Mar 2026 14:20:39 +0000 (15:20 +0100)] 
Avoid unbounded allocations in pkcs11_mbedtls.c

The PKCS#11 provider can crash OpenVPN by making it try to allocate
2^64 bytes for a certificate. To avoid this, set a maximum size for
certificates. If the size is exceeded, don't try to allocate memory and
instead exit pkcs11_get_x509_cert with an error.

The chosen maximum size is 100.000 bytes which is twice the size of
a SLH-DSA (aka SPHINCS+) signature.

Found-by: ZeroPath (https://zeropath.com/)
Reported-by: Joshua Rogers <contact@joshua.hu>
Github: closes OpenVPN/openvpn-private-issues#42

Change-Id: I53d47e4a0d33c380ee95e0e33aecad3db3197940
Signed-off-by: Max Fillinger <maximilian.fillinger@sentyron.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1549
Message-Id: <20260302142045.5954-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35807.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agoGHA: Maintenance update February 2026
Frank Lichtenheld [Mon, 2 Mar 2026 15:25:04 +0000 (16:25 +0100)] 
GHA: Maintenance update February 2026

Switch libressl and mbedTLS 4 builds to Ubuntu 24.04.

Includes the following renovate changes:
- chore(deps): update dependency aws/aws-lc to v1.67.0
- chore(deps): update github actions
- chore(deps): update vcpkg digest to e5a1490

Change-Id: I4536e06b082ae17baba1490246244b5923063c93
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1540
Message-Id: <20260302152510.11918-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35813.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agooptions: drop useless init_gc param for init_options()
Antonio Quartulli [Tue, 17 Feb 2026 13:56:05 +0000 (14:56 +0100)] 
options: drop useless init_gc param for init_options()

The init_option() function is always invoked with the second
param "init_gc" set to "true".
This makes the parameter useless and it can therefore be removed
while always taking the "true" branch in the related logic.

This way we can also drop the options->gc_owned member as it
would also be always set to true.

Change-Id: I633d8cbf75ab4da85e16df44684aef60523811c5
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1536
Message-Id: <20260217135605.154129-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35695.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agodco_freebsd: use AF_LOCAL sockets for ioctl() communication with DCO driver
Gert Doering [Fri, 27 Feb 2026 22:47:39 +0000 (23:47 +0100)] 
dco_freebsd: use AF_LOCAL sockets for ioctl() communication with DCO driver

DCO FreeBSD uses ioctl() calls for userland -> driver communication, on
a socket() file descriptor.  The original code uses AF_INET sockets,
which fails if using a kernel compiled without IPv4 support.

The kernel side ioctl() handling does not differentiate between AF_INET,
AF_INET6 and AF_LOCAL sockets, and only the latter are guaranteed to be
present.

While add it, add a clear message if the socket() call in dco_available()
fails (it will lead to disabling of DCO).

FreeBSD PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=286263
Reported-by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
Change-Id: I84fe7a11391eafde3660d25a3c99094a0c525f3d
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Antonio Quartulli <antonio@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1551
Message-Id: <20260227224745.3175-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35795.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoFixup version command on management interface
Selva Nair [Tue, 24 Feb 2026 21:30:30 +0000 (22:30 +0100)] 
Fixup version command on management interface

All commands to the management interface are supposed to be
responded with either a one-line "SUCCESS:/ERROR:" message
or a multi-line reply terminated by "END". But, curently we
silently accept the "version n" command wih no response. This
causes clients like OpenVPN-GUI lock-up if version command is
used, waiting for ever for a reply.

Fix this by adding a SUCCESS response if client version
is set to a value >= 4. As the highest client version in use
until now is 3, this should not affect any work-arounds in
existing clients. ERROR response is generated if the version
parameter is null which never happens in practice.

Change-Id: I76dc80a9d9b29e401b7bbd59e0c46baf751d2e4a
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1528
Message-Id: <20260224213036.31845-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35782.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoconfigure.ac: adjust to native inotify support for FreeBSD 15+
Gert Doering [Fri, 20 Feb 2026 10:20:58 +0000 (11:20 +0100)] 
configure.ac: adjust to native inotify support for FreeBSD 15+

FreeBSD 15 has native inotify support, and no "libinotify.pc" pkg config
file anymore, plus no extra includes are needed.  This works fine if we
conditionalize the FreeBSD check to "freebsd-1[0-4]".

Due to m4 involvement double braces are needed for quoting.

See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293176

Reported-by: Ivo Karabojkov <karabojkov@kit.bg>
Reported-by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
Change-Id: Ie3f209a641c2f56494dfc7720b13f2a2ba3001a8
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Antonio Quartulli <antonio@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1535
Message-Id: <20260220102106.32024-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35761.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoFix various loop index types to avoid sign-compare issues
Frank Lichtenheld [Mon, 16 Feb 2026 21:27:56 +0000 (22:27 +0100)] 
Fix various loop index types to avoid sign-compare issues

Just uses the correct types i.e. the same as the limit.
Since the index is usually only used as a non-negative
array index the type change does not cause any behavioral
changes.

But it avoids -Wsign-compare complaints and is just
cleaner.

Change-Id: Ib6c3e154fbe14113ff990f13347f85a7c93dd3e0
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1491
Message-Id: <20260216212805.7808-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35682.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoDCO Linux: Fix setting DCO ifmode failing on big endian archs
Arne Schwabe [Thu, 19 Feb 2026 11:09:48 +0000 (12:09 +0100)] 
DCO Linux: Fix setting DCO ifmode failing on big endian archs

The problem is that SITNL_ADDATTR is not forcing type safety and on
big endian architcutre passing a smaller size than the underlying
integer type of data causes only the more significant byte(s) to be passed
instead.

A proper fix would be to add specific methods for common integer types like
SITNL_ADDATTR_u8, SITNL_ADDATTR_u16, SITNL_ADDATTR_u32 like netlink library
does with NLA_PUT_U32, NLA_PUT_U16, NLA_PUT_U8.

Change-Id: I560f45fb0011180be8ca2b0e7fbc63030fa10f35
Github: closes OpenVPN/ovpn-dco#96
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Antonio Quartulli <antonio@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1547
Message-Id: <20260219110954.21471-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35752.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoauth-pam: fix discards 'const' qualifier from pointer target type
Frank Lichtenheld [Wed, 18 Feb 2026 21:47:06 +0000 (22:47 +0100)] 
auth-pam: fix discards 'const' qualifier from pointer target type

strstr now returns const char*.

Change-Id: I632368451923116e0a169ddb5b6e86a8f8486afc
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1543
Message-Id: <20260218214712.27119-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35728.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agodns: fix discards 'const' qualifier from pointer target type
Rudi Heitbaum [Wed, 18 Feb 2026 21:47:33 +0000 (22:47 +0100)] 
dns: fix discards 'const' qualifier from pointer target type

Since glibc-2.43:

For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return pointers
into their input arrays now have definitions as macros that return a
pointer to a const-qualified type when the input argument is a pointer
to a const-qualified type.

fixes:
    src/openvpn/dns.c: In function 'dns_server_addr_parse':
    src/openvpn/dns.c:67:25: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
       67 |     char *first_colon = strchr(addr, ':');
          |                         ^~~~~~
    src/openvpn/dns.c:68:24: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
       68 |     char *last_colon = strrchr(addr, ':');
          |                        ^~~~~~~

Change-Id: I262705189edfbd9aa9a32bcd712840fffa592435
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1542
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20260218214738.27158-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35730.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoUnbreak Mbed TLS 4 build
Max Fillinger [Tue, 17 Feb 2026 17:13:00 +0000 (18:13 +0100)] 
Unbreak Mbed TLS 4 build

The previous Mbed TLS 4 change removed the mbedtls/version.h include
from syshead.h. But this include in mbedtls_compat.h where it's needed.

Also fix a warning by removing a size_t < 0 comparison.

Change-Id: Ia5d330fe5c922aaa6948c1fb05c9a4947c833311
Signed-off-by: Max Fillinger <maximilian.fillinger@sentyron.com>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1538
Message-Id: <20260217171306.31229-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35701.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoChange stream_buf_read_setup_dowork parameter to struct steam_buf
Arne Schwabe [Wed, 11 Feb 2026 15:07:47 +0000 (16:07 +0100)] 
Change stream_buf_read_setup_dowork parameter to struct steam_buf

This methods only ever access sock->stream_buf so make the method
simpler by just having a parameter sb.

Change-Id: I3deb7cd75db3cb280fa8d9c637cd3bde3881d6e3
Signed-off-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1483
Message-Id: <20260211150747.113906-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35595.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agocrypto_backend: Improve signature of md_full to avoid conversions
Frank Lichtenheld [Mon, 16 Feb 2026 15:07:05 +0000 (16:07 +0100)] 
crypto_backend: Improve signature of md_full to avoid conversions

Change-Id: I201abb9ef013c061fb568823098edcca32cb2df3
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1512
Message-Id: <20260216150711.16130-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35657.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoMbed TLS 3: Remove prediction resistance option
Max Fillinger [Mon, 16 Feb 2026 15:10:27 +0000 (16:10 +0100)] 
Mbed TLS 3: Remove prediction resistance option

The option --use-prediction-resistance causes the random number
generator to be reseeded for every call. This is excessive.

This commit removes that option.

Github: closes OpenVPN/openvpn#964

Change-Id: I6298795f140c2c62252638f9e0cd6df19cb3d7ed
Signed-off-by: Max Fillinger <maximilian.fillinger@sentyron.com>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1530
Message-Id: <20260216151033.16585-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35658.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoRemove NTLM support
Frank Lichtenheld [Mon, 16 Feb 2026 14:51:59 +0000 (15:51 +0100)] 
Remove NTLM support

Since Microsoft has abandonded this I think it is time
for us to do the same for OpenVPN 2.8.

Leaves a stub ntlm_support in to make cross-branch
t_client.rc easier to maintain.

Change-Id: I1f5724476862935284f620c54afa510eea03e3f9
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1453
Message-Id: <20260216145205.14958-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35650.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agorework all occurrences of 'M_ERR | M_ERRNO'
Gert Doering [Wed, 11 Feb 2026 15:06:48 +0000 (16:06 +0100)] 
rework all occurrences of 'M_ERR | M_ERRNO'

M_ERR is defined as (M_FATAL | M_ERRNO), so 'msg(M_ERR | M_ERRNO, ...)'
is just the same as 'msg(M_ERR, ...)'.

The occurances in tun.c and dco_freebsd.c are really "if this happens,
we can not go on" errors, so 'M_ERR' (= FATAL, plus log errno string)
is the correct thing to do.

The occurances in dns.c do come with error handling and cleanup after
the msg() call, so the right thing is 'M_WARN | M_ERRNO' instead
(warning, plus log errno string).

Github: fixes OpenVPN/openvpn#939

Change-Id: I14395665f197349e374a81b56f28536ff88937a8
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1517
Message-Id: <20260211150648.113547-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35594.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoclang-format: Add missing InsertBraces: true
Frank Lichtenheld [Mon, 16 Feb 2026 12:30:20 +0000 (13:30 +0100)] 
clang-format: Add missing InsertBraces: true

This takes care to add missing braces in
case of one-line if-statements or loops.

Apparently we never tested this specific error
and we had no existing cases in the code when
we did the reformat. Noticed this during a code
review.

Change-Id: Idb1e96a4d0a618089db4290c5980d192985b5d29
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1529
Message-Id: <20260216123026.3310-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35635.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoport-share: log incoming connections at verb 3 only
Gert Doering [Wed, 11 Feb 2026 11:33:10 +0000 (12:33 +0100)] 
port-share: log incoming connections at verb 3 only

From "day 1" the message "Non-OpenVPN client protocol detected" was
logged at D_STREAM_ERRORS level (verb 1), while it is not anything
erroneous in this context (it's inside an "port share" only block).

Bump this to D_PS_PROXY (verb 3).

Github: closes OpenVPN/openvpn#976

Change-Id: Ie5c9a88050de959cfb02e5f804323a8081ddb667
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1516
Message-Id: <20260211113315.25776-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35589.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
8 weeks agostart release/2.8 development cycle start_of_2.8
Gert Doering [Fri, 13 Feb 2026 12:10:24 +0000 (13:10 +0100)] 
start release/2.8 development cycle

this commit starts work on "master" after branching off "release/2.7"
-> version.m4 set to "2.8_git", ChangeLog emptied, Changes.rst prepared
for notable news in Release 2.8

Signed-off-by: Gert Doering <gert@greenie.muc.de>
8 weeks agoOpenVPN Release 2.7.0 v2.7.0
Gert Doering [Tue, 10 Feb 2026 11:09:41 +0000 (12:09 +0100)] 
OpenVPN Release 2.7.0

version.m4, ChangeLog, Changes.rst

Only very minor differences to the last release candidate, 2.7_rc6.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
8 weeks agoReview Changes.rst for 2.7.0 release
Frank Lichtenheld [Tue, 10 Feb 2026 16:20:33 +0000 (17:20 +0100)] 
Review Changes.rst for 2.7.0 release

Fixes various issues, either errors or things
that got outdated during development.

Change-Id: Idd079f42fac1189c08c6cf42ea84fa8c0383e1a8
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1515
Message-Id: <20260210162038.7915-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35574.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
8 weeks agoUpdate the clang-format reference version to 21.1.8
Frank Lichtenheld [Tue, 10 Feb 2026 15:16:31 +0000 (16:16 +0100)] 
Update the clang-format reference version to 21.1.8

Latest v21.x version.
Changes a few file in Windows specific code due
to bug fixes.

Change-Id: Iaf0d8f528211f1971f163a8006b054efb4917e2a
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1514
Message-Id: <20260210151639.913-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35563.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
8 weeks agocrypto: Do not claim we will remove support for BF-CBC in 2.7
Frank Lichtenheld [Tue, 10 Feb 2026 15:20:30 +0000 (16:20 +0100)] 
crypto: Do not claim we will remove support for BF-CBC in 2.7

Change-Id: Ie35099b114c510e55292090c34b9d950b1f03947
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1511
Message-Id: <20260210152035.1273-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35565.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
8 weeks agoMbed TLS 4: Add more algorithms
Max Fillinger [Fri, 30 Jan 2026 07:11:31 +0000 (08:11 +0100)] 
Mbed TLS 4: Add more algorithms

Expand the tables of hash functions and elliptic curve groups, and also
check if they are compiled in.

Change-Id: I740991f22b728fe2f5a48bc18d5ca4b62f56f399
Signed-off-by: Max Fillinger <maximilian.fillinger@sentyron.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1500
Message-Id: <20260130071137.14398-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35507.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agoOpenVPN Release 2.7_rc6 v2.7_rc6
Gert Doering [Wed, 28 Jan 2026 13:33:08 +0000 (14:33 +0100)] 
OpenVPN Release 2.7_rc6

version.m4, ChangeLog, Changes.rst

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

Notable changes rc5 -> rc6 are:
    - bugfix on restarting a p2mp server instance with SIGUSR1 (inadvertedly
      closing fd 0, causing a crash on the next restart - GH #966)
    - prevent NULL pointer crash on suitable combination of --dns-updown
      statements in openvpn config file (not pushable)
    - prevent inappropriate management interface activity if a password is
      set and --management-forget-disconnect or --management-signal are active
    - more conversion warnings fixed
    - Windows: interactive service - some initial unit tests added for the
      most complex string conversion function (ConvertItfDnsDomains())
    - remove #ifdefs around socket sendbuf/receive buf handling, assuming that
      all platforms that have POSIX sockets have this.
    - add mbedTLS 4 support
    - fix check for failed fork() in port-share code

Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agotunnel_server(): close correct inotify fd
Gert Doering [Wed, 28 Jan 2026 11:04:19 +0000 (12:04 +0100)] 
tunnel_server(): close correct inotify fd

On a full SIGUSR1 restart of a p2mp server compiled with
--enable-async-push, tunnel_server() will try to close and reopen
the "inotify" control file descriptor.  For whatever reason, the
original code referenced the wrong context, always closing fd 0.

As a consequence of this, on the second SIGUSR1 restart, the server
will close() the first active socket file descriptor, and if there
are active DCO clients, the resulting event confusion will lead to
an ASSERT(!mi->halt).

Fix by closing the correct FD. Add logging.

Github: fixes OpenVPN/openvpn#966

Change-Id: Iabc117848ad7b67d240c392f1a6aa2d7531fd5bb
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1497
Message-Id: <20260128110425.24350-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35478.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agoPrevent NULL pointer dereference with --dns-updown
Heiko Hund [Wed, 28 Jan 2026 11:04:37 +0000 (12:04 +0100)] 
Prevent NULL pointer dereference with --dns-updown

If the dns-updown option appears in the config twice, there is a chance
of a NULL pointer dereference when comparing the script path to the
default script path. This happens when a custom script is set, after the
dns-updown script was disabled first. In that case the script path is
NULL, which leads to the deref during a strcmp(3).

Reported-by: <aarnav@srlabs.de>
Change-Id: Id530d890ba01cffb74d3dc04ad10b153f7bea1d4
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1498
Message-Id: <20260128110443.24410-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35479.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agomanage: Do not trigger actions on management disconnect if not authenticated
Frank Lichtenheld [Thu, 22 Jan 2026 12:57:07 +0000 (13:57 +0100)] 
manage: Do not trigger actions on management disconnect if not authenticated

If the management interface requires authentication via password
and the remote did not specify it, do not do trigger actions
requested by --management-forget-disconnect and --management-signal
on disconnect.

Reported-By: Joshua Rogers <contact@joshua.hu>
Found-By: ZeroPath (https://zeropath.com)
Github: openvpn-private-issues#5
Change-Id: I575d65912ce9065a0b0868e73998b4a9aece62af
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1484
Message-Id: <20260122125707.108048-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35390.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agostatus: Avoid conversion warnings in status_read/status_printf
Frank Lichtenheld [Thu, 22 Jan 2026 15:47:51 +0000 (16:47 +0100)] 
status: Avoid conversion warnings in status_read/status_printf

Just use explicit casts. len is limited by BCAP and
c is limited by being from buf_read_u8. So they are
safe.

In case of status_printf this is only for Windows.
len is limited by sizeof(buf), so also a safe cast.

Change-Id: Iff1343a2f8cc7e32b8f36b359a00248e4dc3e8c9
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1485
Message-Id: <20260122154751.155227-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35398.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agoGHA: Run openvpnserv UT for MinGW builds
Frank Lichtenheld [Mon, 26 Jan 2026 15:11:16 +0000 (16:11 +0100)] 
GHA: Run openvpnserv UT for MinGW builds

Should have been added in commit
b10ee38ccde5f155d02fcd3e8f1b1ab454826ab0.

Note that test_openvpnserv.exe lives in a
separate directory, so we need to make the
code a bit more flexible.

Change-Id: If61a91b4580864fd22162c94467ba3dda2045b7b
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1487
Message-Id: <20260126151122.588-1-gert@greenie.muc.de>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agotest_openvpnserv: Make sure to include config.h
Frank Lichtenheld [Mon, 26 Jan 2026 14:55:53 +0000 (15:55 +0100)] 
test_openvpnserv: Make sure to include config.h

Otherwise the check for cmocka version doesn't
work. Includes the update to vcpkg in GHA since
that exposed the problem.

chore(deps): update vcpkg digest to 6d332a0

Change-Id: I3b246bcc36ba35c2ed9630dc18e97aff436eaa0b
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1488
Message-Id: <20260126145558.31460-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35437.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agosocket: Remove ifdef for SO_{RCV, SND}BUF
Frank Lichtenheld [Mon, 26 Jan 2026 14:54:26 +0000 (15:54 +0100)] 
socket: Remove ifdef for SO_{RCV, SND}BUF

Seems all our platforms define it.

Reported-by: Marc Heuse <marc@srlabs.de>
Github: Fixes OpenVPN/openvpn#965
Change-Id: I87679949bdef6319d7490d561f0136633244c2b9
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1486
Message-Id: <20260126145432.31249-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35435.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>