]> git.ipfire.org Git - thirdparty/openvpn.git/log
thirdparty/openvpn.git
8 hours agoopenvpnserv: Fix writing messages to the event log master
Lev Stipakov [Wed, 17 Sep 2025 09:05:48 +0000 (11:05 +0200)] 
openvpnserv: Fix writing messages to the event log

There are two problems with the current implementation:

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

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

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

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

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

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

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

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

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

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

This is based on 2.6 patch which replaces wmic with powershell

    d383d6e "win: replace wmic invocation with powershell"

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

Github: fixes OpenVPN/openvpn#642

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

The used functions already expect this.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Commit

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

version.m4, ChangeLog, Changes.rst

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

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

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

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

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

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

The argument changed type in OpenSSL 3.0.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

There are few issues with it:

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

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

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

Following changes have been made:

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

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

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

GitHub: closes OpenVPN/openvpn#820

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

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

Two usage modes are supported:

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

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

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

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

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

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

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

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

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

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

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

This includes

- openvpn_getaddrinfo and related functions
- print_*
- setenv_*

And lots of the inline functions.

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

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

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

Introduce new env vars:

 route_redirect_gateway_ipv4
 route_redirect_gateway_ipv6

to communicate desired state:

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

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

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

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

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

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

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

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

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

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

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

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

To trigger this circumstance a connection needs to

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

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

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

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

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

   Packet (P_ACK_V1) with invalid or missing SID

instead.

Also remove a few duplicated free_tls_pre_decrypt_state in test_ssl.

Reported-By: Walter Doekes <walter.openvpn@wjd.nu>
Tested-By: Walter Doekes <walter.openvpn@wjd.nu>
Change-Id: I6752dcd5aff3e5cea2b439366479e86751a1c403
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: MaxF <max@max-fillinger.net>
Message-Id: <20250819212214.16218-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32626.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoClean up documentation for --tun-mtu-max
Frank Lichtenheld [Sat, 23 Aug 2025 15:36:46 +0000 (17:36 +0200)] 
Clean up documentation for --tun-mtu-max

There was some confusion about how the option
was called...

Change-Id: I5e240c35cd4236e1d845195e4634fd5008f61814
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250823153652.30938-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32663.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agooptions: Fix --hash-size virtual argument
Frank Lichtenheld [Fri, 22 Aug 2025 20:52:16 +0000 (22:52 +0200)] 
options: Fix --hash-size virtual argument

Previously we ignored the second argument to --hash-size.
This bug is older than the openvpn git repository, but
clearly this is not an option often used (or at all).

Change-Id: Ibec7ffb9085503f72e79514776042bc310384f13
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250822205223.3492-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32658.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
3 weeks agoAdd sample FFDH parameters file and use that in t_server_null tests
Samuli Seppänen [Thu, 21 Aug 2025 12:14:34 +0000 (14:14 +0200)] 
Add sample FFDH parameters file and use that in t_server_null tests

Change-Id: I13ad2b7da6b008bc692b1f08f502fc3fc57e7206
Signed-off-by: Samuli Seppänen <sasepp@pm.me>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Message-Id: <20250821121442.30679-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32643.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoRemove use of 'dh dh2048.pem' from sample configs, remove 'dh2048.pem' file
Gert Doering [Wed, 20 Aug 2025 17:54:53 +0000 (19:54 +0200)] 
Remove use of 'dh dh2048.pem' from sample configs, remove 'dh2048.pem' file

Since commit bd9aa06feb41 (Jan 2015) OpenVPN has allowed to use
'--dh none' to disable traditional Diffie Hellman, since more secure
ECDH algorithms are available that do not use explicit DH parameters.

If configured with a suffiently high securelevel (3+), or if running in
FIPS mode, OpenSSL 3.5 will refuse 2048 bit DH files, making our tests
fail.

Thus, remove all the DH2048 stuff from our sample configs.

Github: triggered by OpenVPN/openvpn#819

Change-Id: If66438662bd862a195b2a69c4fa45f63838982b7
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250820175459.11227-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32632.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agodns: fix systemd dns-updown script
Heiko Hund [Mon, 18 Aug 2025 16:46:08 +0000 (18:46 +0200)] 
dns: fix systemd dns-updown script

In the resolvconf part of the script there was one instance of a dynamic
variable using _* left. The _* ones do not work as the regular ones, but
only when you directly place them within ${!}, not indirectly using a
variable.

Convert the code to use a loop and a check, like in all the other places
in the script.

Change-Id: Id800cad0e92e0abc0d96079fdb5a9d57578e1446
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20250818164608.39836-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32621.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
4 weeks agoCollect trivial conversion fixes
Frank Lichtenheld [Sun, 17 Aug 2025 14:39:15 +0000 (16:39 +0200)] 
Collect trivial conversion fixes

These are very local, simple fixes that do not
warrant their own commit.

Change-Id: Id565ec17856444b580dd89edab92e9fe18d39b77
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250817143922.17988-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32611.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agoGHA: limit 'Deploy Doxygen documentation' to main repo only
Ilia Shipitsin [Mon, 11 Aug 2025 16:13:23 +0000 (18:13 +0200)] 
GHA: limit 'Deploy Doxygen documentation' to main repo only

that workflow was accidently triggered in fork repo, where
there's no github pages set

Signed-off-by: Ilia Shipitsin <chipitsine@gmail.com>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20250811161323.1599-1-chipitsine@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32598.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
5 weeks agot_client.sh: Do not wait 3 seconds for OpenVPN to come up
Frank Lichtenheld [Thu, 7 Aug 2025 20:37:35 +0000 (22:37 +0200)] 
t_client.sh: Do not wait 3 seconds for OpenVPN to come up

On most machines 1 second should be quite enough. Given
that we run currently 23 tests on most t_client runs, this
makes over 40 seconds difference. Not nothing.

We keep the existing 30s maximum wait-time since sometimes
we want to do tests with intentionally slow servers.

Change-Id: Ice8c7ff4d8118a9e6465a4724207a355138360b8
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250807203741.31359-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32585.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agobuffer: remove unused function buf_write_alloc_prepend
Frank Lichtenheld [Wed, 6 Aug 2025 14:42:31 +0000 (16:42 +0200)] 
buffer: remove unused function buf_write_alloc_prepend

Change-Id: I71981e39932cafe3fd68b475fdb81a8f20a3a547
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250806144238.11332-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32565.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoRemove uncrustify config and reformat-all.sh
Frank Lichtenheld [Tue, 5 Aug 2025 16:59:00 +0000 (18:59 +0200)] 
Remove uncrustify config and reformat-all.sh

Replaced with clang-format.

Change-Id: I15d4946800cbfaead67a73450ff3b12193814e54
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250805165906.30010-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32543.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoAdd clang-format reformat commit to .git-blame-ignore-revs
Frank Lichtenheld [Tue, 5 Aug 2025 15:04:57 +0000 (17:04 +0200)] 
Add clang-format reformat commit to .git-blame-ignore-revs

Change-Id: I729ee240e107a629ada5fab6b2ed2399e864cbd0
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250805150503.11391-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32528.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoclang-format: Switch to ColumnLimit 0
Frank Lichtenheld [Tue, 5 Aug 2025 13:27:01 +0000 (15:27 +0200)] 
clang-format: Switch to ColumnLimit 0

In some cases an actual ColumnLimit leads to unfortunate
formatting. So leave the decision to developers after all.

This commit contains:
 - changes that clang-format did as reaction to the config
   change
 - manual cleanups of these changes
 - manual cleanup of some previous changes done
   with ColumnLimit 100

Change-Id: Ibd900adfc775b7f785f1d5630184a124f5d8ff4b
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250805132706.27619-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32523.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoFix build error with clang-cl on latest Windows SDK
Frank Lichtenheld [Mon, 4 Aug 2025 19:50:48 +0000 (21:50 +0200)] 
Fix build error with clang-cl on latest Windows SDK

Found when testing windows-2025 runner in GHA.
So switch to that to make sure the error is fixed.

Change-Id: I3046f4b09a4700001a1d9dcce802990dfa701b52
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250804195054.21729-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32513
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoReformat the whole project with clang-format
Frank Lichtenheld [Mon, 4 Aug 2025 15:18:47 +0000 (17:18 +0200)] 
Reformat the whole project with clang-format

Done with pre-commit run -a, so the version
defined in pre-commit config is used.

This also changes the Github workflow so that
there is no commit that fails GHA.

Change-Id: I2566ad493629e1f5fdfa6f6483b8973463404e3e
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250804151853.10565-1-gert@greenie.muc.de>
URL: https://gerrit.openvpn.net/c/openvpn/+/791
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoGHA: enable -Werror for mbedTLS v3 and AWS LC builds
Frank Lichtenheld [Mon, 4 Aug 2025 13:34:07 +0000 (15:34 +0200)] 
GHA: enable -Werror for mbedTLS v3 and AWS LC builds

Because we can and so we should.

Change-Id: I9159e2e354170ad6dbed5a6ce620f57fa8ab128e
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Yuriy Darnobyt <yura.uddr@gmail.com>
Message-Id: <20250804133413.24729-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32505.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoUpdate git-pre-commit-uncrustify.sh to handle clang-format
Frank Lichtenheld [Mon, 4 Aug 2025 09:27:34 +0000 (11:27 +0200)] 
Update git-pre-commit-uncrustify.sh to handle clang-format

Rename it as well, since it is not specific to
uncrustify anymore.

Change-Id: I03195c21807cdef0a2f903f424982ec29a555103
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250804092739.16410-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32497.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoDisable clang-format for some code parts
Frank Lichtenheld [Mon, 4 Aug 2025 09:10:21 +0000 (11:10 +0200)] 
Disable clang-format for some code parts

These do not come out better with clang-format,
so leave them be.

Change-Id: I4dd0c44982955f16ec4a3f167d4e6f3e9b4dbc11
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250804091027.13509-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32492.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoDefine a .clang-format file for the project
Frank Lichtenheld [Sun, 3 Aug 2025 15:01:37 +0000 (17:01 +0200)] 
Define a .clang-format file for the project

Each of these statements has been reviewed but
not all of them are obvious.

Also add a pre-commit config to easily check the
formatting.

Change-Id: I40f6af10c5ee2f5aed4185d783fc622a2e3c19ff
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250803150143.3878-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32484.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoLog setting DNS via NRPT
Lev Stipakov [Sun, 3 Aug 2025 14:49:45 +0000 (16:49 +0200)] 
Log setting DNS via NRPT

Unlike other ways of setting DNS, we don't log anything
when we use NRPT. Since dco-win/--dns is the recommended
configuration and it uses NRPT to set DNS, let's log it.

Change-Id: Ib2f30fe69cb676e347e4d59cd2db68db7568ba5b
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250803144950.21034-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32480.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoUpdate GPL header in all source files to current recommended version
Frank Lichtenheld [Sun, 3 Aug 2025 14:51:20 +0000 (16:51 +0200)] 
Update GPL header in all source files to current recommended version

This removes the postal address of the FSF and replaces
it with their URL.

Mostly generated with
sed -i -e 's@if not, write to the Free Software Foundation, Inc.,\
            @if not, see <https://www.gnu.org/licenses/>.@'
sed -i -e '/51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA/d'
sed -i -e '/59 Temple Place, Suite 330, Boston, MA  02111-1307  USA/d'

With some manual fix-ups afterwards.

Change-Id: Ic3959970fa9ab993e98d4b38c025fd0efc7b92f2
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250803145126.23494-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32481.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoUpdate text of GPL to latest version from FSF
Frank Lichtenheld [Sun, 3 Aug 2025 14:39:33 +0000 (16:39 +0200)] 
Update text of GPL to latest version from FSF

This mostly removes the postal address of the FSF.

This was triggered by rpmlint complaining about
that address being outdated.

Change-Id: Idfe5c615d1109a1038207c1c1b0e0de4da3279f5
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250803143939.15335-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32475.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoOpenVPN Release 2.7_alpha3 v2.7_alpha3
Gert Doering [Thu, 31 Jul 2025 06:51:26 +0000 (08:51 +0200)] 
OpenVPN Release 2.7_alpha3

version.m4, ChangeLog, Changes.rst

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

New features alpha2 -> alpha3 are
  - --dns-updown script for macOS
  - client-side support for PUSH_UPDATE handling
  - support for floating TLS clients when DCO is active
    (handling float notifications sent from kernel to userland)
  - use of user-defined routing tables on Linux
  - PQE support for WolfSSL

Besides new features, alpha3 sees a rewrite of the way kernel events
are handled by the linux DCO module, because under certain circumstances
notifications could get lost, leading to problems later.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoFix wrong byte order of --dns server
Lev Stipakov [Thu, 31 Jul 2025 15:29:06 +0000 (17:29 +0200)] 
Fix wrong byte order of --dns server

We already fixed it in commit 82fd89a04f, but
the fix got lost in 2dfc4f8.

tuntap_options require host byte order, and we store
dns servers in struct dns_server in network byte order,
what we got from getaddrinfo().

Fix (again) by converting to the host byte order.

Change-Id: I37ca672f05e9d77ec586fa28dadc6dc752e574fb
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250731152912.21826-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32460.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoFix DNS options duplication on PUSH_UPDATE
Lev Stipakov [Thu, 31 Jul 2025 12:24:05 +0000 (14:24 +0200)] 
Fix DNS options duplication on PUSH_UPDATE

Commit

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

has removed reset of tuntap DNS options. Due to that, incoming --dns
options are added to existing ones instead of overwriting them.

It has also added a new storage for --dhcp-option. The push-update
code didn't clear it and as a result, incoming --dhcp-option options
were added to existing ones instead of overwriting them.

Fixed by:

 - resetting tuntap DNS options (regression from abovementioned commit)
 - clearing dhcp options storage in push-update code

GitHub: fixes OpenVPN/openvpn#804

Change-Id: Ife4d8fc5f8e2183e61226d66a76bbaa02c06f787
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Heiko Hund <heiko@openvpn.net>
Message-Id: <20250731122410.12200-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32448.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoUpdate systemd service name param to match command
Terrance [Tue, 29 Jul 2025 18:00:05 +0000 (19:00 +0100)] 
Update systemd service name param to match command

The service name displays `%I` which invokes systemd's path mangling
(notably, converting `-` to `/`), suggesting you need to provide an
encoded parameter (via e.g. `systemd-escape`), but the start command
itself uses `%i` which doesn't do the conversion.

This updates the service name to match the start command.

Signed-off-by: Terrance <git@terrance.allofti.me>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20250729180014.11550-2-sourceforge@terrance.allofti.me>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32423.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
6 weeks agoFix --dns options for TAP adapter
Lev Stipakov [Thu, 31 Jul 2025 10:48:27 +0000 (12:48 +0200)] 
Fix --dns options for TAP adapter

Commit

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

has accidentally removed setting of the DHCP_OPTIONS_DHCP_OPTIONAL
flag when copying --dns options. This flag is required to apply options
via DHCP string, which we do for TAP adapter. As a result, --dns options
stopped working for TAP.

Fix by setting this flag when copying --dns options to tuntap_options.

Change-Id: Id95cd14095a03afb3140a03ae96e9f5679e4fe89
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250731104833.23305-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32436.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoFix broken DHCP options
Lev Stipakov [Wed, 30 Jul 2025 18:04:26 +0000 (20:04 +0200)] 
Fix broken DHCP options

Commit

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

broke support for --dhcp-options. It removed the setting of the
DHCP_OPTIONS_DHCP_OPTIONAL flag for some DHCP options. This flag is
required for those options to be applied correctly, as it is used
when building the DHCP options string that is passed to the TAP driver.

This commit fixes the issue by restoring the setting of this flag.

GitHub: fixes OpenVPN/openvpn#791

Change-Id: I0d75efcceb826d06e74abd003d5377468ff9fe3b
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250730180527.25339-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32427.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agodco-freebsd: pass address scope to the kernel
Kristof Provost [Tue, 29 Jul 2025 09:38:57 +0000 (11:38 +0200)] 
dco-freebsd: pass address scope to the kernel

To support link-local (IPv6) addresses we must pass the scope to the kernel as
well. We should also extract it from the kernel notification for float events.

Signed-off-by: Kristof Provost <kprovost@netgate.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250729093857.37832-1-kprovost@netgate.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32401.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoPUSH_UPDATE: Added update_option() function.
Marco Baffo [Tue, 29 Jul 2025 10:41:01 +0000 (12:41 +0200)] 
PUSH_UPDATE: Added update_option() function.

When the function receives an option to update, it first checks whether it has
already received an option of the same type within the same update message.
If it has already received it, it simply calls add_option(), otherwise it
deletes all the values already present for that option first.

Change-Id: Ia45c99e6df7b3ad24020c10b8a9b3577984ecdc2
Signed-off-by: Marco Baffo <marco@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250729104110.27704-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32408.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoPUSH_UPDATE: Added remove_option() and do_update().
Marco Baffo [Tue, 29 Jul 2025 10:40:50 +0000 (12:40 +0200)] 
PUSH_UPDATE: Added remove_option() and do_update().

* Added remove_option() function and some utility functions to remove options at
  runtime following the push-update logic.
* Added do_update() function to close and reopen the tun and apply option updates.

Change-Id: I507180d7397b6959844a30908010132bc3411067
Signed-off-by: Marco Baffo <marco@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250729104056.27634-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32407.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoPUSH_UPDATE: Allow OpenVPN in client mode to receive and handle PUSH UPDATE control...
Marco Baffo [Tue, 29 Jul 2025 10:40:39 +0000 (12:40 +0200)] 
PUSH_UPDATE: Allow OpenVPN in client mode to receive and handle PUSH UPDATE control messages to allow options updating at runtime.

* Added IV_PROTO_PUSH_UPDATE flag bit to support push-updates.
* Added process_incoming_push_update(), in a separate file to create tests more easily.
* Modified incoming_push_message(), process_incoming_push_msg(), apply_push_options(),
  apply_pull_filter() to process also push-update messages.
* Added the check_push_update_option_flags() function used in apply_pull_filter() to
  check options formatting inside push-update messages, if the options are updatables
  and to check for '?' and '-' flags that may be present in front of the options.
  The '-' flag is used to indicate that the option in question should be removed,
  while the '?' indicates that the option is optional and to do not generate
  errors if the client cannot update that option.
  For more info you can read the RFC at https://github.com/OpenVPN/openvpn-rfc .
* Created some unit tests for the push-update message handling in test_push_update_msg.c.

Change-Id: I6ecd4cb47571cc8c20e46de8595c742aeec6064a
Signed-off-by: Marco Baffo <marco@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250729104045.27582-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32406.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agodco-freebsd: always enable float notification support
Kristof Provost [Tue, 29 Jul 2025 09:39:07 +0000 (11:39 +0200)] 
dco-freebsd: always enable float notification support

If the kernel doesn't support it we'll simply never get the notification. In
other words, there's no downside to always enabling this, so let's do that.

Signed-off-by: Kristof Provost <kprovost@netgate.com>
Message-Id: <20250729093907.37849-1-kprovost@netgate.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32402.html
Acked-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agooptions: Simplify function setenv_foreign_option
Frank Lichtenheld [Mon, 28 Jul 2025 12:56:41 +0000 (14:56 +0200)] 
options: Simplify function setenv_foreign_option

This was relatively complex for the actual usage.
Looked at the code because of -Wconversion warnings
related to the len argument. So this should also be
gone.

Change-Id: I7efc77f63734501dfa8a8f5bed17b1a1b4e9e201
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250728125647.26992-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32396.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agounit_tests/plugins/auth-pam: fix stdint.h related build error on fedora 42
Gert Doering [Mon, 28 Jul 2025 10:42:29 +0000 (12:42 +0200)] 
unit_tests/plugins/auth-pam: fix stdint.h related build error on fedora 42

add <stdint.h> to test_search_and_replace.c to fix build error on
fedora 42 / arm64 ("error: uintptr_t undeclared")

Change-Id: I2ab13767b5aa858e024b45be3d161bf6090de763
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20250728104234.29797-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32384.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agomudp.c, multi.c, multi_io.c: get rid of 'all three DCO platforms' #ifdefs
Gert Doering [Mon, 28 Jul 2025 08:42:49 +0000 (10:42 +0200)] 
mudp.c, multi.c, multi_io.c: get rid of 'all three DCO platforms' #ifdefs

With commit b66b80b2a all three platforms with DCO support have DCO float
notifications now, so the #ifdef inside multi_process_incoming_dco() is
no longer needed.

Also, the whole notification block (process_incoming_del_peer() and
multi_process_incoming_dco()) was surrounded by an

  #ifdef ENABLE_DCO "and all 3 platforms"

which is also not making sense anymore (if we add a fourth DCO platform,
we need to aim for having "all notifications from day 1", at least having
the stubs and defines).

Last not least, the event stuff in mudp.c and multi_io.c had grown the
same construct - and we'll need events for any future DCO platform, too.

So, fix those #ifdef as well, while at it.

Change-Id: I6977d23b5289eba5db436608e0500216e0e689ec
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Antonio Quartulli <antonio@mandelbit.com>
Message-Id: <20250728084255.1824-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32377.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agodco: support float notifications on FreeBSD
Kristof Provost [Wed, 23 Jul 2025 08:36:49 +0000 (10:36 +0200)] 
dco: support float notifications on FreeBSD

Signed-off-by: Kristof Provost <kprovost@netgate.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250723083816.71604-2-kprovost@netgate.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32282.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agodco_linux: clean up PEER_GET trigger and parser
Antonio Quartulli [Sun, 27 Jul 2025 10:22:40 +0000 (12:22 +0200)] 
dco_linux: clean up PEER_GET trigger and parser

This patch is intended to reduce code duplication and
cleanup the DCO code around the PEER_GET command.

Specifically it:
* unified PEER_GET reply parser for `multi` and
  `non-multi` case
* unified PEER_GET request trigger for `multi` and
  `non-multi` case
* dropped struct multi_context from the argument list of
  dco_get_peer_stats_multi()

Github: closes OpenVPN/openvpn#800
Change-Id: Icbc70225d53ca678b8c22ed437b424c16e199d66
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250727102245.24931-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32361.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agomulti: make some multi_*() functions static
Antonio Quartulli [Sat, 26 Jul 2025 13:51:56 +0000 (15:51 +0200)] 
multi: make some multi_*() functions static

multi_process_float() and multi_print_status() are both invoked only
within multi.c, which is where they is defined.

For this reason we can make them static and drop their declaration
from multi.h.

Change-Id: Id5e06f0822a3e7e4ad1b6f93caaefdb6a8cfe547
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250726135203.3452-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32356.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoadd flag to print addresses in a consistent format during float
Ralf Lici [Fri, 25 Jul 2025 19:41:39 +0000 (21:41 +0200)] 
add flag to print addresses in a consistent format during float

Introduce the MAPF_SHOW_FAMILY flag to prepend the address family to the
address when printing an mroute_addr object, similar to
print_sockaddr_ex(). This ensures that when logging a float operation,
both the old and new addresses are printed in the same format:
$proto:[$family]$address:$port.

Note: when using this flag with an IPv4-mapped IPv6 address, the output
will appear as: [AF_INET6]a.b.c.d

Change-Id: I43cd3d564d8c6ad4e41de5a38130d90cb6778395
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250725194147.17517-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32345.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agodco_linux: fix async message reception
Antonio Quartulli [Fri, 25 Jul 2025 17:27:02 +0000 (19:27 +0200)] 
dco_linux: fix async message reception

Currently whenever we send a PEER_GET request to ovpn, we also
set the CB that is supposed to parse the reply.

However, due to the async nature of netlink messages, we could
get an unrelated notification, sent by ovpn (kernel) upon some event,
after userland has set the CB, but before parsing the awaited reply.

When this happens, the notification is then parsed with the
configured CB instead of the notification parser, thus effectively
rejecting the notification and losing the event.

To fix this inconsistency, make ovpn_handle_msg() the default and
only netlink parser CB. It is configured upon DCO initialization
and is never removed.

ovpn_handle_msg() will check the message type and will call the
corresponding handler. This way, no matter what message we get at
what time, we'll always parse it correctly.

As a bonus we can also simplify the nl_sendmsg() API as we
don't need to pass the cb and its argument anymore.

The ID of the NLCTRL family is now also stored in the DCO
context as we need it to check when we receive a mcast ID
lookup message.

Change-Id: I23ad79e14844aefde9ece34dadef0b75ff267201
Github: closes OpenVPN/openvpn#793
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250725172708.19456-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32339.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
7 weeks agoplugins: Clean up -Wconversion warnings
Frank Lichtenheld [Fri, 25 Jul 2025 12:44:09 +0000 (14:44 +0200)] 
plugins: Clean up -Wconversion warnings

Most of the are actually the same ones copied to every
single plugin.

Some drive-by fixes of other warnings and some
conversion cleanups that had no warnings because
they were suppressed by casts.

Change-Id: Id61df43bd79fc794a55e107daa0218c8441c2b2c
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250725124415.20645-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32330.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
8 weeks agodco_linux: factor out netlink notification code
Antonio Quartulli [Wed, 23 Jul 2025 15:32:19 +0000 (17:32 +0200)] 
dco_linux: factor out netlink notification code

ovpn_handle_msg() is soon becoming the main entry point for parsing
*all* incoming netlink messages. For this reason it is essential
that this function is kept simple and slim.

Move all code parsing netlink multicast notifications to their own
helpers and then invoke them.

This patch does not introduce any functional change.
It is intended in preparation for extending ovpn_handle_msg() to
become a genering netlink message parser.

Change-Id: I7bbc40b7b66f6e0512cd2cf9791766bcc4970461
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250723153224.13708-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32298.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
8 weeks agodco: only pass struct context to init function
Antonio Quartulli [Wed, 23 Jul 2025 13:39:11 +0000 (15:39 +0200)] 
dco: only pass struct context to init function

Future DCO code will require accessing the `multi` member of the
context object.

For this reason a pointer to the context has to be stored in the
DCO context along with the rest.

At this point, rather than making the call to ovpn_dco_init()
longer with more and more parameters, pass the struct context
only and let the implementation extract the needed fields.

Change-Id: I673a17f8c5dec66cc6c28c1ed44780a7a63927d7
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250723133918.19431-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32293.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
8 weeks agomulti: store multi_context address inside top instance
Antonio Quartulli [Wed, 23 Jul 2025 06:10:25 +0000 (08:10 +0200)] 
multi: store multi_context address inside top instance

Future modifications to DCO require accessing the
server multi_context object.

Since it is currently a stack variable that is pointed
by no one, we'd need to pass it to all kind of functions
to ensure it can reach the DCO code.

To make the implementation simpler, it is preferable to
simply assign its address to a struct context's field.

While at it, make some multi_* functions static as they
used only inside multi.c, where they are defined.

Change-Id: Ibf64c681e02ac572d339d4d98e75ceb0cd417c45
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250723061034.20240-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32266.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
8 weeks agodco_linux: rearrange functions
Antonio Quartulli [Wed, 23 Jul 2025 06:07:41 +0000 (08:07 +0200)] 
dco_linux: rearrange functions

In preparation for the implementation of a generic netlink
message parser, move all parsing functions above ovpn_handle_msg().

The latter is soon going to become a generic message parser which
will invoke specific handlers, thus they are required to be defined
earlier in the file.

No functional change is intended.

This patch is only meant to reduce entropy in the patch which will do
the real netlink parser change.

Better reviewed with: git show --color-moved

Change-Id: I94004579aef4a1ccccdbcf8edd7b722e5a611c72
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250723060747.19524-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32263.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
8 weeks agodco_linux: use M_FATAL instead of M_ERR in netlink error code paths
Antonio Quartulli [Wed, 23 Jul 2025 06:30:30 +0000 (08:30 +0200)] 
dco_linux: use M_FATAL instead of M_ERR in netlink error code paths

Netlink code doesn't set errno upon error (with the exception of
any *alloc() function which probably inherits the errno=ENOMEM
from the underlying malloc call), therefore we should not print
error messages with M_ERR, but rather rely on M_FATAL.

M_ERR is equivalent to M_FATAL with the addition of appending
": $errno" to the error string.

Since errno is not meaningful in this context, we can just opt
for the less confusing M_FATAL.

Change-Id: Ifc442b4426c02de7282d0f69629e8a10b679c589
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250723063039.25449-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32271.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
8 weeks agodco_linux: fix case statement by using proper error value
Antonio Quartulli [Wed, 23 Jul 2025 06:20:06 +0000 (08:20 +0200)] 
dco_linux: fix case statement by using proper error value

A M_ERR constant accidentally slipped in as possible
netlink error value.

Substitute it with the actual code matching the following
error message.

Change-Id: I18df6ef659cab9525dd7847b7dd3950fc1895dd5
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250723062012.22781-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32269.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
8 weeks agoGHA: Dependency updates July 2025
Frank Lichtenheld [Tue, 22 Jul 2025 10:27:18 +0000 (12:27 +0200)] 
GHA: Dependency updates July 2025

chore(deps): update dependency aws/aws-lc to v1.55.0
chore(deps): update lukka/get-cmake action to v4.0.3
chore(deps): update vcpkg digest to f33cc49
chore(deps): update dependency mbed-tls/mbedtls to v3.6.4

Change-Id: I6122225cc12c4f299a2a48db24bc7379ac6c5921
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Yuriy Darnobyt <yura.uddr@gmail.com>
Message-Id: <20250722102718.85403-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32242.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agoimprove float collision logging
Ralf Lici [Fri, 18 Jul 2025 19:16:56 +0000 (21:16 +0200)] 
improve float collision logging

Extend the log message printed when an instance floats to an address
already taken by another instance with the same certificate. The updated
message now includes the instance being closed, the reason it's being
closed, and the new instance taking over that address.

Change-Id: I217cfb319b85fd75a88f7d4d50c374d28771df28
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250718191702.9451-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32226.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agoMulti-socket: Fix assert triggered by stale peer-id reuse
Gianmarco De Gregori [Fri, 18 Jul 2025 18:55:53 +0000 (20:55 +0200)] 
Multi-socket: Fix assert triggered by stale peer-id reuse

Fixed a bug where clients using different transport
protocols (UDP, TCP) could interfere with each other
after a server restart.
The issue occurred when a client reused a previously
assigned peer-id that was now associated with a
different client using a different transport protocol.

For example, a UDP client could send packets with a
peer-id now assigned to a TCP client, which lacks
a valid context->c2.from which is filled by the
recvfrom(), causing an assert to be triggered.

A protocol check has been added to prevent packets
from different protocols from hijacking active
connections.

Github: OpenVPN/openvpn#773

Change-Id: Iecbbcf32c0059f2b16a05333b3794599060d7d6a
Signed-off-by: Gianmarco De Gregori <gianmarco@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250718185559.4515-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32220.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agodco: Add support for float notifications
Ralf Lici [Fri, 18 Jul 2025 12:22:24 +0000 (14:22 +0200)] 
dco: Add support for float notifications

When a peer changes its UDP endpoint, the DCO module emits a
notification to userpace. The message is parsed and the relevant
information are extracted in order to process the floating operation.

Note that we preserve IPv4-mapped IPv6 addresses in userspace when
receiving a pure IPv4 address from the module, otherwise openvpn
wouldn't be able to retrieve the multi_instance using the transport
address hash table lookup.

It may happen that a netlink notification gets lost, causing us to skip
a float step. If the peer then floats back to its previous address,
userspace closes the only valid instance while trying to process the
float, leading to a segfault. To prevent this, we ignore float attempts
to an address already taken by a peer with the same peer ID.

Change-Id: I33e9272b4196c7634db2fb33a75ae4261660867f
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Antonio Quartulli <antonio@mandelbit.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20250718122230.14008-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32210.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agot_server_null: match test numbers with server numbers
Samuli Seppänen [Wed, 16 Jul 2025 16:56:49 +0000 (18:56 +0200)] 
t_server_null: match test numbers with server numbers

This makes it obvious which server each test connects to

Change-Id: I49c69144ab6dcf1d26c96c2eafc2346ad4e0ca75
Signed-off-by: Samuli Seppänen <sasepp@pm.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250716165656.18887-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32194.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agoconfigure.ac: Remove use of PKCS11_HELPER_LIBS in mbedTLS checks
Frank Lichtenheld [Wed, 16 Jul 2025 15:18:57 +0000 (17:18 +0200)] 
configure.ac: Remove use of PKCS11_HELPER_LIBS in mbedTLS checks

This code was copied over and over since many years,
since commit 9a3f670248d6f519a399e65a7232e2196b5115db
("Fixed autoconf script to properly detect missing pkcs11
with polarssl"). It is unclear what exact purpose it
served back then but probably it is obsolete. It is
definitely wrong since it means that you get
PKCS11_HELPER_LIBS even if you do not specify
--enable-pkcs11.

Change-Id: I317be5253d6563906dd3826421dc81f737beba76
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Message-Id: <20250716151857.385959-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32187.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agoREADME.dco: update Linux instructions
Antonio Quartulli [Wed, 16 Jul 2025 13:54:25 +0000 (15:54 +0200)] 
README.dco: update Linux instructions

Update the README.dco file by including instructions related
to the new 'ovpn' linux kernel module.

Change-Id: I22af9957b27785514d8c6d58fe4f2100d007fa5c
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20250716135430.23484-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32180.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agoreliable: Review and fix gc_arena usage
Frank Lichtenheld [Tue, 15 Jul 2025 14:37:44 +0000 (16:37 +0200)] 
reliable: Review and fix gc_arena usage

Check for unused objects (in
reliable_get_num_output_sequenced_available)
and missing free (in reliable_can_get).

While looking through the code, modernize
the loop variable usage.

Change-Id: I8cefa9a406fe90bb3cbe481304782c639691a3a0
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Message-Id: <20250715143750.9719-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32157.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agomac dns: do not run dns-updown in parallel
Heiko Hund [Fri, 11 Jul 2025 10:07:00 +0000 (12:07 +0200)] 
mac dns: do not run dns-updown in parallel

In case more than one openvpn connection is coming up or going down at
the same time, there is potential for breakage, since the operations
performed are not atomic.

Introduce a locking mechanism, which let's scripts run in sequence, to
prevent races between them.

Change-Id: I7adfaa08df6a17545cca8264d7230b5e65e49719
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Message-Id: <20250711100700.241668-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32108.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agomac dns: compare servers before restoring backup
Heiko Hund [Fri, 11 Jul 2025 15:23:09 +0000 (17:23 +0200)] 
mac dns: compare servers before restoring backup

In case anything changed the global DNS server addresses, while the
tunnel was connected, do not restore the backup of the global DNS
configuration we made when connecting. Doing so would likely change
DNS to something unexpected. Instead just clear the backup and leave
a message in the log.

Change-Id: I1aabd62e60dd18408a57baccbb0f4ebd6d2f8d67
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20250711152309.286177-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32110.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agoCleanup/simplify mbed TLS related define from autoconf
Arne Schwabe [Tue, 15 Jul 2025 12:29:49 +0000 (14:29 +0200)] 
Cleanup/simplify mbed TLS related define from autoconf

Instead of a custom logic using 0/1 to be defined when the functions
are present or not, use the standard check and adjust the source code
accordingly.

Also not compile mbed key helper with MBEDTLS_SSL_KEYING_MATERIAL_EXPORT

The helper methods are only used when we don't have
MBEDTLS_SSL_KEYING_MATERIAL_EXPORT and mbedtls_ssl_export_keying_material.

Remove AEAD check that tests for presence of mbedtls_cipher_write_tag
and mbedtls_cipher_check_tag. Having an mbed TLS version that does not
support that is highly unlikely. It might have been a good check in
PolarSSL's time but is not today anymore.

This also adds some missing support for mbed 2.x related defines to
cmake based build.

Change-Id: I0f325800ebeb20bd5ef3ff78e5c5fcf0f6f74efd
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20250715122957.22311-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32145.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agomove macOS dns-updown common code into functions
Heiko Hund [Fri, 11 Jul 2025 10:08:53 +0000 (12:08 +0200)] 
move macOS dns-updown common code into functions

Change-Id: Id6f70237c7205063b001528a40391678b0d093ac
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20250711100853.242102-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32105.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agoprevent search domain races with macOS dns-updown
Heiko Hund [Mon, 14 Jul 2025 16:08:21 +0000 (18:08 +0200)] 
prevent search domain races with macOS dns-updown

When connections go up and down there are situations where search
domains of a split DNS connection are either lost, or survive the
lifetime of the connction. This can happen when there is also a
connection that modifies the global DNS setting. When it backs-up the
global settings before modifying them, or when it restores the backup,
the search domains could contain or miss VPN domains from other
connections, leading to misconfiguration.

The fix is to also update the backed-up search domains when a split DNS
connection comes up or goes down. That way the backup is always up to
date and restoring it will keep the global search domains as expected.

Change-Id: Ide2cddad193c636eb440c9752751176dae0a6897
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Message-Id: <20250714160903.7479-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32127.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agoFix compiler warning in reliable.c with --disable-debug
Frank Lichtenheld [Fri, 11 Jul 2025 10:04:05 +0000 (12:04 +0200)] 
Fix compiler warning in reliable.c with --disable-debug

Use the easy way out. Using pre-compiler to completely
avoid n_active seems like overkill.

Change-Id: Icad1a52d14311a6f06bda081cab2f4bded8d47ed
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Message-Id: <20250711100405.240625-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32107.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2 months agodns: do not run updown scripts with lwipovpn
Heiko Hund [Tue, 8 Jul 2025 18:52:04 +0000 (20:52 +0200)] 
dns: do not run updown scripts with lwipovpn

Running the script doesn't make sense with the AFUNIX dev node, so we
simply clear any scripts that have been set before.

Change-Id: I7e9a0c668e0950257632452cfd9eeb236f0120f2
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Message-Id: <20250708185210.30421-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32069.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>