]> git.ipfire.org Git - thirdparty/openvpn.git/log
thirdparty/openvpn.git
5 days agoRemove --memstats feature
Arne Schwabe [Wed, 29 Oct 2025 16:38:43 +0000 (17:38 +0100)] 
Remove --memstats feature

The ``--mememstat`` was largely undocumented and there is no known
user of this feature.  This feature provided very limited statistics
(number of users, link bytes read/written) and we do not except any
usage because of this.

The only documentation was a mention in --help without any mention of
the (binary) format of the mmap file or other usage instructions.

This deals also with issues reported by zeropath regarding potentially
insecure handling of the file permission of the memory mapped file.

Reported-by: Joshua Rogers <contact@joshua.hu>
Found-by: ZeroPath (https://zeropath.com/)
Change-Id: I5f57e7bf52e3f6289462ef05e1f6e81ab0133d0d
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1329
Message-Id: <20251029163849.446-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34021.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 days agoInstall host routes for out-of-subnet ifconfig-push addresses when DCO is enabled
Arne Schwabe [Wed, 29 Oct 2025 07:06:56 +0000 (08:06 +0100)] 
Install host routes for out-of-subnet ifconfig-push addresses when DCO is enabled

ifconfig-push and ifconfig-ipv6-push can configure the IP address of a
client. If this IP address lies inside the network that is configured
on the ovpn/tun device this works as expected as the routing table point to
the ovpn/tun interface.  However, if the IP address is outside that range,
the IP packets are not forwarded to the ovpn/tun interface and Linux
and FreeBSD DCO implementations need a "connected" route so kernel
routing knows that the IP in question is a peer VPN IP.

This patch adds logic to add host routes for these ifconfig-push +
ifconfig-ipv6-push addresses to ensure that traffic for these IP
addresses is also directed to the VPN.

For Linux it is important that these extra routes are routes using scope
link rather than static since otherwise indirect routes via these IP
addresses, like iroute, will not work. On FreeBSD we also use interface
routes as that works and routes that target interfaces instead of
next-hop IP addresses are less brittle.

Tested using a server with ccd:

   openvpn --server 10.33.0.0 255.255.192.0 --server-ipv6 fd00:f00f::1/64  --client-config-dir ~/ccd [...]

and a client with lwipvonpn and the following ccd file:

   iroute-ipv6 FD00:F00F:CAFE::1001/64
   ifconfig-ipv6-push FD00:F00F:D00D::77/64
   push "setenv-safe ifconfig_ipv6_local_2 FD00:F00F:CAFE::1001"
   push "setenv-safe ifconfig_ipv6_netbits_2 64"

   iroute 10.234.234.0 255.255.255.0
   ifconfig-push 10.11.12.13 255.255.255.0
   push "setenv-safe ifconfig_local_2 10.234.234.12"
   push "setenv-safe ifconfig_netmask_2 255.255.255.0"

This setups an ifconfig-push addresses outside the --server/--server-ipv6
network and additionally configures a iroute behind that client. The
setenv-safe configure lwipovpn to use that additional IP addresses to allow
testing via ping.

Windows behaves like the user space implementation. It does not require these
special routes but instead (like user space) needs static routes to redirect
IP traffic for these IP addresses to the tunnel interface. E.g. in the example
above the server config needs to have:

   route 10.234.234.0 255.255.255.0
   route 10.11.12.0 255.255.255.0

   route-ipv6 FD00:F00F:CAFE::1001/64
   route-ipv6 FD00:F00F:D00D::77/64

Change-Id: I83295e00d1a756dfa44050b0a4493095fb050fff
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1192
Message-Id: <20251029070701.11457-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33991.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 days agoFix logic when pushed cipher triggers tun reopen and ignore more options
Arne Schwabe [Wed, 29 Oct 2025 06:53:10 +0000 (07:53 +0100)] 
Fix logic when pushed cipher triggers tun reopen and ignore more options

The logic was inverted. Only when link-mtu is used, pushing a cipher can
change the MTU and not the other way round. (found by zeropath)

Also ignore a few more options that should not trigger a reopen of tun
in push message.

Reported-by: Joshua Rogers <contact@joshua.hu>
Found-by: ZeroPath (https://zeropath.com/)
Change-Id: I76eb584024610a6054a069340adbac988abf686c
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/+/1321
Message-Id: <20251029065316.10182-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33989.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 days agozeroize struct image in packet_id_persist_save() before writing to disk
Gert Doering [Tue, 28 Oct 2025 20:31:50 +0000 (21:31 +0100)] 
zeroize struct image in packet_id_persist_save() before writing to disk

while this really is only a debug function, ensuring that no uninitialized
heap content ends up in padding in the structure and thus to disk is good
practice.

Reported-by: Joshua Rogers <contact@joshua.hu>
Found-by: ZeroPath (https://zeropath.com/)
Change-Id: I7f4c7b0ca748975defca1e5104e7077a761cd49c
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1323
Message-Id: <20251028203156.11697-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33983.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 days agoremove redundant PULL_DEFINED() macro definition
Gert Doering [Tue, 28 Oct 2025 20:32:10 +0000 (21:32 +0100)] 
remove redundant PULL_DEFINED() macro definition

this seems to be a leftover of the time when we had conditional
compilation for "--disable-server" or thus.  Commit d6a0cf599
removed PUSH_DEFINED() nearby but overlooked this one.

Change-Id: I9118333bb65cd5db0836abefa5d45a729f0142cc
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1322
Message-Id: <20251028203219.11737-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33984.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 days agocrypto_backend: Change len argument of md_ctx_update to size_t
Frank Lichtenheld [Tue, 28 Oct 2025 18:57:01 +0000 (19:57 +0100)] 
crypto_backend: Change len argument of md_ctx_update to size_t

The underlying APIs already use size_t and all the
users (only httpdigest and push) already put size_t
into it. So avoid conversion warnings.

Also fix one trivial conversion warning in push.c
to able to easily remove the -Wconversion override
from the affected code paths.

Change-Id: I27f2fcd903d26ccbfbd0cdc45f99cc3cd8b0e49a
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1287
Message-Id: <20251028185706.1247-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33973.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 days agogremlin: Avoid some conversion warnings
Frank Lichtenheld [Tue, 28 Oct 2025 18:39:35 +0000 (19:39 +0100)] 
gremlin: Avoid some conversion warnings

We know these casts are safe, so make
them explicit.

Change-Id: I2554b9baec6af191b0adb137e64124586dc4331c
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1286
Message-Id: <20251028183945.31901-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33964.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 days agomanagement: ensure consistent BYTECOUNT timing on server
Ralf Lici [Tue, 21 Oct 2025 07:08:20 +0000 (09:08 +0200)] 
management: ensure consistent BYTECOUNT timing on server

The BYTECOUNT notification is expected to be emitted every N seconds
when a management client issues the 'bytecount N' command. However, the
server currently relies on timeouts from unrelated periodic operations,
resulting in irregular notification timing.

This issue is especially noticeable with low bytecount intervals and DCO
enabled, as openvpn handles less traffic in userspace, causing the main
loop to run less frequently.

To address this, refactor the timeout logic and pass the timeval
reference to management_check_bytecount_server so that the timeout is
correctly set and notifications adhere to the specified interval.

Change-Id: Ifb1c49fce75e671f699f5db5f6da7246f6e0b519
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20251021070825.20773-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33812.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 days agoWarn if push is used without --mode server/--server/--server-bridge
Arne Schwabe [Thu, 23 Oct 2025 15:56:08 +0000 (17:56 +0200)] 
Warn if push is used without --mode server/--server/--server-bridge

This is not a supported configuration and will often work good enough
to get a connection working but will operate more in a weird pre P2P
negotiation compatibility way rather than actually negotiating
protocol features.

While at it, remove an unused macro (PUSH_DEFINED).

Change-Id: I82c7c61be07593ecd5bf2f854767dda74ab5170c
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1288
Message-Id: <20251023155614.20642-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33856.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 days agotcp: apply CLOEXEC to accepted socket, not listener
Joshua Rogers [Tue, 21 Oct 2025 17:20:52 +0000 (01:20 +0800)] 
tcp: apply CLOEXEC to accepted socket, not listener

The accept path calls set_cloexec(sd) after accept(). That re-flags the
listening socket, which is already CLOEXEC from create_socket_tcp(), and
leaves new_sd inheritable. As a result, client-connect and auth scripts
spawned after accept can inherit the connected socket and read or write
the raw TCP stream. This defeats the stated intent to prevent scripts from
accessing the client socket.

This bug was found using ZeroPath.

Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <-MNw5Hu8h0rHV18x36ISt7V0UHchIO4i-JoAeV_wlxS1AmDIAe7YVYNput3_r2hiu3HhwxkhGyUhv4-iH_E7mf7nGjvocmGXlDq7Tjly5cE=@joshua.hu>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33823.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 days agositnl: set FD_CLOEXEC on socket to prevent abuse
Antonio Quartulli [Tue, 28 Oct 2025 16:28:38 +0000 (17:28 +0100)] 
sitnl: set FD_CLOEXEC on socket to prevent abuse

Since OpenVPN spawns various child processes, it is important
that sockets are closed after calling exec.

The sitnl socket didn't have the right flag set, resulting
in it surviving in, for example, connect/disconnect scripts
and giving the latter a chance to abuse the socket.

Ensure this doesn't happen by setting FD_CLOEXEC on
this socket right after creation.

Reported-by: Joshua Rogers <contact@joshua.hu>
Found-by: ZeroPath (https://zeropath.com/)
Change-Id: I54845bf4dd17d06cfc3b402f188795f74f4b1d3e
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1314
Message-Id: <20251028162843.18189-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33952.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 days agoCanonicalize config_dir before comparing with the config file location
Selva Nair [Tue, 28 Oct 2025 10:16:36 +0000 (11:16 +0100)] 
Canonicalize config_dir before comparing with the config file location

Found by ZeroPath

Change-Id: I8e884c00cb94f97a612056e8dca74d821a6d6386
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/+/1318
Message-Id: <20251028101642.11874-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33923.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 days agomroute: Remove unused mask argument of mroute_get_in*
Frank Lichtenheld [Tue, 28 Oct 2025 12:20:23 +0000 (13:20 +0100)] 
mroute: Remove unused mask argument of mroute_get_in*

These are obsolete since the removal of pf feature.
Avoids spurious conversion warnings.

Change-Id: I501bf780957a9c685eed5994a15de09c28efc3f0
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1309
Message-Id: <20251028122028.24628-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33939.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 days agoAdd ASSERT to afunix code that dev_node is always set up the way we expect
Arne Schwabe [Tue, 28 Oct 2025 11:59:47 +0000 (12:59 +0100)] 
Add ASSERT to afunix code that dev_node is always set up the way we expect

The calling code only calls tun_afunix_exec_child if is_tun_afunix is true,
which checks that the path is having unix: as prefix.

But since adding an ASSERT here to ensure that it is really the case
does not cost us anything, just add the ASSERT.

Reported-By: Joshua Rogers <contact@joshua.hu>
Found-By: Zeropath
Change-Id: Idbb7bf279eb467fc1d56ab75a50b5eb2c8d0a57e
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/+/1320
Message-Id: <20251028115953.22487-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33934.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 days agodco-freebsd: fix peer stats storage on client instances
Ralf Lici [Tue, 28 Oct 2025 11:33:05 +0000 (12:33 +0100)] 
dco-freebsd: fix peer stats storage on client instances

Commit bf01a96 introduced a bug in the dco-freebsd path by attempting to
store peer statistics in a structure that only exists on server
instances. This leads to a SIGSEGV on non-server instances due to a NULL
multi_context pointer.

Resolve this by checking what mode the current instance is running in
and storing peer stats accordingly.

Fixes: https://github.com/OpenVPN/openvpn/issues/875
Change-Id: I92b5f3996f2a2180fa5e94719603078c1fc2f7f6
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1290
Message-Id: <20251028113310.19921-1-gert@greenie.muc.de>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 days agoAvoid possible race condition that kill OpenVPN itself
Arne Schwabe [Mon, 27 Oct 2025 21:33:02 +0000 (22:33 +0100)] 
Avoid possible race condition that kill OpenVPN itself

If for whatever reason the child pid is zero, we would kill ourselves
since killing 0 means killing the own process group.

Reported-By: Joshua Rogers <contact@joshua.hu>
Found-By: Zeropath
Change-Id: I7b94de92723f9528b01cb932bb079eedf0f1f272
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/+/1319
Message-Id: <20251027213308.5588-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33910.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 days agopkcs11_management_id_get: Free certificate object after use
Selva Nair [Mon, 27 Oct 2025 21:27:41 +0000 (22:27 +0100)] 
pkcs11_management_id_get: Free certificate object after use

Found by ZeroPath

Change-Id: I85320b8f1cfc02dfd561916e5637d9481edac59e
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/+/1317
Message-Id: <20251027212747.4161-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33908.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
8 days agoRemove perf.c/perf.h
Steffan Karger [Sun, 26 Oct 2025 14:20:52 +0000 (15:20 +0100)] 
Remove perf.c/perf.h

This code was always disabled by ENABLE_PERFORMANCE_METRICS being
commented out in perf.h. There was no configure flag. None of the
active developers remembers using it, the git log shows no actual
code changes since at least the project structure overhaul of 2012,
and tools like gprof are nowadays the go-to tool for performance
profiling. So, out with our custom implementation.

This was triggered by a bug report submitted by Joshua Rogers, who
used ZeroPath to discover we missed a perf_pop() call in one of the
error paths of ssl_mbedtls.c. This commit resolves that using git rm.

Change-Id: I5bb666a73b4381066e86f53d957e1987fa07303b
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1303
Message-Id: <20251026142100.12147-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33868.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
12 days agoDo not try to use the encrypt-then-mac ciphers from OpenSSL 3.6.0
Arne Schwabe [Thu, 23 Oct 2025 11:11:33 +0000 (13:11 +0200)] 
Do not try to use the encrypt-then-mac ciphers from OpenSSL 3.6.0

These ciphers claim to be CBC but since they are also include an HMAC
are more a mix of AEAD and CBC. Nevertheless, we do not support these
and also have no (good) reason to support them.

This patch defines the flag if the SSL library does not define the flag
to also work when the SSL library is upgraded after OpenVPN has been compiled.

Change-Id: Iafe3c94b952cd3fbecf6f3d05816e5859f425e7d
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1294
Message-Id: <20251023111138.25245-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33846.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
13 days agomulti: Fix wrong usage of mroute_extract_openvpn_sockaddr
Frank Lichtenheld [Tue, 21 Oct 2025 19:31:40 +0000 (21:31 +0200)] 
multi: Fix wrong usage of mroute_extract_openvpn_sockaddr

maddr.proto needs to be set before the call since that
will change the behavior.

Found by GCC "'maddr.proto' is used uninitialized"

Change-Id: I76babf08b041162ddedf7a9b7c2799847f15cbdc
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Gianmarco De Gregori <gianmarco@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1292
Message-Id: <20251021193147.26778-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33830.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agodco: remove dco_read/write_bytes from dco_context_t
Ralf Lici [Fri, 17 Oct 2025 20:58:31 +0000 (22:58 +0200)] 
dco: remove dco_read/write_bytes from dco_context_t

Remove dco_read_bytes and dco_write_bytes from all dco_context_t
structures, as peer statistics are now stored directly in the
corresponding c2 fields across all DCO interfaces.

Change-Id: I61f9d9bb26112eac0c0a47cb9d17982b075887ff
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1276
Message-Id: <20251017205837.8553-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33431.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agodco-freebsd: store peer stats directly in c2
Ralf Lici [Sun, 19 Oct 2025 17:02:42 +0000 (19:02 +0200)] 
dco-freebsd: store peer stats directly in c2

The dco_context_t structure includes a reference to the general context
structure c, which allows us to store dco_read_bytes and dco_write_bytes
directly as c2 fields. This aligns the FreeBSD implementation with how
we handle DCO peer stats on Linux and Windows.

Change-Id: I53dd40fabdeacb9dca843e28fdd3b357711c5a84
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1275
Message-Id: <20251019170249.30942-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33791.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agopush_util: Fix conversion warnings
Frank Lichtenheld [Sat, 18 Oct 2025 17:02:32 +0000 (19:02 +0200)] 
push_util: Fix conversion warnings

Mostly just use better types.

Change-Id: I4113d14c6ce33818573b0ca5857a9ab39b35a8f4
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: mrbff <marco@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1283
Message-Id: <20251018170237.21928-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59248341/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agossl_util: Fix conversion warning in get_num_elements
Frank Lichtenheld [Fri, 17 Oct 2025 20:49:09 +0000 (22:49 +0200)] 
ssl_util: Fix conversion warning in get_num_elements

Just use correct type.

Change-Id: I2d1fbe7ec080beb931253d09c1b5227e9bf4e756
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1281
Message-Id: <20251017204914.7548-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33421.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agopush_util: Make send_push_update static
Frank Lichtenheld [Fri, 17 Oct 2025 20:38:24 +0000 (22:38 +0200)] 
push_util: Make send_push_update static

Not necessary to make it non-static just for UTs.

Change-Id: I348abec1e2f32301a0368d5f541e67bddf358bbc
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1282
Message-Id: <20251017203830.23807-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59248152/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoPUSH_UPDATE server: remove old IP(s) from vhash after sending a message containing...
Marco Baffo [Fri, 17 Oct 2025 20:19:12 +0000 (22:19 +0200)] 
PUSH_UPDATE server: remove old IP(s) from vhash after sending a message containing ifconfig(-ipv6)

When sending a PUSH_UPDATE containing an ifconfig(-ipv6) option, we must add the new IP to the
multi_context vhash (hash table of the clients indexed by virtual IPs). Now in addition to
adding new client IPs, old IPs are also removed from vhash, allowing for a more complete update.

Change-Id: I07a8ddd9026eef64b6f5abde98702a9801616a5f
Signed-off-by: Marco Baffo <marco@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1253
Message-Id: <20251017201916.21697-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33412.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agooptions: warn and ignore --reneg-bytes/pkts when DCO is enabled
Ralf Lici [Fri, 17 Oct 2025 19:16:06 +0000 (21:16 +0200)] 
options: warn and ignore --reneg-bytes/pkts when DCO is enabled

Thresholds specified by --reneg-bytes and --reneg-pkts cannot be
enforced when DCO is enabled, as it only provides global statistics.

Rather than adding complexity to support these options, ignore them when
DCO is enabled. Print a warning to inform users and update the manpage
accordingly.

Change-Id: I7b718a14b81e3759398e7a52fe151102494cc821
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1280
Message-Id: <20251017191612.15642-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59248122/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoproxy: factor out send code common with socks proxy
Frank Lichtenheld [Thu, 16 Oct 2025 10:37:22 +0000 (12:37 +0200)] 
proxy: factor out send code common with socks proxy

Change-Id: Ieb18101dcf8143efdae1c39bde356e7166cbefa5
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1279
Message-Id: <20251016103730.5319-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59247465/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoproxy: factor out recv_char code common with socks proxy
Frank Lichtenheld [Thu, 16 Oct 2025 10:31:35 +0000 (12:31 +0200)] 
proxy: factor out recv_char code common with socks proxy

Change-Id: I70620aca638847168f06b0fb23cc04bd279d7df9
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1278
Message-Id: <20251016103143.4461-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59247456/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agosocket: Wrap winsock functions to avoid common conversion warnings
Frank Lichtenheld [Thu, 16 Oct 2025 10:17:16 +0000 (12:17 +0200)] 
socket: Wrap winsock functions to avoid common conversion warnings

Before I had done those at the call site but we have
several very similar issues with multiple occurrences.
So handle them together.

Change-Id: If91d14f31368a93182bcf23b1d82b06ea94381d8
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1277
Message-Id: <20251016101722.2979-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59247452/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 weeks agoinit: Fix datav2_enabled check in options import
Frank Lichtenheld [Thu, 16 Oct 2025 10:33:03 +0000 (12:33 +0200)] 
init: Fix datav2_enabled check in options import

peer_id is unsigned, so the previous check was partly
useless. Instead check use_peer_id.

Change-Id: Ia713a2ecfcad7032863867630a0c306ff9f90385
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1273
Message-Id: <20251016103308.4685-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33365.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agodhcp: Clean up type handling of write_dhcp_*
Frank Lichtenheld [Mon, 13 Oct 2025 16:17:53 +0000 (18:17 +0200)] 
dhcp: Clean up type handling of write_dhcp_*

Use more appropriate types. Add casts where
necessary but ensure that they are safe.

Change-Id: I30a50826350ac3176443cf3bf16d3972609723a2
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1268
Message-Id: <20251013161759.1656-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59246219/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agowin32: Change some APIs to use DWORD instead of size_t
Frank Lichtenheld [Mon, 13 Oct 2025 16:22:15 +0000 (18:22 +0200)] 
win32: Change some APIs to use DWORD instead of size_t

This is what the Win32 APIs use. Since we put static
integers into this (e.g. sizeof()) this doesn't
result in new conversion warnings at the caller sites.

Change-Id: Ia836e3c05a868a7e8419c2bb2f547d968260783c
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1269
Message-Id: <20251013162221.2156-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59246222/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoschedule: Fix conversion warning
Frank Lichtenheld [Mon, 13 Oct 2025 16:23:08 +0000 (18:23 +0200)] 
schedule: Fix conversion warning

Return value of random() is safe to cast.

Change-Id: I5e6cb3a287a2e8e1584036307b4c21bb68050c6a
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1270
Message-Id: <20251013162313.2276-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59246224/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoCONTRIBUTING: Update outdated/obsolete information
Frank Lichtenheld [Mon, 13 Oct 2025 16:03:39 +0000 (18:03 +0200)] 
CONTRIBUTING: Update outdated/obsolete information

- uncrustify -> clang-format
- add Gerrit
- update Wiki links

Change-Id: I77a59b9b74a13793782fbfbff6bd2ec581f86be0
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1271
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20251013160346.32741-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59246212/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agotest_dhcp: Start a dhcp helper functions UT
Frank Lichtenheld [Mon, 13 Oct 2025 15:47:53 +0000 (17:47 +0200)] 
test_dhcp: Start a dhcp helper functions UT

Use extra define to allow testing code only
used on Windows but not actually dependent
on Windows.

Change-Id: I08e50030b1b692d351509f541e5c0b03b5170615
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1267
Message-Id: <20251013154758.21695-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59246199/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agodoc: HTTPS upgrades and URL fixes throughout the tree
Christian Kujau [Mon, 6 Oct 2025 14:42:48 +0000 (16:42 +0200)] 
doc: HTTPS upgrades and URL fixes throughout the tree

* HTTPS upgrades
* 404 fixes, with hopefully better helpful links to the relevant documentation
* some trailing white space fixes
* resurrect utun-demo.c from a different source
* Don't touch openvpn.doxyfile.in though, as it was autogenerated
* Don't touch COPYING as it's an external license file
* The openvpn.net URLs will be addressed some other time

Signed-off-by: Christian Kujau <github@nerdbynature.de>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20251006144249.23672-3-lists@nerdbynature.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59242866/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agodoc: Fix hyperlinks in openvpn(8)
Christian Kujau [Mon, 6 Oct 2025 14:42:47 +0000 (16:42 +0200)] 
doc: Fix hyperlinks in openvpn(8)

* http://www.cs.ucsd.edu/users/mihir/papers/hmac.html - 404, RFC104 basically
* http://sites.inka.de/sites/bigred/devel/tcp-tcp.html - 404, unfortunately
* http://www.ietf.org/rfc/rfc2246.txt - HTTPS upgrade to the HTML version

Signed-off-by: Christian Kujau <github@nerdbynature.de>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20251006144249.23672-2-lists@nerdbynature.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59242864/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoOpenVPN Release 2.7_beta3 v2.7_beta3
Gert Doering [Sun, 12 Oct 2025 16:59:36 +0000 (18:59 +0200)] 
OpenVPN Release 2.7_beta3

version.m4, ChangeLog, Changes.rst

Changes.rst has not received an "2.7_beta3" 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 beta2 -> beta3 are:
   - even more of signed/unsigned related warnings have been fixed
   - document that PUSH_UPDATE is (as of now) not compatible with DCO,
     and add adequate checks
   - improvements on PUSH_UPDATE handling on the server side
   - bugfixes reconnect and PUSH_UPDATE handling on the client side
     (notably handling of ifconfig/ifconfig-ipv6/redirect-gateway ipv6
     if the server is not always pushing the same address families)
   - improve "recursive routing checks", prepare the way for a
     policy-based setup where "packets to VPN server" could end up
     in the tunnel without interfering with OpenVPN operations
   - improve unit testing, add more unit tests, fix unit test bugs
   - add support for "eoch" data format to DCO on Windows
     (needs dco-win driver 2.8.0+)
   - clean up and remove outdated stuff from COPYING

Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoMake recursive routing check more fine-grained
Lev Stipakov [Sat, 11 Oct 2025 11:44:42 +0000 (13:44 +0200)] 
Make recursive routing check more fine-grained

The existing recursive routing check drops TUN packets
if their address matches the remote. While this works in
most cases, a more fine-grained check is preferable for
complex routing rules.

Since we only need to drop traffic originating from OpenVPN,
all of the following values must match between the packet
and the link:

 - IP protocol
 - Transport protocol (TCP/UDP)
 - Destination address
 - Destination port

GitHub: #699

Change-Id: I6841e2f2a85275254a04e2d8ae3defe4420db8f6
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/903
Message-Id: <20251011114448.14501-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59245301/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoredirect-gateway: only redirect traffic through TUN if address families match
Marco Baffo [Sat, 11 Oct 2025 11:14:11 +0000 (13:14 +0200)] 
redirect-gateway: only redirect traffic through TUN if address families match

Adds a check in do_init_route_ipv6_list() to add default routes toward the TUN
only if the TUN has IPv6 addresses.

Github: fixes OpenVPN/openvpn#850
Github: see also OpenVPN/openvpn#863

Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
Signed-off-by: mrbff <marco@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1210
Message-Id: <20251011111417.11802-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59245295/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agotest_user_pass: Check fatal errors for empty username/password
Frank Lichtenheld [Fri, 10 Oct 2025 21:11:47 +0000 (23:11 +0200)] 
test_user_pass: Check fatal errors for empty username/password

Required a fix to mock_msg to make tests of M_FATAL
possible at all.
This also tests some cases which arguably should throw
a fatal error but do not.

v2:
 - Suppress LeakSanitizer errors for fatal error tests.
   Due to aborting the function, the memory will not be
   cleaned up, but that is expected.
v3:
 - Disable assert tests with MSVC. Does not seem to catch
   the error correctly.
 - Rebase on top of parallel-tests series to get
   AM_TESTS_ENVIRONMENT.
v8:
 - Update srcdir handling according to master.
v10:
 - Update mock_msg.c fatal handling to be compatible
   with NO_CMOCKA.

Change-Id: Icabc8acf75638c86c8c395e9ffecba7a7226cd97
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/474
Message-Id: <20251010211154.2780-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59245149/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agodhcp: Replace DHCP Option types with defines
Frank Lichtenheld [Sat, 11 Oct 2025 08:22:26 +0000 (10:22 +0200)] 
dhcp: Replace DHCP Option types with defines

Just nicer. Verified against
https://www.iana.org/assignments/bootp-dhcp-parameters/bootp-dhcp-parameters.xhtml

Change-Id: Ie41101bd00d038fa6fb906f3d30d44bf65788b96
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1266
Message-Id: <20251011082232.27602-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59245241/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoMove build_dhcp_options_string from tun to dhcp
Frank Lichtenheld [Sat, 11 Oct 2025 08:22:11 +0000 (10:22 +0200)] 
Move build_dhcp_options_string from tun to dhcp

Seems suitably related and tun.c is one of the
huge ones.

In preparation of adding UTs for the code.

Change-Id: I62a8f62b9c0938cfcb99d184b07034515c076303
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1265
Message-Id: <20251011082217.27568-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59245240/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoPUSH_UPDATE server: check IV_PROTO before sending the message to the client
Marco Baffo [Thu, 9 Oct 2025 18:28:49 +0000 (20:28 +0200)] 
PUSH_UPDATE server: check IV_PROTO before sending the message to the client

Before sending the PUSH_UPDATE message to the client, we must verify that
the client has actually sent IV_PROTO_PUSH_UPDATE to the server, declaring that
it supports push-updates.

Also fixed a gc_arena memory leak in one of the error paths and asserted
mi->context.c2.tls_multi .

Change-Id: I7c28da72be11c7efbed3068fbfc65f2959227bec
Signed-off-by: Marco Baffo <marco@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1255
Message-Id: <20251009182855.18712-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59244566/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoPUSH_UPDATE server: bug-fix, reset buffer after processing
Marco Baffo [Fri, 10 Oct 2025 14:19:56 +0000 (16:19 +0200)] 
PUSH_UPDATE server: bug-fix, reset buffer after processing

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

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

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

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

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

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

Replace where it is useful.

While here also add a missing cast in atoi_constrained.

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

Github: closes OpenVPN/openvpn#861

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

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

Consider following scenario:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

For now contains one test case for parse_line.

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

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

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

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

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

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

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

Verified in the code and tested locally.

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

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

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

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

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

Also adjust style a bit to C99

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

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

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

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

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

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

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

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

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

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

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

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

Just use the correct type.

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

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

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

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

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

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

So we could enable -Werror for OpenBSD builds.

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

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

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

Commit

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

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

Fix by adjusting ASSERT to >= 0.

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

Doesn't change anything for non-Win32 platforms.

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

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

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

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

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

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

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

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

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

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

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

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

version.m4, ChangeLog, Changes.rst

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

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

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

This adds validation of following DNS options:

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

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

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

 --dns search-domains x;id

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This is basically identical code duplicated three
times.

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

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

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

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

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

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

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

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

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

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

Fix conversion warnings without actual code changes.

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

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

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

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

Change-Id: I5fea6ca1ccadb434b5c4f4b49881524a079a9d15
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Antonio Quartulli <antonio@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1203
Message-Id: <20250922080305.18477-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59236810/
Signed-off-by: Gert Doering <gert@greenie.muc.de>