]> git.ipfire.org Git - thirdparty/openvpn.git/log
thirdparty/openvpn.git
8 days agoGHA: Add minGW Release build
Frank Lichtenheld [Mon, 8 Dec 2025 17:09:32 +0000 (18:09 +0100)] 
GHA: Add minGW Release build

There are sometimes differences in the build results.

Change-Id: I9e1d935f617db9198ed5934b88c0fcdef61a8568
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1421
Message-Id: <20251208170937.5221-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34896.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
8 days agosocket: Initialize struct in_addr_t in getaddr()
Frank Lichtenheld [Mon, 8 Dec 2025 17:03:13 +0000 (18:03 +0100)] 
socket: Initialize struct in_addr_t in getaddr()

We have false-positive "‘addr’ may be used uninitialized"
warnings with MinGW 13.0.0 compiler. Work around them.

Change-Id: I999916f9561a638214b70cf43de78060e9e0e792
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1420
Message-Id: <20251208170320.4696-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34894.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
8 days agoCMake: For VS build, switch from /W2 to /W3
Frank Lichtenheld [Mon, 8 Dec 2025 11:36:30 +0000 (12:36 +0100)] 
CMake: For VS build, switch from /W2 to /W3

But exclude the added checks that currently have failures
so that we can keep /WX enabled.
Basically this excludes -Wconversion and -Wsign-compare,
as expected from our GCC/Clang flags.

Github: #382
Change-Id: Iffc114939cb37129057e9c4864fae9e09c3c7fe4
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1417
Message-Id: <20251208113636.9650-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34876.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
8 days agoDocumentation: Various syntax fixes and text improvements
Frank Lichtenheld [Mon, 8 Dec 2025 11:42:18 +0000 (12:42 +0100)] 
Documentation: Various syntax fixes and text improvements

This started as a fix for OpenVPN/openvpn#606 but while
reviewing the documentation referenced from there I
identified more and more issues.

There a few classes of changes in here:
- Fix wrong `...` syntax, which makes no sense in rst.
- Remove some very old references to OpenVPN v1 behavior.
- Fix typos or other small text issues.

Note: The usage of ``...`` vs :code:`...` is very
inconsistent, but fixing that is outside of the scope
of this patch. I have tried to make it at least
locally consistent.

Github: Fixes OpenVPN/openvpn#606
Change-Id: Iee535f1502ab3dcb7bde7f2593c2e122d27d9189
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1414
Message-Id: <20251208114224.10223-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34878.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
8 days agoPrevent crash on invalid server-ipv6 argument
Klemens Nanni [Sun, 7 Dec 2025 21:05:18 +0000 (22:05 +0100)] 
Prevent crash on invalid server-ipv6 argument

`get_addr_generic()` expects `openvpn_getaddrinfo()` to return a newly
allocated struct, but getaddrinfo(3) failure leaves `*ai = NULL` as-is.

On OpenBSD, unlike free(3), freegetaddrinfo(3) requires a valid struct,
thus callers must check the argument to avoid NULL-deref or double-free:

```
$ openvpn --server-ipv6 ''
2025-12-06 11:59:18 RESOLVE: Cannot resolve host address: :[AF_INET6] (no address associated with name)
Segmentation fault (core dumped)
```

Guard against empty `ai`, i.e. failure, like similar code already does:

```
$ ./openvpn --server-ipv6 ''
2025-12-06 12:05:11 RESOLVE: Cannot resolve host address: :[AF_INET6] (no address associated with name)
Options error: error parsing --server-ipv6 parameter
Use --help for more information.
```

Spotted through a configuration typo "server-ipv6 fd00:/64" with 2.6.17,
reproduced with and tested against 2.7rc3 on OpenBSD/amd64 7.8-current.

NB: Standards are unclear wrt. freeaddrinfo(3)'s NULL handling;
    Linux, FreeBSD and illumos do check it and thus not crash.

Github: fixes OpenVPN/openvpn#930

Change-Id: I99a6604fdfc682f9609bfe7672aa78285084dcb9
Signed-off-by: Klemens Nanni <kn@openbsd.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1418
Message-Id: <20251207210529.9949-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34870.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
10 days agombedtls: gracefully exit if certificate file is NULL
Steffan Karger [Sat, 6 Dec 2025 20:58:16 +0000 (21:58 +0100)] 
mbedtls: gracefully exit if certificate file is NULL

Instead of crashing because we feed a NULL pointer to strlen(),
gracefully exit with an error message.

While at it, improve the error message a bit.

Change-Id: I0d592d9d0c7ead296869f933c206c5d55e6cbed1
Reported-By: Joshua Rogers <contact@joshua.hu>
Found-by: ZeroPath (https://zeropath.com/)
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1419
Message-Id: <20251206205829.27254-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34864.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
12 days agoFix dco with null cipher being enabled without auth none
Arne Schwabe [Thu, 4 Dec 2025 13:45:16 +0000 (14:45 +0100)] 
Fix dco with null cipher being enabled without auth none

This is a corner case and only the FreeBSD DCO module support the
none encryption but as long as it supports it, we should only
enable it when the configuration actually allows to enable it.

Change-Id: I1104044701145fa37cea857e2e0e0fcac7a2bee3
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Antonio Quartulli <antonio@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1369
Message-Id: <20251204134521.20025-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34847.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
12 days agoAdd CAP_SYS_NICE to the positive list in systemd service files
Simon Matter [Thu, 4 Dec 2025 14:05:27 +0000 (15:05 +0100)] 
Add CAP_SYS_NICE to the positive list in systemd service files

This is necessary to make the ``--nice n`` option work for OpenVPN
instances started by systemd.

Github: closes OpenVPN/openvpn#834

Signed-off-by: Simon Matter <simon.matter@invoca.ch>
Acked-By: Arne Schwabe <arne@rfc2549.org>
Message-Id: <f58b64307a86c62cb20a142ebfb40e56.20251204111659.1764843419@xxl.corp.invoca.ch>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34803.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
12 days agoAdd a section about wolfSSL GPLv3 and point out missing TLS PRF support
Arne Schwabe [Thu, 4 Dec 2025 12:42:16 +0000 (13:42 +0100)] 
Add a section about wolfSSL GPLv3 and point out missing TLS PRF support

Change-Id: I4f9a6baf2bdb45e5b79bf13c9f6fce3b7a2e982c
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1416
Message-Id: <20251204124221.15206-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34840.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
12 days agoClarify some code in epoch with better comments
Arne Schwabe [Wed, 3 Dec 2025 12:57:34 +0000 (13:57 +0100)] 
Clarify some code in epoch with better comments

Change-Id: I34e6b680618a52003d8408852d415c8aeac01feb
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1190
Message-Id: <20251203125741.29239-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34829.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoDrop Mbed TLS 2.X compatibility
Max Fillinger [Mon, 1 Dec 2025 13:39:50 +0000 (14:39 +0100)] 
Drop Mbed TLS 2.X compatibility

Mbed TLS 2.28 is out of support since March and adding support for
Mbed TLS 4 will get ugly enough without the old compatibility code lying
around too.

Mbed TLS 2.28 still ships on some supported distributions
(e.g.  Ubuntu 24.04) but nobody is maintaining openvpn-mbedtls packages
there. This commit will probably break on some test machines.

Change-Id: Ia4afabcb6006dc9304a4c09f824d9c7c2d4d64ad
Signed-off-by: Max Fillinger <maximilian.fillinger@sentyron.com>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1412
Message-Id: <20251201133956.29880-1-gert@greenie.muc.de>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoSet UTF-8 as the codepage using manifest declaration
Selva Nair [Mon, 1 Dec 2025 09:01:03 +0000 (10:01 +0100)] 
Set UTF-8 as the codepage using manifest declaration

Works on Windows 10+. This ensures any UTF-8 string we pass to
ANSI API will not get interpreted in some local code page
in effect at runtime.

Although we do not use any such API, OpenSSL dll we link to
does (e.g., the store API used for reading certificate and
key from files). OpenSSL may fix this in future versions,
but this is an easy workaround that looks harmless and appropriate.

Fixes failure to read certificates when filenames contain non-ascii
characters reported by: Carsten Mietzsch <Carsten.Mietzsch@atelios.de>

Ref: https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page
Github: OpenVPN/openvpn#920

Change-Id: Ic4e233c788b16a862c1fddcf314a3da661072fb5
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1413
Message-Id: <20251201090110.5487-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34805.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoOpenVPN Release 2.7_rc3 v2.7_rc3
Gert Doering [Thu, 27 Nov 2025 08:49:36 +0000 (09:49 +0100)] 
OpenVPN Release 2.7_rc3

version.m4, ChangeLog, Changes.rst

Changes.rst has not received an "2.7_rc3" 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 rc2 -> rc3 are:
    - Windows/Interactive Service bugfixes
        many small bugfixes to registry-related DNS domain handling
    - Windows/Interactive Service: harden service pipe handling
        close a small race condition, and add restrictive ACLs
    - Windows/Interactive Service: CVE-2025-13751
        fix bug where the interactive service would error-exit in
        certain error conditions instead of just logging the fact and
        continuing.  After the error-exit, OpenVPN connections will no
        longer work until the service is restarted (or the system rebooted).
        This can be triggered by any authenticated local user, and has
        thus been classified as a "local denial of service" attack.
    - more type conversion related warnings have been fixed
    - --multihome behaviour regarding egress interface selection has been
      changed.  See Changes.rst and manpage for details.
    - cleanup dead code in event handling code (leftover of the multisocket
      patch set)
    - add new feature, --tls-crypt-v2-max-age n.  See Changes.rst and
      manpage for details.
    - improve documentation to point out the pitfalls of case-insensitive
      filesystems and --client-config-dir
    - split default gateway query logic in two:
        - for --redirect-gateway functionality, query for the gateway towards
          the actual IP address of the VPN server connecting to
        - for the "net_gateway" special destination for --route, and the
          corresponding environment variable, always query for 0.0.0.0 / ::
      (this will only make a difference in certain scenarios using a local
      proxy, or on a system with multiple interfaces, not using the "default
      route" for the VPN connection - see github#890)
    - upgrade embedded pkcs11-helper vcpkg + pkcs11-uri patch to 1.31
    - CMake / autoconf cleanup wrt unused checks, outdated old-Linux checks,
      Windows oddities
    - DCO (primarily Linux): improve handling of bulk notifications from
      kernel (do not lose notifications, do not crash) (github#900)

Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agointeractive.c: harden pipe handling against misbehaving clients
Lev Stipakov [Mon, 24 Nov 2025 10:09:23 +0000 (12:09 +0200)] 
interactive.c: harden pipe handling against misbehaving clients

 - Handle ConnectNamedPipe ERROR_NO_DATA as a normal
   connect/drop race: log the drop, disconnect/reset
   that instance, and keep listening instead of letting
   a trivial local DoS stop the service.

 - Add a timed peek for startup data so a client that
   connects and sends nothing is timed out (IO_TIMEOUT)
   and rejected, instead of leaving a worker thread blocked
   forever and piling up handles.

 - Protect the accept loop from resource exhaustion: before
   spawning a worker, check the wait set and reject the client
   if adding another handle would exceed MAXIMUM_WAIT_OBJECTS;
   also skip FlushFileBuffers when no startup data was received
   to avoid hangs on silent clients.

Without these fixes, a malicious local windows user can make the OpenVPN
Interactive Service exit-on-error, thus breaking all OpenVPN connections
until the service is restarted (or the system rebooted).  Thus this has
been classified as "local denial of service" and CVE-2025-13751 has been
assigned.

CVE: 2025-13751
Change-Id: Id6a13b0c8124117bcea2926b16607ef39344015a
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Selva Nair <selva.nair@gmail.com>
2 weeks agodco: process messages immediately after read
Ralf Lici [Fri, 28 Nov 2025 11:26:59 +0000 (12:26 +0100)] 
dco: process messages immediately after read

Currently, reading and processing of incoming DCO messages are
decoupled: notifications are read, parsed, and the relevant information
is stored in fields of dco_context_t for later processing (with the only
exception being stats). This approach is problematic on Linux, since
libnl does not allow reading a single netlink message at a time, which
can result in loss of information when multiple notifications are
available.

This change adopts a read -> parse -> process paradigm. On Linux,
processing is now invoked directly from within the parsing callback,
which libnl calls for each received netlink packet. The other interfaces
are adapted accordingly to unify the processing model across all
platforms.

On Linux, however, a DEL_PEER notification from the kernel triggers a
GET_PEER request from userspace, which clutters the netlink
communication logic and can lead to errors or even process exit when
multiple simultaneous DEL_PEER notifications are received. To avoid
this, introduce a lock that prevents requesting stats while we are still
busy parsing other messages.

Reported-by: Stefan Baranoff <stefan.baranoff@trinitycyber.com>
Github: OpenVPN/openvpn#900
Github: OpenVPN/openvpn#918
Github: fixes OpenVPN/openvpn#919

Change-Id: Iefc251cb4483c0b9fb9d6a5207db4445cd884d52
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1403
Message-Id: <20251128112705.12613-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34785.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoRemove remainders of --no-name-remapping option
Gert Doering [Thu, 27 Nov 2025 11:57:32 +0000 (12:57 +0100)] 
Remove remainders of --no-name-remapping option

This option was removed in 2.5 (commit c3f565f059) but still showed
up in the ``openvpn --help`` text and in a Q&A section of the man page.

Change-Id: Ib15bd4148872db39a4c8291796a5da211bb20a87
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1411
Message-Id: <20251127115737.3598-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34754.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoextract_x509_field_ssl(): verify that X509_NAME is not NULL.
Gert Doering [Thu, 27 Nov 2025 11:35:12 +0000 (12:35 +0100)] 
extract_x509_field_ssl(): verify that X509_NAME is not NULL.

This seems to be unlikely to ever happen, but this check won't harm
- as a matter of coding convention, we do not ensure this inside
extract_x509_field_ssl(), but in the (single) caller.

While at it, fix pre-C99 local-variable indent block, and missing {}
block in else/#endif construction.

Reported-By: Joshua Rogers <contact@joshua.hu>
Found-by: ZeroPath (https://zeropath.com/)
Change-Id: I1e9c7eee06bf5f2e8aed8cd2523684539294ac8b
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Antonio Quartulli <antonio@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1388
Message-Id: <20251127113517.1352-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34748.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoconfigure/CMake: Unify Windows handling
Frank Lichtenheld [Thu, 27 Nov 2025 10:37:05 +0000 (11:37 +0100)] 
configure/CMake: Unify Windows handling

Some things were detected in configure.ac and just
hard-coded in CMake. Move the hard-coding to
syshead.h instead and remove the additional code
in configure.ac. These are really Windows-specific
so I think not dynamically detecting is okay.

Change-Id: Ic55e1288b0d3160e68eef07ff4edbb070a03dd31
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1410
Message-Id: <20251127103710.29341-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34736.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoconfigure/CMake: Remove unused checks
Frank Lichtenheld [Thu, 27 Nov 2025 10:53:37 +0000 (11:53 +0100)] 
configure/CMake: Remove unused checks

Do not run configure checks that we do not
actually need.

But add one missing check in CMake for strsep!

Change-Id: I0da2cc8bbe9e394d1bb55cff496ea3e11584ca20
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1409
Message-Id: <20251127105343.30723-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34740.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoLinux: Assume we have a kernel that was release in the last 15 years
Frank Lichtenheld [Thu, 27 Nov 2025 10:51:20 +0000 (11:51 +0100)] 
Linux: Assume we have a kernel that was release in the last 15 years

Just assume that we have all the linux headers that
were part of linux since 2.6 (or 2.4 in some cases).

Simplifies configuration.

Change-Id: Ie460eec488a8781e3b1ee4f8b2ae2090729ed175
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1408
Message-Id: <20251127105125.30457-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34738.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoerror: Allow status argument to check_status to be ssize_t
Frank Lichtenheld [Wed, 26 Nov 2025 11:40:40 +0000 (12:40 +0100)] 
error: Allow status argument to check_status to be ssize_t

We only check for < 0 so no reason not to allow bigger
signed values. This makes it easier to feed result
values of read/write to it. Fixes a conversion warning
in process_outgoing_tun.

Also changes register_activity to int64_t for similar
reasons.

Change-Id: I750a46246c0d2447a6691e5c25c4732e3d335a63
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1357
Message-Id: <20251126114047.10280-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34701.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoChanges.rst: Fix various syntax errors and typos
Frank Lichtenheld [Wed, 26 Nov 2025 12:00:04 +0000 (13:00 +0100)] 
Changes.rst: Fix various syntax errors and typos

Mostly people trying to write MarkDown, but this is
reStructuredText.

Change-Id: I8e390a276418dda9e7caa6edcd3a9d59d50ce4f8
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1405
Message-Id: <20251126120009.12191-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34707.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoChange '--multihome' behaviour regarding egress interface selection.
Gert Doering [Wed, 26 Nov 2025 13:04:03 +0000 (14:04 +0100)] 
Change '--multihome' behaviour regarding egress interface selection.

Traditional OpenVPN ``--multihome`` behaviour is to send packets out the
same interface that they were received on (copy ipi_ifindex from ingress
to egress packet info).  For some scenarios this makes sense, for other
scenarios it is breaking connectivity when there are no routes pointing
out the ingress interface (intentionally asymmetric traffic).

For 2.7.0, change the default(!) to always send out packets with
ipi_ifindex = 0, to follow normal system interface selection rules.

Add a flag ``--multihome same-interface`` to restore the pre-2.7 behavior
of copying ipi_ifindex from ingress to egress packets.  There are use
cases for this, and we want to give users a chance to read the release
notes and adjust their setups to "not break after upgrading to 2.7.0".

Github: OpenVPN/openvpn#855
Github: OpenVPN/openvpn#554

v2: fix whitespace
v3: turn logic around - new default is "egress ifindex 0" now
v4: typo fixed in commit message
v5: fix invalid rst in Changes.rst

Change-Id: Id429241e1b17a8ff51d9019efc357c910f3bde4c
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1383
Message-Id: <20251126130410.19091-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34709.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoiservice: rename one_glyph to glyph_size
Heiko Hund [Mon, 24 Nov 2025 17:00:50 +0000 (18:00 +0100)] 
iservice: rename one_glyph to glyph_size

Throughout the function variables which deal with byte counts have a
_size postfix. one_glyph is the number of bytes in one character.
Reading the code is easier and more consistent this way.

Change-Id: I69a6ab59d995fb4a511f57c8535b5ffa4048673c
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1398
Message-Id: <20251124170055.16034-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34642.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoiservice: fix off by one error
Heiko Hund [Wed, 26 Nov 2025 10:49:32 +0000 (11:49 +0100)] 
iservice: fix off by one error

In case there is more than one non-ignored interface domain, the start
of the next domain was off by one glyph. That meant that all but the
first domain was ignored when converting to MULTI_SZ.

Reported-by: Marc Heuse <marc@srlabs.de>
Reported-by: stephan@srlabs.de
Change-Id: I3ebf30f6d9edc66eb54fb3f1b5634c96d156b1ca
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1395
Message-Id: <20251126104938.5612-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34678.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoiservice: handle ignoring itf domains correctly
Heiko Hund [Wed, 26 Nov 2025 10:47:01 +0000 (11:47 +0100)] 
iservice: handle ignoring itf domains correctly

GetItfDnsDomains() does ignore domains, which are in the search domains
list. Handling of this was done wrong if there was more than one
interface domain. In any case the size returned to the caller was
calculated wrong.

Reported-by: Marc Heuse <marc@srlabs.de>
Reported-by: stephan@srlabs.de
Change-Id: I02e2c7b27b5a39b11556e4753c648baa05344ffc
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1394
Message-Id: <20251126104706.5378-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34677.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoiservice: return correct size when domains are truncated
Heiko Hund [Wed, 26 Nov 2025 10:43:07 +0000 (11:43 +0100)] 
iservice: return correct size when domains are truncated

In case not all domains can be converted in the available buffer, return
the size of the already converted domains size plus the second terminating
zero for the MULTI_SZ.

Reported-by: Marc Heuse <marc@srlabs.de>
Reported-by: stephan@srlabs.de
Change-Id: Iabad046c930dd0f38ec50d1c43d8b3288816df7d
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1391
Message-Id: <20251126104315.4776-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34680.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoiservice: fix calculation of converted domains size
Heiko Hund [Wed, 26 Nov 2025 10:34:21 +0000 (11:34 +0100)] 
iservice: fix calculation of converted domains size

To keep track of how much of the buffer is already used, the difference
of the current position and the start of the buffer needs to be
multiplied with the size of a character / glyph to bet the byte count,
with which calculations are done further down below.

Reported-by: Marc Heuse <marc@srlabs.de>
Reported-by: stephan@srlabs.de
Change-Id: I16f9426e57f4802ba038ab51f5b70161464b9428
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1390
Message-Id: <20251126103427.4085-1-gert@greenie.muc.de>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agomulti-socket: do not return tuntap flags on server-side
Gianmarco De Gregori [Mon, 24 Nov 2025 17:58:27 +0000 (18:58 +0100)] 
multi-socket: do not return tuntap flags on server-side

Tuntap flags are already handled within
multi_io_process_io() so return them by
multi_io_process_flags() would be redoundant,
since we need them only for tun_set().

While at it, removed part of the I/O process
from multi_process_io_udp() since those are
also handled within multi_io_process_io(),
removed the FILE_CLOSED and FILE_SHIFT
defines since we now handle that kind of
event in multi_io_process_io() through
the MULTI_IO_FILE_CLOSE_WRITE define.

Change-Id: I6a5110a0583b8b33496b06d9c27c1084df38e842
Signed-off-by: Gianmarco De Gregori <gianmarco@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1364
Message-Id: <20251124175832.21352-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34650.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoRestrict access to the service pipe to SYSTEM and owner
Selva Nair [Mon, 24 Nov 2025 16:53:47 +0000 (17:53 +0100)] 
Restrict access to the service pipe to SYSTEM and owner

Access is restricted to SYSTEM and pipe client user
(the user starting openvpn.exe). The default is
full access to Administrtors, owner, and read access
to everyone. This hardens the pipe further.

Change-Id: I8aa1cf1585e2320fca9329bdd0227976606fe71e
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1397
Message-Id: <20251124165353.14923-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34640.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoHarden interactive service pipe
Selva Nair [Mon, 24 Nov 2025 16:53:06 +0000 (17:53 +0100)] 
Harden interactive service pipe

- Append a version 4 uuid to ovpn_pipe_name to make it less
  predictable
- Do not allow remote access to the pipe

This greatly reduces the possibility of a rogue process racing to
open the pipe before CreateFile() is called in the worker thread.

Reported-by: Marc Heuse <marc@srlabs.de>
Change-Id: Ie66a142751354e421d48b273784fc79bcb9f7208
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1396
Message-Id: <20251124165311.14859-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34638.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoiservice: check for NULL pointer
Heiko Hund [Sun, 23 Nov 2025 12:00:23 +0000 (13:00 +0100)] 
iservice: check for NULL pointer

Check if the list argument to ListContainsDomain() is NULL. Otherwise
the call to wcsstr() will bail out.

Reported-by: Marc Heuse <marc@srlabs.de>
Reported-by: stephan@srlabs.de
Change-Id: Icd7c7b08e317aefd91a60bfc62e92cd8707b6fac
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1393
Message-Id: <20251123120029.19736-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34611.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoiservice: make sure registry string is terminated
Heiko Hund [Sun, 23 Nov 2025 11:58:46 +0000 (12:58 +0100)] 
iservice: make sure registry string is terminated

When reading the interface domains from the registry, check that the
string is zero terminated, since the code in GetItfDnsDomains depends
on the fact when doing size calculations during the conversion.

Reported-by: Marc Heuse <marc@srlabs.de>
Reported-by: stephan@srlabs.de
Change-Id: Icaeca22bdbd8ead0cb12345b1bcc2b5c0f46236f
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1392
Message-Id: <20251123115851.19555-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34610.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoiservice: make sure buffer size is not zero
Heiko Hund [Sun, 23 Nov 2025 11:37:42 +0000 (12:37 +0100)] 
iservice: make sure buffer size is not zero

GetItfDnsDomains expects a non-zero size buffer to return the domains
in. Check for the size as well, not just for a valid pointer.

Change-Id: I8b26c65415f5a751f416d80a22cbb7ff14aa27c0
Reported-by: Marc Heuse <marc@srlabs.de>
Reported-by: stephan@srlabs.de
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1389
Message-Id: <20251123113747.17739-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34606.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agomulti-socket: remove duplicated/dead code
Gianmarco De Gregori [Sat, 22 Nov 2025 18:52:33 +0000 (19:52 +0100)] 
multi-socket: remove duplicated/dead code

Removed the event_ctl() for ENABLE_ASYNC_PUSH
in io_wait_dowork() since that function is
not executed by servers anymore.

Removed a duplicated code in multi_io_process_io()
for new incoming TCP connections since the same
thing is done couple lines above.

Change-Id: Id1457f8432b4f0a69108b91ca12f2cbd0818f90d
Signed-off-by: Gianmarco De Gregori <gianmarco@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1384
Message-Id: <20251122185239.26312-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34593.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoiservice: fix buffer size in call to FormatMessage
Heiko Hund [Sat, 22 Nov 2025 15:55:00 +0000 (16:55 +0100)] 
iservice: fix buffer size in call to FormatMessage

The buffer size is to be given in # of TCHARs according to the docs. In
this case that is the number of WCHARs in the buffer.

While here, remove the unused FORMAT_MESSAGE_ARGUMENT_ARRAY flag. Just
to make things a bit shorter.

Reported-by: stephan@srlabs.de
Change-Id: I4c3e5aed23d2e4c543066bb8032ad8808dcd27a8
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1387
Message-Id: <20251122155506.8901-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34583.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agotls_crypt: Fix Coverity complaint in tls_crypt_v2_check_client_key_age
Frank Lichtenheld [Sat, 22 Nov 2025 16:25:47 +0000 (17:25 +0100)] 
tls_crypt: Fix Coverity complaint in tls_crypt_v2_check_client_key_age

Coverity complained about "overflow_before_widen" because
there is a theoretical overflow that can happen even though
the target value is wide enough. For useful values of max_days
this is irrelevant but Coverity is not wrong, so change the
code accordingly.

Change-Id: Ie7308d549182a95b86cd113e4a8cc65ff45ba3d7
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1385
Message-Id: <20251122162553.12254-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34585.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoGHA: Add macos-26 and remove OpenSSL 1.1 builds on macOS
Frank Lichtenheld [Wed, 19 Nov 2025 16:29:28 +0000 (17:29 +0100)] 
GHA: Add macos-26 and remove OpenSSL 1.1 builds on macOS

The new runner doesn't have OpenSSL 1.1 available anymore
via homebrew. The formula is also marked as "deprecated"
for older macOS versions. So I think it is okay to drop
it.

Change-Id: I1633ee6207443e041434e9f0dda98afd5a22e1b4
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Yuriy Darnobyt <yura.uddr@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1382
Message-Id: <20251119162934.15672-1-gert@greenie.muc.de>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoAdd option to check tls-crypt-v2 key timestamps
Max Fillinger [Wed, 19 Nov 2025 14:01:43 +0000 (15:01 +0100)] 
Add option to check tls-crypt-v2 key timestamps

This commit adds the option --tls-crypt-v2-max-age n. When a client key
is older than n days or has no timestamp, the server rejects it.

Based on work by Rein van Baaren for Sentyron.

Co-authored-by: Rein van Baaren <revaban04@proton.me>
Change-Id: I0579d18c784e2ac16973d5553992c28f281a0900
Signed-off-by: Max Fillinger <max@max-fillinger.net>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1304
Message-Id: <20251119140149.31867-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34545.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoGHA: Maintenance update November 2025
Frank Lichtenheld [Wed, 19 Nov 2025 13:54:52 +0000 (14:54 +0100)] 
GHA: Maintenance update November 2025

Includes the following renovate changes:
- chore(deps): update dependency mbed-tls/mbedtls to v3.6.5
- chore(deps): update vcpkg digest to 3bbc280
- chore(deps): update dependency libressl/portable to v4.2.1
- chore(deps): update github actions
- chore(deps): update dependency aws/aws-lc to v1.64.0
- chore(deps): update github actions

Additionally, drop macos-13 since the
worker is deprecated.

Change-Id: Ifd63130832e3bf20bf9816887e218ae73e2f5cd1
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Yuriy Darnobyt <yura.uddr@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1381
Message-Id: <20251119135458.31160-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34543.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agodoc: Document potential filesystem pitfalls of client-config-dir
Frank Lichtenheld [Wed, 19 Nov 2025 13:52:38 +0000 (14:52 +0100)] 
doc: Document potential filesystem pitfalls of client-config-dir

Reported-By: stefan@srlabs.de
Change-Id: I23ea00dbd62271838aa72e913b743cc679ff2386
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1380
Message-Id: <20251119135243.30967-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34541.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoroute: handle default gateway (net_gateway) and nexthop towards VPN server separately
Marco Baffo [Wed, 19 Nov 2025 11:40:35 +0000 (12:40 +0100)] 
route: handle default gateway (net_gateway) and nexthop towards VPN server separately

Right now there is the assumption that the gateway used for net_gateway is the same used to reach the VPN server.
However, these two gateways may be different (i.e. when there is a specific hostroute for the VPN server using a different nexthop).
For this reason we must adapt init_route_list() to fetch the two gateways separately.

Github: fixes OpenVPN/openvpn#890

Change-Id: I16d90221d0a75193035253817ff195f6da9dc0b3
Signed-off-by: Marco Baffo <marco@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1222
Message-Id: <20251119114041.17665-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34529.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agovcpkg-ports/pkcs11-helper: bump version to 1.31
Selva Nair [Wed, 19 Nov 2025 11:02:25 +0000 (12:02 +0100)] 
vcpkg-ports/pkcs11-helper: bump version to 1.31

RFC7512 patch for pkcs11-uri is rebased to current master,
fixing minor conflicts.

Change-Id: I032a573df6deaa44b4afce3c2d2fd54f69df6e7a
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1368
Message-Id: <20251119110231.13999-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34527.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoOpenVPN Release 2.7_rc2 v2.7_rc2
Gert Doering [Sat, 15 Nov 2025 17:16:12 +0000 (18:16 +0100)] 
OpenVPN Release 2.7_rc2

version.m4, ChangeLog, Changes.rst

Changes.rst has not received an "2.7_rc2" 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 rc1 -> rc2 are:
    - IPv6 address parsing: fix buffer overread on invalid input
      (CVE-2025-12106)
    - HMAC verification check: fix incorrect memcmp() call
      (CVE-2025-13086)
    - even more type conversion related warnings have been fixed
    - DCO FreeBSD improvements:
        improving debug messages (verb 6)
        implement client-side counter handling
        repair --inactive (and document shortcomings)
        repair handling of DCO disconnection notifications in --client mode
    - Windows/Service improvements, hardening, bugfixes
        fix DNS address list generation (if 3 or more --dns addresses in use)
        fix DNS server undo_list
        disallow "stdin" as config name unless user has OpenVPN admin privs
        fix compilation errors with MSVC v19
        iservice: improve validation of config path (pathcc lib)
           [NOTE: this breaks OpenVPN compatibility with Windows 7]
        tapctl: refactor, improve output, change driver default to ovpn-dco
        iservice: when restoring iface metrics, enforce correct ifindex
    - improve cmocka unit test assert() handling
    - PUSH_UPDATE server: fix reporting of client IPs in ``status`` output
      after pushing a new IPv4/IPv6 address to client
    - AEAD cipher safety margins: fix calculation of AEAD blocks in use
      (old code would undercount blocks)
    - fix invalid pointer creation / memory overread in tls_pre_decrypt
    - deprecate ``--opt-verify`` (change into no-op + warning)

Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoFix memcmp check for the hmac verification in the 3way handshake being inverted
Arne Schwabe [Mon, 27 Oct 2025 09:05:55 +0000 (10:05 +0100)] 
Fix memcmp check for the hmac verification in the 3way handshake being inverted

This is a stupid mistake but causes all hmac cookies to be accepted,
thus breaking source IP address validation.   As a consequence, TLS
sessions can be openend and state can be consumed in the server from
IP addresses that did not initiate an initial connection.

While at it, fix check to only allow [t-2;t] timeslots, disallowing
HMACs coming in from a future timeslot.

Github: OpenVPN/openvpn-private-issues#56

CVE: 2025-13086

Reported-By: Joshua Rogers <contact@joshua.hu>
Found-by: ZeroPath (https://zeropath.com/)
Reported-By: stefan@srlabs.de
Change-Id: I9cbe2bf535575b47ddd7f34e985c5c1c6953a6fc
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Max Fillinger <max@max-fillinger.net>
4 weeks agosocket: reject mismatched address family in get_addr_generic
Mikhail Khachaiants [Sat, 18 Oct 2025 08:42:31 +0000 (11:42 +0300)] 
socket: reject mismatched address family in get_addr_generic

Add a family check to prevent copying address data of the wrong type,
which could cause buffer over-read when parsing routes or endpoints.

CVE: 2025-12106

Github: OpenVPN/openvpn-private-issues#77

Signed-off-by: Mikhail Khachaiants <mkhachaiants@gmail.com>
Acked-By: Gert Doering <gert@greenie.muc.de>
Signed-Off-By: Gert Doering <gert@greenie.muc.de>
4 weeks agossl_pkt: Avoid conversion warnings
Frank Lichtenheld [Mon, 17 Nov 2025 07:49:15 +0000 (08:49 +0100)] 
ssl_pkt: Avoid conversion warnings

I considered changing opcode to be uint8_t directly, but
most code treats it as int now, so that would be a much
bigger change. Similar for key_id.

Change-Id: I2a1786b2bf15852222c28e1b73ab7edbb5f19d7f
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1360
Message-Id: <20251117074921.26531-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34501.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agossl: Clean up type handling in parse_early_negotiation_tlvs()
Frank Lichtenheld [Sun, 16 Nov 2025 21:54:27 +0000 (22:54 +0100)] 
ssl: Clean up type handling in parse_early_negotiation_tlvs()

buf_read_u16 does not return uint16_t.

Change-Id: Ie7ad637223c332f7611c09b20a8d7a3a92d97ec7
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1302
Message-Id: <20251116215433.29257-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34487.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agossl: Clean up type handling in export_user_keying_material()
Frank Lichtenheld [Thu, 30 Oct 2025 14:52:26 +0000 (15:52 +0100)] 
ssl: Clean up type handling in export_user_keying_material()

For this we actually change the API of the
format_hex{,_ex} functions by changing int
to size_t for length parameters. While we
call this function with int paramters in
a lot of places (usually BLEN), this will
not produce warnings under
-Wno-sign-conversion. And we're sure those
values are positive since format_hex already
uses size_t internally.

Change-Id: Id7bacec23edc6dcd94465c308ea2144c7329a0c1
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1301
Message-Id: <20251030145231.2792-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34036.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agossl: Clean up type handling in write_string()
Frank Lichtenheld [Tue, 4 Nov 2025 09:19:35 +0000 (10:19 +0100)] 
ssl: Clean up type handling in write_string()

Make better checks for the maxlen input value.

Change-Id: I3309265edf8d6bea7bd73b21eef589a92ede6e0a
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1300
Message-Id: <20251104091940.10826-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34191.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agossl: Change update argument of compute_earliest_wakeup to time_t
Frank Lichtenheld [Sun, 16 Nov 2025 18:36:15 +0000 (19:36 +0100)] 
ssl: Change update argument of compute_earliest_wakeup to time_t

Since we usually input a diff of two time_t values here
the input value will be officially time_t. So avoid
conversion warnings at almost every caller site.

We can safely cast it to interval_t here because we
checked that it is smaller than the interval_t value
earliest. And all negative values are treated equal,
so exact value doesn't matter.

Change-Id: I6bc3147d10ca50291110335cd9fc3be961280c1b
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1299
Message-Id: <20251116183622.11727-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34482.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agossl: Fix conversion warning in tls_prepend_opcode_v1
Frank Lichtenheld [Sun, 16 Nov 2025 18:33:30 +0000 (19:33 +0100)] 
ssl: Fix conversion warning in tls_prepend_opcode_v1

Document assumption with ASSERT.

Change-Id: I34584f695ddca3b3e1f2bbcb4380ac91b09c1c8d
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1298
Message-Id: <20251116183336.11447-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34480.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agotls_crypt: Avoid some conversion warnings
Frank Lichtenheld [Sun, 16 Nov 2025 14:07:48 +0000 (15:07 +0100)] 
tls_crypt: Avoid some conversion warnings

The casts should be safe, since one is a constant
(but got type from sizeof()) and the other is
limited by the buffer length.

While here make the code in tls_crypt_v2_wrap_client_key
as little easier to follow.

Change-Id: I3f11423834814bab5d653f160fc2326dae4c0e8e
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1379
Message-Id: <20251116140754.17177-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34466.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoforward: Change context_reschedule_sec sec argument to time_t
Frank Lichtenheld [Tue, 11 Nov 2025 15:51:31 +0000 (16:51 +0100)] 
forward: Change context_reschedule_sec sec argument to time_t

This avoids conversions at the caller sites. Since we only
replace tv_sec if the new value is smaller the cast
to tv_sec_t is also safe.

Change-Id: Id9158f477404aac1d6b08b08e672980e5a58dc35
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1356
Message-Id: <20251111155139.31642-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34319.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agointerval: Fix conversion warning
Frank Lichtenheld [Sun, 16 Nov 2025 13:59:04 +0000 (14:59 +0100)] 
interval: Fix conversion warning

Use correct return type of the function.

Change-Id: I445b2e2cd14e55cc1ae3efdf1650b28e18992aa5
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1291
Message-Id: <20251116135909.15964-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34464.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agootime: Fix various conversion warnings
Frank Lichtenheld [Sun, 16 Nov 2025 13:57:52 +0000 (14:57 +0100)] 
otime: Fix various conversion warnings

Generally just use better types. Use typedef
to handle the Win32 situation where tv_sec
is long which is smaller than time_t (which
is long long).

Change-Id: Ie22f4902162b7004542f030c734b968de71e0e9e
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1274
Message-Id: <20251116135757.15805-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34462.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agotapctl: refactor 'create' command
Lev Stipakov [Sun, 16 Nov 2025 12:11:40 +0000 (13:11 +0100)] 
tapctl: refactor 'create' command

Make default adapter name selection logic more robust -
sometimes renaming fails because the deleted adapter name
might present in the registry even though adapter is not shown
anymore in enumeration.

Ensure that adapter name doesn't contain disallowed symbols.

Use --hwid ovpn-dco by default and update documentation.

Change-Id: I270f679505c90ef78a5afbad1e05219f166be089
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1374
Message-Id: <20251116121146.4067-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34455.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agotapctl: make output of 'list' and 'create' commands more verbose
Lev Stipakov [Sun, 16 Nov 2025 11:32:24 +0000 (12:32 +0100)] 
tapctl: make output of 'list' and 'create' commands more verbose

Print adapter GUID, name and hwid.

Change-Id: Iac6bcf8b5434aa414e86cb4b9742e7dd591dc796
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1372
Message-Id: <20251116113230.31872-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34451.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agorecursive routing: fixes and clean-ups
Lev Stipakov [Fri, 14 Nov 2025 11:50:22 +0000 (12:50 +0100)] 
recursive routing: fixes and clean-ups

 - get rid of atoi() for getting the remote transport port.
 It doesn't change, so no point to do in on every packet.
 In addition, atoi() breaks when we use service names as ports.

 - ensure we correctly handle IPv4 headers with options

 - directly use buf parameter in place of c->c2.buf

GitHub: closes OpenVPN/openvpn#902

Change-Id: I8a0a8029da02fc63adc918e8d98e9f676ff4ea0d
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1377
Message-Id: <20251114115029.17432-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34415.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agotapctl: factor out command handlers
Lev Stipakov [Fri, 14 Nov 2025 21:21:07 +0000 (22:21 +0100)] 
tapctl: factor out command handlers

Change-Id: I432e07216f9adb8f767af172fa37b626b350f994
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1370
Message-Id: <20251114212112.6370-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34432.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoiservice: use saved iface index to restore metric
Heiko Hund [Wed, 12 Nov 2025 21:51:00 +0000 (22:51 +0100)] 
iservice: use saved iface index to restore metric

When adding block rules, the interface metric of the VPN adapter is
temporarily modified so that an old version of Windows 10 would pick
it up first when looking up stuff via DNS. These metrics are reverted to
the old value when the block is removed.

When reverting them, instead of using the stored interface index where
the original values were read from, we were using the interface index
passed to the service with the wfp block message. That index could
theoretically be different from the one stored, which would result in
the metric being set to the wrong interface.

Reported-by: stephan@srlabs.de
Change-Id: Ia74a931c703d594bdf8ccada9b783b94608de278
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1363
Message-Id: <20251112215106.14182-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34400.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agooptions: remove --opt-verify functionality
Antonio Quartulli [Thu, 13 Nov 2025 21:21:38 +0000 (22:21 +0100)] 
options: remove --opt-verify functionality

As previously agreed, the --opt-verify directive is deprecated
and can be fully removed as of OpenVPN 2.7.0.

GitHub: closes OpenVPN/openvpn#901
Change-Id: Ia60a393a296f23ac1090d0f2016b5682649ed490
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1375
Message-Id: <20251113212143.30034-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34403.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agossl: change return type of calc_control_channel_frame_overhead to size_t
Frank Lichtenheld [Tue, 11 Nov 2025 17:24:31 +0000 (18:24 +0100)] 
ssl: change return type of calc_control_channel_frame_overhead to size_t

This avoids dealing with conversion warnings inside
the function. Since we only add values that are
supposed to be positive this should be safe.

Note that we now cast the return value to int at
the caller side. There we actually substract it and
want to catch the case where the result gets negative.
Since all the involved values are quite small compared
to INT_MAX I decided to just cast it without further
checks.

Change-Id: I71e9d4a61d37483685723c16e98f59755694cadf
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1297
Message-Id: <20251111172437.7634-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34326.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agopkcs11: Avoid some conversion warnings
Frank Lichtenheld [Tue, 11 Nov 2025 17:25:23 +0000 (18:25 +0100)] 
pkcs11: Avoid some conversion warnings

Since we translate between different APIs
casts are unavoidable. Make sure they are safe.

Change-Id: If3331a2d0477634af077b4c29963dbec6d04e17b
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1296
Message-Id: <20251111172531.7754-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34328.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoFix construction of invalid pointer in tls_pre_decrypt
Arne Schwabe [Wed, 12 Nov 2025 14:13:28 +0000 (15:13 +0100)] 
Fix construction of invalid pointer in tls_pre_decrypt

In tls_pre_decrypt we construct a pointer ks with an invalid i if
i is TM_SIZE, doing a out-of-bounds read in multi->session.

This is a something that exists at least since 2.3.0 (I didn't go further
back but probalby exists in earlier version as well as the commits date
back to SVN beta21 branch).

So we construct the pointer but do not do anything with it if it is
invalid as we check i *after* we construct the pointer `ks`.

I suspect that the compiler optimises the bug away in any higher
optimisation level.

Assuming there is no optimisation, let's check what is possible.
Since we never use the value `ks` if it is invalid, we do not have
worry if it ends up invalid or not. The only thing that we have to
worry about is whether
`session + offsetof(struct tls_session, key[KS_PRIMARY])` is pointing
to memory that is valid to read to construct the `ks` pointer.
This is outside the tls_multi struct, so this is not guaranteed to be
allocated memory but at the same time it is also only few bytes (or few
tens/hundred) after the struct, so it the propability is very high that
it will be be in a memory region that will not cause a segfault on read.

Every time this condition is hit and we construct the invalid pointer,
the log message "TLS Error: Unroutable control packet received" is
printed at `verb 1` or higher. And this is a quite common log message,
which serves as indication as well that a crash is not something that
typically happens but either the optimisation fixes or the memory
region of the invalid access is valid to read from.

Based on this this was categorized as "bug, but no way to exploit
this, thus no CVE".

Change-Id: Ided1ac7c804487055b175d8766535bead257b7d5

Reported-By: Jon Chiappetta <root@fossjon.com>
Reported-By: Joshua Rogers <contact@joshua.hu>
Found-by: ZeroPath (https://zeropath.com/)
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1373
Message-Id: <20251112141335.17417-1-gert@greenie.muc.de>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoopenssl_compat: Avoid conversion warning for SSL_get_negotiated_group
Frank Lichtenheld [Tue, 11 Nov 2025 15:32:24 +0000 (16:32 +0100)] 
openssl_compat: Avoid conversion warning for SSL_get_negotiated_group

SSL_get_negotiated_group is documented to return
int and SSL_group_to_name definitely expects an int.

But SSL_get_negotiated_group is actually a macro
implemented by SSL_ctrl, which does return a long.
So to avoid the conversion warning we need the cast.

Change-Id: I31024f93d9d9d0f678fb39d4758a7e870bf00873
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1359
Message-Id: <20251111153230.29865-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34316.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agossl: Change tls_send_payload size argument to size_t
Frank Lichtenheld [Tue, 11 Nov 2025 15:52:31 +0000 (16:52 +0100)] 
ssl: Change tls_send_payload size argument to size_t

There is only one caller of this function and it
wants it to be size_t. So move the size_t to int
conversion one step down in the call chain. Do not
switch key_state_write_plaintext_const, yet, since
that is a backend function and so needs way more
work.

Change-Id: Ic90c5a0e48bda4a02d5e11c4c161f388cc8805af
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1355
Message-Id: <20251111155239.31747-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34320.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agotapctl: use better wording for adapters
Lev Stipakov [Wed, 12 Nov 2025 13:01:43 +0000 (14:01 +0100)] 
tapctl: use better wording for adapters

"TUN/TAP" is a bit confusing, so use more generic "VPN network adapter"
wording.

Change-Id: I4104d7e34fbc7232b677e937fc598128a8b7b3bc
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1371
Message-Id: <20251112130149.10890-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34364.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoDo not underestimate number of encrypted/decrypted AEAD blocks
Arne Schwabe [Wed, 12 Nov 2025 11:21:27 +0000 (12:21 +0100)] 
Do not underestimate number of encrypted/decrypted AEAD blocks

Even though the current code typically counts all the encrypted/decrypted
traffic, this is only the case because of the specific implementation
of OpenSSL at the moment.

Instead of counting the length returned by one call only, count all
the encrypted/decrypted bytes.

Other implementations that use AES-GCM (like IPSec, MacSEC, TLS 1.2)
(currently) do not honour these usage limits at all. This is the reason that
I also currently do not consider the lack/improper validation in our code
to be a security vulnerability. In the current state implementations/protocol
that lack this feature altogether are not considered vulnerable.

Reported by: <stephan@srlabs.de>

Change-Id: I429d768fb33ef2c58484287d4091440ad8599053
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1358
Message-Id: <20251112112133.1325-1-gert@greenie.muc.de>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoiservice: make sure directories have trailing backslash
Heiko Hund [Sun, 9 Nov 2025 15:44:31 +0000 (16:44 +0100)] 
iservice: make sure directories have trailing backslash

At least in the case of the config dir this matters, since the value is
used to validate input data for the interactive service. A missing \
at the end would allow a string compare to succeed, if the last element of
the path to compare starts with the same substring. The trailing slash
ensures that the last element of a path must match completely.

Change-Id: If28e66fcc3493821f78fd14d432b22b996918e8f
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1336
Message-Id: <20251109154438.15464-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34285.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoiservice: validate config path case-insensitive
Heiko Hund [Wed, 12 Nov 2025 09:39:05 +0000 (10:39 +0100)] 
iservice: validate config path case-insensitive

Windows filesystems do not differentiate by case, so we shouldn't either.

Reported-by: stephan@srlabs.de
Change-Id: I4d905da3add9b8a3daf349eb1bc830a017cf493d
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1362
Message-Id: <20251112093911.24196-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34340.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agowin: remove checks for PATHCCH_ENSURE_TRAILING_SLASH
Heiko Hund [Wed, 12 Nov 2025 09:22:10 +0000 (10:22 +0100)] 
win: remove checks for PATHCCH_ENSURE_TRAILING_SLASH

Since the define is no longer used, remove configuration-time checks if
it exists, and also code dealing with situations where it doesn't.

Change-Id: I50f189048ef1a624e6ac84b71d7b22fcbbc3ab6b
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1354
Message-Id: <20251112092216.22703-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34335.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoiservice: validate config path better
Heiko Hund [Wed, 12 Nov 2025 09:22:38 +0000 (10:22 +0100)] 
iservice: validate config path better

Instead of just rejecting any path that contains ".." use some WIN32 API
functions to combine, canonicalize and then check if the resulting
path is located under the config directory. Makes the code prettier
and more correct.

Change-Id: I0e94068f467f2899daf133b032a785d2d7fc05e4
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1307
Message-Id: <20251112092244.22764-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34336.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agomsvc: fix struct initialization for v19 compilers
Heiko Hund [Tue, 11 Nov 2025 17:24:57 +0000 (18:24 +0100)] 
msvc: fix struct initialization for v19 compilers

Newer version of MSVC do not show the error anymore, but I do get, e.g.:

  test_crypto.c(538,23): error C2059: syntax error: '}'

with version 19.38.33133 installed on a test system.

Change-Id: I13e34119303e056fdb51ff9925f4944171c824f2
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1366
Message-Id: <20251111172504.7683-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34327.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agoEnable -Wtype-limits by default (via -Wextra)
Frank Lichtenheld [Tue, 11 Nov 2025 15:48:39 +0000 (16:48 +0100)] 
Enable -Wtype-limits by default (via -Wextra)

Removes a few smaller instances:
 - Fix return type check for socket() on Windows/Unixy
 - Ignore a few instances related to WSAWaitForMultipleEvents.
   The compiler says the check is currently useless, but
   we follow the API documentation.

Change-Id: Iaabddb6f81cd94863291b193aae9d384a8f9d871
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1207
Message-Id: <20251111154846.31360-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34317.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agodco_freebsd.c: fix integer warnings
Gert Doering [Fri, 7 Nov 2025 17:48:05 +0000 (18:48 +0100)] 
dco_freebsd.c: fix integer warnings

Fix all nvlist_get_number() related warnings by explicitly casting - these
are all messages coming from DCO, which we trust in this (nothing will
crash if a number is truncated, just "things will not work correctly").

Remove #pragmas.

Change-Id: Ief19ba87b0832baa6530ea8bf039d85115434e3e
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1361
Message-Id: <20251107174810.31851-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34256.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agoFreeBSD DCO: repair --inactive
Gert Doering [Sun, 9 Nov 2025 08:42:31 +0000 (09:42 +0100)] 
FreeBSD DCO: repair --inactive

--inactive on DCO requires a working DCO counters query function
(dco_get_peer_stats(), implemented in the previous commit) and
that the DCO implementation in use fills the "tun_{read,write}_bytes"
fields for the peer context.

FreeBSD DCO only fills the "dco_{read,write}_bytes" counters - which is
something we can't fix in OpenVPN, this needs kernel enhancements.

So, to make the feature (mostly) work, check the other set of counters
on FreeBSD.  Caveat: this will count encryption overhead and keepalives,
so it will still not work for `--inactive <n>` without a byte count, or
for byte counts with too tight thresholds.

Adding the #ifdef to forward.c was considered the least bad alternative.

v2: fix rst syntax for manpage addition

Github: OpenVPN/openvpn#898

Change-Id: I48c877843d24144450af1282b7524bb3ba18232e
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Ralf Lici <ralf@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1351
Message-Id: <20251109084238.11581-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34274.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agodco_freebsd: implement dco_get_peer_stats()
Gert Doering [Sun, 9 Nov 2025 08:41:23 +0000 (09:41 +0100)] 
dco_freebsd: implement dco_get_peer_stats()

This is "fetch read/write statistics for a single peer", complementing
dco_get_peer_stats_multi() "... for all peers", and it is called in
--client mode, and (!) in p2mp mode to check if --inactive thresholds
are reached.

The FreeBSD DCO module has no "give me stats for a single peer" call, so
we just call dco_get_peer_stats_multi() to get all of them - and that
function is modified to handle p2p or p2mp mode by checking mode == CM_TOP.

(dco_linux does about the same in dco_get_peer*() -> ovpn_handle_peer(),
after a few iterations, except that it can query for "just one peer")

"--inactive" still does not work on FreeBSD, because the code in forward.c
looks at counters that are not set by FreeBSD DCO.

v2:
  on AUTH_FAIL, 'dco' struct is not initialized yet -> SIGSEGV crash,
  verify that dco_peer_id is >= 0 before calling dco_get_peer_stats_multi()

Github: OpenVPN/openvpn#898

Change-Id: I38a040a9bdcb44933d4ca538f746af5c61011d7c
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Ralf Lici <ralf@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1350
Message-Id: <20251109084130.11463-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34273.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agopkcs11_openssl: Silence a conversion warning
Frank Lichtenheld [Thu, 6 Nov 2025 13:39:30 +0000 (14:39 +0100)] 
pkcs11_openssl: Silence a conversion warning

The only caller of this function uses a constant
for this parameter, so this is all quite safe. Add
an ASSERT for good measure anyway to make the assumption
explicit.

Change-Id: I6079bf9e7f6b37cb2e2d7f28851a77d0b08be995
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1352
Message-Id: <20251106133936.30264-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34209.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agodco_freebsd.c: add D_DCO_DEBUG messages for counters and notifications
Gert Doering [Fri, 7 Nov 2025 16:50:29 +0000 (17:50 +0100)] 
dco_freebsd.c: add D_DCO_DEBUG messages for counters and notifications

Some of these debug messages only existed on Linux, and made debugging
DCO issues on FreeBSD more difficult.  Add them, using the same style as
used for dco_linux.c

While at it, change all format strings for "peerid" to "%u" (wherever
appropriate, dco->dco_message_peer_id is an "int" today and changing
this to uint32_t is out of scope for "make better logging")

Change-Id: Ife55cb78401dad921b75f6c86d9bd0642f6a6e83
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1349
Message-Id: <20251107165038.26171-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34250.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agoFreeBSD DCO: repair incoming 'delete peer' notifications in p2p client mode
Gert Doering [Fri, 7 Nov 2025 14:13:27 +0000 (15:13 +0100)] 
FreeBSD DCO: repair incoming 'delete peer' notifications in p2p client mode

commit 4a48841da2 introduced a workaround for spurious DCO notifications
"with no useful content" on Linux - namely, ignoring dco_message_type==0
in forward.c, process_incoming_dco(), "because Linux has no message
type 0 anyway".

Each DCO platform uses its own enum for these notification messages
*inside* OpenVPN (which might not have the best design decision ever),
and FreeBSD had OVPN_CMD_DEL_PEER in the enum on "position 0"...

Fix by changing the enum to start with 1.  Tested with DEL_PEER in p2p
client and DEL_PEER & FLOAT in p2mp server mode.

v2:
  introduce OVPN_CMD_NO_MESSAGE in position 0, and a comment explaining why.
  A future commit can then clean up forward.c and dco_linux.c to use the
  constant, and not "magic 0 which happens to be in there after CLEAR()".

Github: fixes OpenVPN/openvpn#881

Change-Id: I991d6053776efed771bc1a3880acb80b55959cbc
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1353
Message-Id: <20251107141333.12056-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34237.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoinit: make some functions static
Antonio Quartulli [Tue, 4 Nov 2025 10:44:48 +0000 (11:44 +0100)] 
init: make some functions static

A bunch of functions are defined and used within init.c only.
We can therefore drop their declaration in init.h and make
them static.

Change-Id: I2b5429841bcd46376241890ace50b82a291b7400
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1346
Message-Id: <20251104104448.98093-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34193.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoPUSH_UPDATE server: update reporting_addr after ifconfig update
Marco Baffo [Tue, 4 Nov 2025 08:55:47 +0000 (09:55 +0100)] 
PUSH_UPDATE server: update reporting_addr after ifconfig update

Update mi->reporting_addr(_ipv6) for status reporting purposes
after sending a PUSH_UPDATE containing an ifconfig(-ipv6) option.

Github: fixes OpenVPN/openvpn#889

Change-Id: Ie15977b44091445b9d1edebe885d92ec5cb5770a
Signed-off-by: Marco Baffo <marco@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1340
Message-Id: <20251104085553.8218-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34186.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agounit_tests: prefer proper cmocka assert helpers
Antonio Quartulli [Tue, 4 Nov 2025 08:16:47 +0000 (09:16 +0100)] 
unit_tests: prefer proper cmocka assert helpers

We have agreed to never use the plain assert()
anywhere in the code.

Unit tests are almost there as they always use
cmocka provided assert helpers, except for two cases.
Convert those two to cmocka assert calls too.

While at it also ensure that the proper bool helpers
are used rather than checking _int_equal against true/false.

Drop assert.h in cryptoapi.c as well as it's not needed
anymore.

GitHub: Closes OpenVPN/openvpn#894
Change-Id: I61e4968f2e83d12d4d3fc3ccba92a06eb5ed5866
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1345
Message-Id: <20251104081653.3368-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34179.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoUse correct undo_list when clearing DNS addresses
Selva Nair [Mon, 3 Nov 2025 21:25:17 +0000 (22:25 +0100)] 
Use correct undo_list when clearing DNS addresses

Reported by: <aarnav@srlabs.de>

Change-Id: Iafac2b8f319457de8e36b427f26ebc27c040c6f7
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1344
Message-Id: <20251103212523.31409-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34171.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agotest_networking: use appropriate assert helpers
Antonio Quartulli [Mon, 3 Nov 2025 14:58:37 +0000 (15:58 +0100)] 
test_networking: use appropriate assert helpers

In all unit tests we rely on CMocka's provided assert helpers.

However, test_networking.c was still on the default assert() call,
which we try to avoid in favour of more appropriate helpers.

Substitute them all with assert_*() from CMocka.

Change-Id: Ie153b3d5bf19200f225cd09131de8583645110be
Reported-by: Marc Heuse <marc@srlabs.de>
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1342
Message-Id: <20251103145842.22969-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34155.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoopenvpnserv: Disallow stdin as config unless user is authorized
Selva Nair [Mon, 3 Nov 2025 14:59:56 +0000 (15:59 +0100)] 
openvpnserv: Disallow stdin as config unless user is authorized

Reported by: <stephan@srlabs.de>

Change-Id: I356faeebfade1eed9b40d6700b13621c357ec5ac
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/+/1343
Message-Id: <20251103150002.23187-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34156.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoiservice: fix DNS address list generation
Heiko Hund [Mon, 3 Nov 2025 11:59:40 +0000 (12:59 +0100)] 
iservice: fix DNS address list generation

While generating the address list string for the DNS server addresses,
to be set in the registry, the offset is calculated the wrong way. This
results in gaps between addresses after the first two.

Reported-By: aarnav@srlabs.de
Change-Id: I7252d5a252e91ffc03db142aa226c9eb1656480b
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1339
Message-Id: <20251103115945.6615-1-gert@greenie.muc.de>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agomanage: Correctly handle port 65535 in man_kill
Frank Lichtenheld [Mon, 3 Nov 2025 11:55:46 +0000 (12:55 +0100)] 
manage: Correctly handle port 65535 in man_kill

Commit c66d433111c958c42cc98f4ba12d3cfc1bd5b3b4 introduced
an off-by-one when changing a literal to a constant.

Github: fixes OpenVPN/openvpn#887
Change-Id: I19373408a82332d7b2e5c634e5509c8be3727b5a
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1341
Message-Id: <20251103115552.6201-1-gert@greenie.muc.de>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoOpenVPN Release 2.7_rc1
Gert Doering [Tue, 28 Oct 2025 19:04:58 +0000 (20:04 +0100)] 
OpenVPN Release 2.7_rc1

version.m4, ChangeLog, Changes.rst

Changes.rst has not received an "2.7_rc1" 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 beta3 -> rc1 are:
    - even more type conversion related warnings have been fixed
    - more bugfixes related to BYTECOUNT display on the management
      interface and byte counters on DCO platforms in general
    - numerous minibugs reported by ZeroPath AI have been fixed
      (small memleaks, possible file descriptor leaks, improved
      sanity checks, add ASSERT() on function contracts, etc.)
    - add warning for unsupported combination of --push and --tls-server
    - add warning for unsupported combination of --reneg-bytes or
      --reneg-pkts with DCO
    - remove perf_push()/perf_pop() infrastructure (because it did not
      work anymore, and compiler profiling will give better results today)
    - ensure compatibility with OpenSSL 3.6.0 - specifically, do not crash
      in t_lpback.sh trying to use new encrypt-then-mac (ETM) ciphers
    - improved PUSH_UPDATE server side support, which now handles changes
      of pushed ifconfig/ifconfig-ipv6 addresses correctly (send packets
      to new IP addresses to this client, stop sending packets to the old
      addresses).
    - improve CONTRIBUTING documentation
    - add unit test for DHCP packet infrastructure
    - freshen URLs all over the tree, and change to HTTPS where possible
    - on DCO Linux/FreeBSD, add support for clients receiving an IPv4/IPv6
      address that is not part of the --server/--server-ipv6 subnet
      (= install extra on-interface host routes).
    - Windows programs use a new API for path name canonicalization now
      (PathCchCanonicalizeEx()) which will break building with MinGW on
      Ubuntu 22.04 -> Upgrade to 24.04 to make builds work again.
    - on Windows, when setting up WINS servers using netsh, use interface
      index instead of adapter name now ("as for all other netsh calls")
    - remove undocumented and unused --memstats feature

Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoZeroize tls-crypt-v2 client keys
Max Fillinger [Fri, 31 Oct 2025 10:08:04 +0000 (11:08 +0100)] 
Zeroize tls-crypt-v2 client keys

Joshua Rogers sent in a bug report generated with ZeroPath that the
tls-crypt-v2 client key is loaded before running the verify script. If
the verify script fails, the key is not zeroized.

While investigating this report, I found that free_tls_pre_decrypt_state
never zeroizes tls_wrap_tmp.original_wrap_keydata. So also when the
check is successful, key data will remain in memory when it is no longer
needed.

This commit moves the tls-crypt-v2-verify check before loading the key.
If it fails, original_wrap_keydata is zeroized. Also, in
free_tls_pre_decrypt_state, if a key has been loaded,
original_wrap_keydata is zeroized.

Reported-By: Joshua Rogers <contact@joshua.hu>
Found-by: ZeroPath (https://zeropath.com/)
Change-Id: Icfcbf8ee20c1c0016eb98b570f24b9325b157c5c
Signed-off-by: Max Fillinger <max@max-fillinger.net>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1315
Message-Id: <20251031100819.24855-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34103.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoPUSH_UPDATE server: invalid read bug-fix and unit-tests improvements
Marco Baffo [Thu, 30 Oct 2025 19:52:35 +0000 (20:52 +0100)] 
PUSH_UPDATE server: invalid read bug-fix and unit-tests improvements

The number of messages calculated before the call to message_splitter(),
used in the memory allocation in the buffer array, could in certain
cases be less than one than the actual number of messages, thus causing
an override of the sentinel buffer in message_splitter() and therefore
an invalid read in send_single_push_update().
The case in question would be, for example, a sequence of three options
"A,B,C" with the size of B equal to safe_cap - 1 and the sum of the
sizes of A and C less than safe_cap - 2.

The buffer array was therefore replaced with a list of buffers to
completely avoid calculating the number of messages before it was
actually computed.
The test case in question has been added to the unit tests.
The unit tests have been improved using cmocka macros.

Change-Id: Idba419681fe3ccc4e6e2f6ce7592332dcff62cd9
Signed-off-by: Marco Baffo <marco@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1316
Message-Id: <20251030195244.2659-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34073.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoAdd -lpathcch for mingw32 builds using autotools
Selva Nair [Fri, 31 Oct 2025 09:23:52 +0000 (10:23 +0100)] 
Add -lpathcch for mingw32 builds using autotools

This was missed in commit 05a8ba8

Note: the check for PATHCCH_ENSURE_TRAILING_SLASH in
configure.ac may be omitted if we build only using latest
mingw32-w64 toolchain. Ubuntu 24.04 is not new enough.

Github: closes OpenVPN/openvpn#885

Change-Id: Ifea896e722635a471cc01f930bc1e5d0f2c165be
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/+/1334
Message-Id: <20251031092427.19824-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34095.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoiservice: check return value of MultiByteToWideChar
Heiko Hund [Thu, 30 Oct 2025 19:47:31 +0000 (20:47 +0100)] 
iservice: check return value of MultiByteToWideChar

If the first call to MultiByteToWideChar returns 0, something must have
failed, because it returns the required buffer size including the
terminating zero. When it does return 0, just return NULL and indicate
that the call to utf8to16(_size) failed.

Found by ZeroPath.

Reported-By: Joshua Rogers <contact@joshua.hu>
Change-Id: I92804da010bab36cd0326759c04f955f2bda74de
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1306
Message-Id: <20251030194736.2151-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34071.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoEnsure that get_sigtype always return non-NULL
Arne Schwabe [Thu, 30 Oct 2025 19:29:57 +0000 (20:29 +0100)] 
Ensure that get_sigtype always return non-NULL

There is a theoretical possibility that OpenSSL returns an NID that
OBJ_nid2sn cannot resolve and thus the function return NULL.

This is however extremely unlikely. But we still cover this case now
to make linters/code checker happy and avoid similar false positives
in the future.

Reported-by: Joshua Rogers <contact@joshua.hu>
Found-by: ZeroPath (https://zeropath.com/)
Change-Id: I70e221ff5d9752fec17bad18fd41dcf188ae8fbc
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1325
Message-Id: <20251030193003.348-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34060.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoEnsure return value of snprintf is correctly checked
Arne Schwabe [Thu, 30 Oct 2025 19:36:30 +0000 (20:36 +0100)] 
Ensure return value of snprintf is correctly checked

Commit 130548fe4d change the usages of openvpn_snprintf to snprintf. When
doing that conversion I did not notice that, despite the function name,
openvpn_snprintf had a different semantic for the return value.

This commit goes through all the usages of snprintf and ensures that
the return is correctly checked for overruns.

Reported-by: Joshua Rogers <contact@joshua.hu>
Found-by: ZeroPath (https://zeropath.com/)
Change-Id: I830b6b27fc3efe707e103ba629c4bfe3796a9cbe
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1330
Message-Id: <20251030193638.1010-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34063.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoFix warnings about conversion from int to unsigned char/uint8_t
Arne Schwabe [Thu, 30 Oct 2025 19:38:20 +0000 (20:38 +0100)] 
Fix warnings about conversion from int to unsigned char/uint8_t

When compiling with cmake -DCMAKE_BUILD_TYPE=ASAN under Ubuntu 25.10
(gcc 15.2.0).

Explicitly cast these instances to uint8_t/unssigned char to silence this
warning.

Change-Id: I648ee99b1152b1248d1b3e64af7679ab99f1388f
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1328
Message-Id: <20251030193834.1186-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34065.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agofix key_state_gen_auth_control_files probably checking file creation
Arne Schwabe [Thu, 30 Oct 2025 19:39:34 +0000 (20:39 +0100)] 
fix key_state_gen_auth_control_files probably checking file creation

When the auth_failed_reason_file was added, it was forgotten to also add it
to the conditions that determine if the file creation was successful.

Reported-by: Joshua Rogers <contact@joshua.hu>
Found-by: ZeroPath (https://zeropath.com/)
Change-Id: I94d2bdd234a1c416b78924d044bf7e57f1bed8c4
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1327
Message-Id: <20251030193940.1295-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34067.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoclean up environment variable handling in verify_user_pass_script
Arne Schwabe [Thu, 30 Oct 2025 19:43:56 +0000 (20:43 +0100)] 
clean up environment variable handling in verify_user_pass_script

The username environment variable is already set by the
set_verify_user_pass_env function before the verify_user_pass_script
function is called, so this call is not doing anything but might erroneously
made people think that this needs to be cleaned up.

Also ensure that the password is clean from the env even in an error case.

Reported-by: Joshua Rogers <contact@joshua.hu>
Found-by: ZeroPath (https://zeropath.com/)
Change-Id: I6c502508026c6b85bb092ada4d16d985b20dd41f
Signed-off-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1326
Message-Id: <20251030194402.1729-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34069.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agomanage: Change kill_by_addr to use better types for port/proto
Frank Lichtenheld [Thu, 30 Oct 2025 18:29:12 +0000 (19:29 +0100)] 
manage: Change kill_by_addr to use better types for port/proto

Change-Id: I750a0b8107baa77fb14558d0c8e4ef8020d62efd
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1310
Message-Id: <20251030182922.26448-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34054.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>