Repository navigation
Conversation
lstipakov
force-pushed
the
oob-server-probe
branch
7 times, most recently
from
June 22, 2026 11:40
d601eda to
01fe78c
Compare
struct dns_options embeds its own gc_arena. When inherit_context_child() /inherit_context_top() copy struct options by value, the child shares the parent's DNS arena. options_detach() detached o->gc but not o->dns_options.gc, so pre_connect_restore()'s gc_free() (and context teardown) freed allocations the parent still referenced. With one or more non-pushed --dhcp-option directives that yield a DNS entry, a connecting client triggers this and the server crashes (use-after-free in setenv_dns_options(), reported as a double free). Detach o->dns_options.gc as well, mirroring the existing o->gc handling. Change-Id: I49b37b5a90554fa2d4a83c8fc5608dad2a36b835 GitHub: closes OpenVPN#1060 Signed-off-by: Antonio Quartulli <[email protected]> Acked-by: Arne Schwabe <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1715 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg37230.html Signed-off-by: Gert Doering <[email protected]>
lstipakov
force-pushed
the
oob-server-probe
branch
5 times, most recently
from
June 25, 2026 08:19
7ede628 to
5a98609
Compare
This avoids having get_ranomd being different on 32bit/Windows vs 64 bit Unix platform. Also adjust platform_create_temp_file to create the same files on all platforms. Change-Id: Ifefb3ad204c0c16cb4952dd6e8661fdc9136b125 Signed-off-by: Arne Schwabe <[email protected]> Acked-by: Gert Doering <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1732 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg37322.html Signed-off-by: Gert Doering <[email protected]>
The multi_get_create_instance_udp is quite large. This factors out the one branch that handles and creates new connection attempts. Change-Id: I6a032465e66b49ab0ce8b1a84ead8d9acef918de Signed-off-by: Arne Schwabe <[email protected]> Acked-by: Frank Lichtenheld <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1720 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg37336.html Signed-off-by: Gert Doering <[email protected]>
Change-Id: I355760e43c3e2da0dda0cdec6e4253c028cefe38 Signed-off-by: Arne Schwabe <[email protected]> Acked-by: Frank Lichtenheld <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1604 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg37342.html Signed-off-by: Gert Doering <[email protected]>
This also move the gc area acquire release to the small parts where they are actually used. Change-Id: I401aab94993b62bf18e66561532085f99e62f745 Signed-off-by: Arne Schwabe <[email protected]> Acked-by: Frank Lichtenheld <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1721 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg37341.html Signed-off-by: Gert Doering <[email protected]>
32 bit architectures are playing a very small role today, so the difference between 64 bit and 32 bit hash values is not expected to be large anymore. This is also in preparation to replace our hash function with a more modern replacement. Change-Id: Ib8140107f98164d2a2e1768a6d8ac65016cd7f7c Signed-off-by: Arne Schwabe <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1570 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg37349.html Signed-off-by: Gert Doering <[email protected]>
Since there were issues with in-place modification of the buffer repeatedly, re-implement ConvertItfDnsDomains() to use a internal temporary buffer to prevent use of memmove and the length calculations that come with it. Code should be easier to grasp since we're dealing with one set of lengths (WCHARs) instead of two (WCHARs + octets) now. The unit tests did not actually test the MULTI_SZs correctly, fixed that and also added some more tests to cover more scenarios. This was initially reported as a security vulnerability, as the previous code could be tricked into overreading a buffer and accessing undefined memory - but we decided against assigning a CVE ID because the data read is subsequently never leaked anywhere, and it was not possible to trigger a crash, so "just a bug, no security implications". Reported-By: 章鱼哥 (@aipy) (www.aipyaipy.com) Github: OpenVPN/openvpn-private-issues#122 Github: OpenVPN/openvpn-private-issues#126 Change-Id: I8c67633ed3d82a6dc50fbd8fa1af2c50fc45d938 Signed-off-by: Heiko Hund <[email protected]> Acked-by: Lev Stipakov <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1730 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg37337.html Signed-off-by: Gert Doering <[email protected]>
lstipakov
force-pushed
the
oob-server-probe
branch
from
June 29, 2026 11:49
5a98609 to
532244a
Compare
plugin_in_trusted_dir() validated the plugin path against the trusted
plugin/install directory (and the system directory fallback) using a raw
string prefix match via wcsnicmp(). When the trusted directory path does
not end in a separator (e.g. the plugin_dir registry value is set to
"C:\openvpn_plugins"), a sibling directory sharing the same prefix
("C:\openvpn_plugins_evil") also passes the check, allowing a plugin to
be loaded from outside the allow-listed directory.
Introduce win_path_in_dir() in win32-util.c which performs the prefix
match but additionally requires the match to end on a path-component
boundary, and use it for both the plugin/install directory and the
system directory checks. Add unit tests in test_misc.c.
Change-Id: Ib7f9c9ce5ed778190445cc4cfaa8f3cd5d1110bc
Reported-By: 章鱼哥 (@aipy) (www.aipyaipy.com)
Github: OpenVPN/openvpn-private-issues#120
Reported-by: <[email protected]>
Github: OpenVPN/openvpn-private-issues#109
Signed-off-by: Lev Stipakov <[email protected]>
Acked-by: Arne Schwabe <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1736
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg37382.html
Signed-off-by: Gert Doering <[email protected]>
The option resolves configured remote, local, and proxy hostnames at startup and reuses those resolved addresses on reconnects. Document it in the usage text and client options man page, including the reconnect trade-off for configurations that rely on changing DNS answers. GitHub: fixes OpenVPN#532 Acked-by: Arne Schwabe <[email protected]> Message-Id: <_5bQ5LvkEmn_vaE7Ng8xPAcHJFWfy7td0Yvim0iLc3YVoer2RM1-PoBKAGPzHZKx1rsZP7Ht7kM_2eIUSidNkMW34yS7eT549_fSvcb-dl0=@pm.me> URL: https://www.mail-archive.com/[email protected]/msg37387.html Signed-off-by: Gert Doering <[email protected]>
The --float option lets OpenVPN accept authenticated packets from a changed peer address. That only applies to UDP transports. Document the transport limitation in the man page. Github: fixes OpenVPN#358 Acked-by: Gert Doering <[email protected]> Message-Id: <SXGKysQ5xx6qb0pPY8pAk_wO-B0Pl44xmifYB_bBdqIXMtGir8GTPKxhB2kivfBvPO2uU9bBnxbJVTTy2IDBqXlumDVRYOLOE-qEZfea5TQ=@pm.me> URL: https://www.mail-archive.com/[email protected]/msg37401.html Signed-off-by: Gert Doering <[email protected]>
lstipakov
force-pushed
the
oob-server-probe
branch
3 times, most recently
from
June 30, 2026 11:27
6b924ed to
00813ff
Compare
The debug log in dco_install_key() has the epoch and dco_keys_installed arguments swapped. So a line like epoch=1, currently 0 keys installed actually means dco_keys_installed == 1 and epoch == false. Use the correct argument ordering in the log string. Change-Id: Id8945dce437da11e6fecae9550c3be52e393d4cf Signed-off-by: Ralf Lici <[email protected]> Acked-by: Gert Doering <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1760 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg37418.html Signed-off-by: Gert Doering <[email protected]>
This makes the metadata a local variable instead of a member of the wrap_context struct. Also always ensure that this buffer is freed to avoid any leak of the metadata buffer. This touches the check methods. Ensure that they still work as intended by adding unit tests for both script and age checks. CVE: 2026-12932 Github: OpenVPN/openvpn-private-issues#133 Github: OpenVPN/openvpn-private-issues#136 Reported-By: Valton Tahiri <[email protected]> Acked-by: MaxF <[email protected]> Change-Id: I9b8b8afcc5d4d5914b2008c0efccb309f0d07d4b
This also improves is_auth_token to check for the correct length and adds a few unit tests. This fixes an assertion when a user would send auth token with the right prefix but overall too short length. Reported-By: Haiyang Huang <[email protected]> CVE: 2026-13122 Github: OpenVPN/openvpn-private-issues#118 Github: OpenVPN/openvpn-private-issues#128 Change-Id: I053cca5f42e3841cef8934c2114a8a159fbc0c29 Acked-by: MaxF <[email protected]>
When dynamic tls-crypt is active, it is possible for tls_multi_process to set to_link to session->tls_wrap_reneg.work and later free that session, leaving to_link.data pointing to freed memory. This is not caught by the function check_session_buf_not_used because it checks only tls_wrap, not tls_wrap_reneg. This commit adds that check. CVE: 2026-13117 Github: OpenVPN/openvpn-private-issues#119 Github: OpenVPN/openvpn-private-issues#125 Reported-By: Trace37 Labs (https://github.com/trace37labs) Github: OpenVPN/openvpn-private-issues#131 Reported-By: Haiyang Huang <[email protected]> Signed-off-by: Max Fillinger <[email protected]> Acked-By: Arne Schwabe <[email protected]>
Currently you can use BPTR and similar to implicitly remove const. That avoids some warnings that we should get and confuses tools like cppcheck into giving wrong suggestions. So make sure that by default we only return a non-const pointer if the buffer pointer is not const. Change all call sites that threw warnings. Change-Id: Ib4af7639cdebe81eba05ab04efe6e85e63de0f9e Signed-off-by: Frank Lichtenheld <[email protected]> Acked-by: Razvan Cojocaru <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1904 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg39108.html Signed-off-by: Gert Doering <[email protected]>
Updated to a newer version of cppcheck (2.21.0) and it reported a new group of issues where function parameters shadow global variables or function names. Used a variety of different solutions depending on context, either renaming the global variables or the function parameters. In one case I removed the parameter since it only contained the global variable anyway. Where applicable I have combined the change with fixing occurrences of constParameterPointer to reduce conflicts between different cppcheck fix commits. Change-Id: I0ac934da5eeed0424b54ed9b528a2bf2b561ffdf Signed-off-by: Frank Lichtenheld <[email protected]> Acked-by: Razvan Cojocaru <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1912 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg39107.html Signed-off-by: Gert Doering <[email protected]>
create_socket() creates the UDP socket and then applies the link socket's options and local bind in place. Pull that sequence into create_socket_udp_configured(), taking the address family and the option values rather than a struct link_socket, and have create_socket() call it; the TCP path keeps its own sequence through the shared socket_apply_options(). --server-probe will open its probe sockets through the same function, so a probe socket is set up and bound exactly like the connection socket it may later become. Its "optional" argument lets that caller treat a socket the host cannot create as "do not probe this address family" instead of dying; the connection path passes false and keeps the fatal error. No behaviour change for existing callers. Change-Id: I8f2bd694146aacd244a1d385ddfe9bb84ec29334 Signed-off-by: Lev Stipakov <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1910 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg39126.html Signed-off-by: Gert Doering <[email protected]>
The values assigned by these are never actually used for something. Identified by cppcheck. Change-Id: Id0caa497c4ff1ad8743cb23f332f003b2d3393ed Signed-off-by: Frank Lichtenheld <[email protected]> Acked-by: Razvan Cojocaru <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1617 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg39142.html Signed-off-by: Gert Doering <[email protected]>
remove_option() and update_option() clear the domain search list with
while (o->domain_search_list_len-- > 0)
domain_search_list_len is unsigned, and the post-decrement runs on the
final test too. When the length reaches 0 the condition is false but
the decrement has already wrapped it to UINT_MAX, so the field is left
corrupted. The next reset then does
o->domain_search_list[UINT_MAX] = NULL
and walks far out of bounds, writing NULL through each slot. A server
can drive this reset path against a client with PUSH_UPDATE, so on
Windows and Android this is a remotely reachable out-of-bounds write.
v2:
Change to the semantics used for all the other lists there - set
length to 0 and clear the list with CLEAR().
Change-Id: I3724236d4acc3d05d786274d6baf34a21c570594
Signed-off-by: Cole Munz <[email protected]>
Acked-by: Razvan Cojocaru <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1914
Github: OpenVPN/openvpn-private-issues#178
CVE: 2026-88964
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg39157.html
Signed-off-by: Gert Doering <[email protected]>
lstipakov
force-pushed
the
oob-server-probe
branch
from
September 14, 2026 14:07
4f4acc4 to
833da91
Compare
lstipakov
force-pushed
the
oob-server-probe
branch
4 times, most recently
from
September 30, 2026 08:17
d097b4e to
476297e
Compare
Early negotiation in the reset packets is a sequence of TLVs, and the out-of-band and control data messages use the same TLV format and type space. Add one TLV codec for all of them, control_msg.c/h, and move early negotiation onto it. The codec only handles the framing: reading and writing TLV headers, writing a 16-bit TLV, and walking a payload TLV by TLV with each value checked against the payload. How to treat an unknown type is up to each message. All TLV types are defined in control_msg.h; TLV_TYPE_EARLY_NEG_FLAGS moves there from ssl_pkt.h. The bytes on the wire do not change. Since the top bit of the type field is the "optional" flag, a TLV of type 0x8001 is now read as the flags TLV marked optional rather than skipped as unknown, so one whose length is not 2 now fails the handshake as malformed. Change-Id: I89c3133e009dc75dc2c10c607b3f0a24c04e8146 Signed-off-by: Lev Stipakov <[email protected]>
Out-of-band control messages carry control data but belong to no session, so a client can ask a server about itself before connecting. Reserve opcode 12 for them and add the TLV codecs the probe needs: the probe request a client probes a server with, and the probe reply the server answers with. A message is just a sequence of TLVs, and the TLVs it carries say what it is. The probe request carries a request_id chosen by the client, which the probe reply echoes. The TLVs use the shared TLV codec, control_msg.c/h, and their two types join the others in control_msg.h. The codec gains ctrl_msg_find_tlv(), which scans a payload for the one mandatory TLV of a message. The scan is strict: a truncated TLV header or value, or an unknown TLV not marked optional, rejects the whole message. P_LAST_OPCODE becomes 12. tls_pre_decrypt() rejects the OOB opcodes explicitly: they are not part of the reliable control channel (no control message id, no ACK array); the server answers them statelessly in a follow-up. Change-Id: I1c8d302ac57c5603d622a7be14be369437388268 Signed-off-by: Lev Stipakov <[email protected]>
Add the message-level helpers the server needs to answer a probe: oob_probe_request_find() for the probe request TLV, oob_timestamp_in_window() for the replay/skew check on its timestamp, and oob_probe_request_check(), which combines the two and classifies a received probe as invalid, stale or OK. The reader returns the probe request, whose request_id the reply echoes, so a client can tell which of its probes a reply answers. A stale probe, one whose timestamp is outside the window, is reported separately rather than dropped: the timestamp lets a server drop replayed requests, but a client with a skewed clock sends the same thing, so the server path decides (a follow-up answers a few per period). The window itself is the caller's choice; the server path passes --hand-window. These are pure functions exercised by unit tests; the server packet path uses them in a follow-up and builds and sends the reply itself. Change-Id: Iafa9efc1c156974ad9f5752e9de810a8c2f68c30 Signed-off-by: Lev Stipakov <[email protected]>
Make a --mode server UDP listener answer an out-of-band probe request without creating a session, so probing costs the server no state. tls_pre_decrypt_lite() accepts P_CONTROL_OOB_V1 and returns the new VERDICT_VALID_OOB_V1, and tls_wrap_oob_standalone() wraps a bare OOB message with the usual tls-auth/tls-crypt wrapping but no reliability fields, mirroring tls_reset_standalone(). do_pre_decrypt_check() classifies the probe with oob_probe_request_check() and answers with a probe reply that echoes the probe's request_id. A reply is charged against the same rate limit as the reset replies, once one is going to be sent, so a probe flood is capped like a reset flood. A stale probe, one whose timestamp is outside --hand-window, is still answered, but only within a separate budget of a twentieth of --connect-freq-initial per period (at least one): a client with a skewed clock can still probe, and a replayed probe gets no more than that budget. The budget's limiter is quiet, as a replayed probe hitting it is not worth a warning. The reply carries, as its own session id, the stateless SYN cookie the three-way handshake uses, so the server keeps nothing per probe and a client can later start the handshake from the reply. Change-Id: I930d3789e0313aa0c3bc51ee5fd1d108343d59f0 Signed-off-by: Lev Stipakov <[email protected]>
Add oob_probe_reply_find(), the client-side counterpart of oob_probe_request_find(): it scans a received OOB message for the probe reply TLV, skipping other and future TLV types that are marked optional. The reply's request_id names the probe it answers, with which the client matches the reply to its probe. Exercised by unit tests; the client probe path calls it in a follow-up. Change-Id: If04ce09d4c353f5384c0c48f48f63e05869a373f Signed-off-by: Lev Stipakov <[email protected]>
Add oob_rank_probe_results(), which orders remotes best-first from their
probe results, following the DNS-SRV (RFC 2782) semantics of the
probe_reply TLV:
- remotes that answered rank before those that did not (non-responders
keep their original relative order, last);
- responders are grouped by priority, lowest value first (an absolute
ordering, never overridden by latency or weight);
- within a priority group the "candidates" are the responders whose
RTT is no more than a margin larger than the fastest, so the fastest
is always one; candidates rank ahead of non-candidates;
- candidates are ordered by RFC 2782 weighted-random selection by
weight, so a server is chosen first with probability proportional to
its weight (load distribution); non-candidates follow, ordered by
RTT.
oob_effective_margin() decides that margin: the client's own margin if
it set one (--server-probe, added later), otherwise the max_latency_diff
advertised by the fastest server of the group, where 0 admits only the
servers tying it.
The RNG is injected as a function pointer so this module stays free of
the crypto layer and the weighted ordering is deterministically
unit-testable.
Exercised by unit tests; the client probe path calls it in a follow-up,
and measures RTT in a later one -- until then every responder sits in
the band and selection is purely weighted-random.
Change-Id: I55da68cc341bcfc707fd34ca2f84ff9b6a55501f
Signed-off-by: Lev Stipakov <[email protected]>
create_socket_udp_configured()'s "optional" argument covers only the socket() call: socket_bind() is fatal, so a caller that can do without the socket still dies if the address is unavailable. That is a problem for the upcoming --server-probe, which binds a probe socket for every address family in use, while a connection binds only the family of the remote it is about to try. A --lport whose IPv6 port happens to be taken by another process would therefore kill a client that could have connected over IPv4. Give socket_bind() a msglevel and a return value, and let "optional" apply to the bind as well: the socket is closed and SOCKET_UNDEFINED is returned, so the caller can skip that address family. Every existing caller passes M_FATAL and keeps its behaviour. Change-Id: I24e5925a72aaede53ef9e863fe96fcd7363df402 Signed-off-by: Lev Stipakov <[email protected]>
With --server-probe [max-latency-diff], before connecting a client sends an out-of-band probe request to all configured UDP remotes, collects the probe replies for one second, and reorders the connection list so the best-responding server is tried first. Unanswered probes are resent once within that window to ride out packet loss; every transmission, a resend included, carries a request_id of its own. The option is off by default; its optional argument overrides the margin the server advertises. The probe phase is self-contained in oob_client.c behind a single call from init.c (before next_connection_entry()). It uses one UDP socket per address family in use, set up and bound like the connection socket it may later become (--local, --lport, --bind-dev, --mark). A reply must echo the request_id of a probe sent to its source address, and is matched to its remote by that address; request_ids count up from a random base, so a spoofed reply cannot guess one. An address several entries resolve to is probed once per round and its reply credited to each of them. Remotes resolve with their own udp4/udp6 family. The first remote that can be probed provides the socket settings; probing is declined when another probed remote binds differently, since one socket set cannot represent both. Remotes behind a SOCKS proxy are not probed, and an address family whose socket cannot be created is skipped rather than fatal. When both families are bound, the IPv6 probe socket is v6-only so the two do not collide on the port. For now the probe is sent unwrapped, so it only works against a server without tls-auth/tls-crypt (wrapping is a follow-up), and probing runs once, before the first connection. Change-Id: I5a7e9e13b9f9548b7ff717daae2b4a9cde3c06f2 Signed-off-by: Lev Stipakov <[email protected]>
Until now the client never measured RTT, so every responder sat in the candidate band and selection was purely weighted-random. Record each probe's round-trip time (the send time of the transmission a reply answers vs the reply's arrival) and feed it to oob_rank_probe_results(), where RTT forms the candidate band: responders within the effective margin of the fastest compete on weight, slower ones fall behind. Log the measured RTT and the effective margin (with its source: client or server-advertised) at verb 4. A reply names the probe it answers by its request_id, so a reply to a resend is measured from the resend and a late reply to the first send still reads as slow. A reply whose request_id names no probe sent to its source address is dropped. Entries that resolve to the same address share the one probe, and so its RTT. The RTT runs up to the moment the client reads the reply: it compares servers, it is not a network measurement. Change-Id: I375a41749060b7d006647bc27002c55436c8a8bb Signed-off-by: Lev Stipakov <[email protected]>
Factor the tls-auth/tls-crypt wrapping-context setup out of do_init_crypto_tls() into a reusable init_tls_wrap_ctx() helper, and expose it in init.h together with do_init_tls_wrap_key(), which now takes the connection entry to read its keys from instead of using options.ce. Both call sites pass &c->options.ce, so there is no behavior change. This lets the client --server-probe path build the same control-channel wrapping context before a connection is established, so the probe can be wrapped with tls-auth/tls-crypt like any other control packet. Change-Id: I7d8546da9ef06c2226ea77e461f9550d24894c61 Signed-off-by: Lev Stipakov <[email protected]>
The client --server-probe sent a plaintext probe request and parsed replies by hand, so it only worked against a server with no control-channel wrapping. Build a standalone wrapping context for the probe, mirroring the server's tls_auth_standalone, and send probes and unwrap replies through the regular control-channel path (tls_wrap_oob_standalone() and read_control_auth()). Replies are unwrapped on a per-packet copy of the context, as tls_pre_decrypt_lite() does. Each transmission is wrapped on its own, as each carries its own request_id; with tls-auth or tls-crypt that also gives each its own replay packet id. Without either, the probe goes out in plaintext as before. tls-crypt-v2 is not supported yet: the server only learns the client key from the WKc carried in the TLS handshake, which an out-of-band probe cannot provide. Such configurations skip probing and keep the configured remote order. The probe is wrapped with the key of the first remote we can probe -- the same entry the other probed remotes are compared against -- so probing is declined when another one of them is keyed differently. The key material loaded for the probe is released afterwards; init loads it again for the connection. Change-Id: I1f9d7b5a5ec19bf77c0c212795f583c5ba4c03ac Signed-off-by: Lev Stipakov <[email protected]>
A remote can resolve to several A/AAAA records; --server-probe sent a probe request only to the first one, so a remote whose first address was unreachable looked unresponsive even if another address answered, and the connection could later try an address that was never probed. Probe every resolved address of each remote in parallel, accept a reply from any of them (first reply for a remote wins), and resend to all of a remote's addresses while it is unanswered. An address shared by several entries is still probed once per round. The addresses of one remote are taken to be the same service, advertising the same priority, weight and margin; the first of them to answer speaks for the remote, with the round-trip time of the probe it answers. Change-Id: I00208610e0ce4f3ed9a87233e68ece1b3b8a768a Signed-off-by: Lev Stipakov <[email protected]>
Add a server option, --server-probe-reply max-latency-diff [weight] [prio], setting the values the server returns in its OOB probe reply; the client already ranks remotes by them. An unconfigured server advertises weight 50, priority 100 and a 10 ms max-latency-diff. max-latency-diff is how much slower than the fastest server a server may be and still count as equally good; 0 keeps only the servers whose measured RTT ties the fastest as candidates, with weight still splitting exact ties. Also add the 2.8 changelog entry for the out-of-band probing feature. Change-Id: Id74cfae7e9d69029d2ddbf635ee85a2a6cedc3d8 Signed-off-by: Lev Stipakov <[email protected]>
A tls-crypt-v2 server learns the per-client key only from the wrapped client key (WKc). An out-of-band probe belongs to no session, so the client must carry the WKc with the probe for the server to unwrap it. Add the receive side of this with a new opcode, P_CONTROL_OOB_WKC_V1 (13): P_CONTROL_OOB_V1 with the WKc appended, mirroring CONTROL_HARD_RESET_CLIENT_V3 and CONTROL_WKC_V1. read_control_auth() extracts the WKc for it, loading the per-client key before unwrapping, and the server answers it exactly like P_CONTROL_OOB_V1, through its own verdict as elsewhere in the enum. The reply stays a plain P_CONTROL_OOB_V1: the server already holds the key after the unwrap, so tls_wrap_oob_standalone() now takes the opcode. The client still sends plain probes; sending P_CONTROL_OOB_WKC_V1 is added in a following commit. Change-Id: Idb8c0c660a98de8ec549b69f6692a7b41b092eaf Signed-off-by: Lev Stipakov <[email protected]>
When tls-crypt-v2 is configured, send the probe as P_CONTROL_OOB_WKC_V1
with the wrapped client key (WKc) appended, so the server can recover
the per-client key and unwrap it. Without tls-crypt-v2 the probe stays a
plain P_CONTROL_OOB_V1, unchanged.
- drop the "skip probing under tls-crypt-v2" bail-out
- make the WKc available on the probe's wrap context (mirroring
do_init_crypto_tls()), so tls_wrap_control() appends it, and free it
with the rest of the probe's key material
- choose the opcode (P_CONTROL_OOB_WKC_V1 vs P_CONTROL_OOB_V1) and
report "tls-crypt-v2" in the wrapping log line
Change-Id: I5cc100dd7dc810d7d1e6f29bb57584905fbcf4a0
Signed-off-by: Lev Stipakov <[email protected]>
A server answering an out-of-band probe request now also advertises a connect_lifetime in the probe reply: how long, in seconds, a probing client may use the reply as the server's HARD_RESET when it starts a handshake. The value is inferred, not configurable: the reply is only usable as that reset while its stateless SYN-cookie is valid, i.e. the guaranteed cookie window of ~handshake_window (2 quantised buckets; see check_session_hmac_and_pkt_id), so the server advertises exactly that. A probe that arrived as P_CONTROL_OOB_WKC_V1 also gets OOB_PROBE_REPLY_FLAG_RESEND_WKC, telling the client to resend the WKc when completing the handshake, since the server keeps no state. Only the wire advertisement is added here -- the server puts both values into the probe_reply it builds for an accepted probe. The client side that acts on them follows. Change-Id: Ib2b6c2246f9d9c0a505292ee8d879f714901ffae Signed-off-by: Lev Stipakov <[email protected]>
Add LS_MODE_UDP_ADOPT: a client link_socket can take ownership of a UDP
socket, set up like the connection socket (bound unless --nobind),
handed off via c2.oob_probe_adopt/oob_probe_sd instead of creating its
own, and pin c2.oob_probe_remote as the outgoing address. This lets the
OOB server-probe socket become the connection socket, so the source
IP+port and destination match what the server's handshake cookie is
bound to.
- link_socket_init_phase1: adopt the fd, inherit the address family
and pre-set lsa->actual (resolve_remote preserves an already-defined
actual). The probe socket was created and bound by
create_socket_udp_configured() with the link socket's options, so
nothing is applied or bound here. It also takes the probe's
lookup (c2.oob_probe_remote_list) as the remote list, with
current_remote at the address that answered: incoming packets are
checked against remote_list, and a second lookup may return other
addresses (round-robin DNS), whose check would drop the server's
replies
- linksock_print_addr: report an adopted socket's local address from
getsockname(), since bind_local is cleared to mean "do not bind
again" and the socket may well be bound
- link_socket_init_phase2: skip create_socket() so the adopted fd is
not clobbered (overlapped-I/O init is fd-independent, so Windows is
fine)
- do_init_socket_phase1: select the mode for the single client socket
- do_close_link_socket: close the handed-off fd and free the
handed-off lookup if the attempt aborted before they were adopted,
so neither is leaked. context_clear_2() sets oob_probe_sd to
SOCKET_UNDEFINED, since 0 is a valid descriptor, and
inherit_context_child() does the same for a server's per-client
contexts
The adopt path itself stays unused until the client sets oob_probe_adopt
(next commit).
Change-Id: Iec384ee6844ab278b280d6eafec8aaecf9dde755
Signed-off-by: Lev Stipakov <[email protected]>
When the best remote answered a probe and advertised a connect_lifetime,
its reply also served as the server's HARD_RESET: its session id is a
valid stateless SYN-cookie. The client therefore starts the handshake
from that reply instead of running its own reset exchange.
Note this does not shorten the handshake itself -- the probe and its
reply take the place of the two reset packets rather than removing them.
The saving is one RTT compared with probing and then connecting; a
client that does not probe is unaffected.
- oob_client.c: when the winner advertised a connect_lifetime, hand
its probe socket, the captured server session id (cookie), our probe
session id, the pinned responder address, its resolved address list
and the resend-wkc flag to the connection via c2, and relinquish
that socket. Gated off for dco-win, which has no user-to-kernel
socket handoff (probing still works, only starting from the reply is
skipped).
- oob_client.c: resolve each remote as the connection would, from the
--preresolve cache when there is one (hence get_cached_dns_entry()
is exported), and keep the lookups, so the winner's becomes the
connection's remote list (see the previous commit).
- ssl.c session_skip_to_pre_start_client(): seed our session id to the
probe's (the cookie is an HMAC over it), the remote session id to
the cookie, ack the phantom server reset (id 0) so the third packet
carries the cookie, set CO_RESEND_WKC for tls-crypt-v2, and drop to
S_PRE_START so tls_process() promotes to S_START and sends the
ClientHello (no HARD_RESET sent).
- init.c: invoke the client skip after tls_multi_init_finalize when
adopting, and count the probe reply as the initial packet received
(n_sessions++, as the server does before its own
session_skip_to_pre_start) so check_server_poll_timeout() does not
restart the connected session.
Three things guard the shortcut. The reply's session id is rejected
unless it is defined: it becomes the remote session id, and the phantom
ACK means reliable_ack_write() would assert on an all-zero one, so a
server -- or, without tls-auth/tls-crypt, anyone who answers first --
could otherwise kill the client with a single packet.
The probe socket and the cookie belong to the remote that answered, so
both are given up unless next_connection_entry() selected that same
remote. The entry is mapped by value and the management interface may
rewrite the copy, so the check compares the resulting host, port and
proxy settings rather than which entry was picked.
Finally, the server honours its reply only for the advertised
connect_lifetime, which a passphrase or token prompt during init can
outlast; the shortcut is dropped when it has elapsed. As the spec asks,
it is counted from when the probe request the reply answers was sent,
not from when the reply arrived.
Change-Id: I454d5040cbad4d373ee4f90b8d683200d2a4c0e4
Signed-off-by: Lev Stipakov <[email protected]>
If the server does not accept the third packet of a handshake started from a probe reply, the client stalled for the full handshake_window (~60s) before recovering. In a normal handshake, no answer could mean the server is down, so waiting is right. Here we know it is up, since it answered a probe a moment ago -- so no answer means it did not accept the reply as a reset, and waiting 60s is pointless. That happens when a load balancer sends the probe and the handshake to different instances, when NAT changes the source port the cookie is bound to, or when the server restarted and rotated its session-id HMAC key. Give such a session a short first-response deadline (min(handshake_window, 5s)); once the server answers, tls_pre_decrypt() restores the full window so a slow-but-working handshake is not cut off. If no response arrives the session times out quickly and the client restarts the attempt rather than retrying in place: the restart moves on to the next resolved address or connection entry, so the address that answered the probe is not retried this cycle (with --persist-remote-ip the restart keeps it, as for any restart). A rejected reply therefore costs a few seconds instead of ~60. Change-Id: Icec4696ff263ab39ebab06e8d478395a5ddfaab9 Signed-off-by: Lev Stipakov <[email protected]>
lstipakov
force-pushed
the
oob-server-probe
branch
from
October 1, 2026 07:20
476297e to
4546aa5
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thank you for your contribution
You are welcome to open PR, but they are used for discussion only. All
patches must eventually go to the openvpn-devel mailing list for review:
Please send your patch using git-send-email. For example to send your latest commit to the list:
For details, see these Wiki articles: