25857 Commits

Author SHA1 Message Date
Amaury Denoyelle
a70816da82 BUG/MINOR: h3: handle properly buf alloc failure on response forwarding
Replace BUG_ON() for buffer alloc failure on h3_resp_headers_to_htx() by
proper error handling. An error status is reported which should be
sufficient to initiate connection closure.

No need to backport.
2025-11-25 15:55:08 +01:00
Amaury Denoyelle
ae96defaca BUG/MINOR: h3: do no crash on forwarding multiple chained response
h3_resp_headers_to_htx() is the function used to convert an HTTP/3
response into a HTX message. It was introduced on this release for QUIC
backend support.

A BUG_ON() would occur if multiple responses are forwarded
simultaneously on a stream without rcv_buf in between. Fix this by
removing it. Instead, if QCS HTX buffer is not empty when handling with
a new response, prefer to pause demux operation. This is restarted when
the buffer has been read and emptied by the upper stream layer.

No need to backport.
2025-11-25 15:52:37 +01:00
Amaury Denoyelle
a363b536a9 BUG/MINOR: server: fix srv_drop() crash on partially init srv
A recent patch has introduced free operation for QUIC tokens stored in a
server. These values are located in <per_thr> server array.

However, a server instance may be released prior to its full
initialization in case of a failure during "add server" CLI command. The
mentionned patch would cause a srv_drop() crash due to an invalid usage
of NULL <per_thr> member.

Fix this by adding a check on <per_thr> prior to dereference it in
srv_drop().

No need to backport.
2025-11-25 15:16:13 +01:00
Amaury Denoyelle
6c08eb7173 BUG/MINOR: quic: release BE quic_conn on connect failure
If quic_connect_server() fails, quic_conn FD will remain unopened as set
to -1. Backend connections do not have a fallback socket for future
exchange, contrary to frontend one which can use the listener FD. As
such, it is better to release these connections early.

This patch adjusts such failure by extending quic_close(). This function
is called by the upper layer immediately after a connect issue. In this
case, release immediately a quic_conn backend instance if the FD is
unset, which means that connect has previously failed.

Also, quic_conn_release() is extended to ensure that such faulty
connections are immediately freed and not converted into a
quic_conn_closed instance.

Prior to this patch, a backend quic_conn without any FD would remain
allocated and possibly active. If its tasklet is executed, this resulted
in a crash due to access to an invalid FD.

No need to backport.
2025-11-25 14:50:23 +01:00
Amaury Denoyelle
346631700d BUG/MINOR: quic: fix uninit list on show quic handler
A recent patch has extended "show quic" capability. It is now possible
to list a specific list of connections, either active frontend, closing
frontend or backend connections.

An issue was introduced as the list is local storage. As this command is
reentrant, show quic context must be extended so that the currently
inspected list is also saved.

This issue was reported via GCC which mentions an uninitilized value
depending on branching conditions.
2025-11-25 14:50:19 +01:00
Amaury Denoyelle
a3f76875f4 MINOR: quic: mark backend conns on show quic
Add an extra "(B)" marker when displaying a backend connection during a
"show quic". This is useful to differentiate them with the frontend side
when displaying all connections.
2025-11-25 14:31:27 +01:00
Amaury Denoyelle
e56fdf6320 MINOR: quic: dump backend connections on show quic
Add a new "be" filter to "show quic". Its purpose is to be able to
display backend connections. These connections can also be listed using
"all" filter.
2025-11-25 14:30:18 +01:00
Amaury Denoyelle
3685681373 MINOR: quic: add "clo" filter on show quic
Add a new filter "clo" for "show quic" command. Its purpose is to filter
output to only list closing frontend connections.
2025-11-25 14:30:18 +01:00
Amaury Denoyelle
49e6fca51b MINOR: quic: use separate global quic_conns FE/BE lists
Each quic_conn instance is stored in a global list. Its purpose is to be
able to loop over all known connections during "show quic".

Split this into two separate lists for frontend and backend usage.
Another change is that closing backend connections do not move into
quic_conns_clo list. They remain instead in their original list. The
objective of this patch is to reduce the contention between the two
sides.

Note that this prevents backend connections to be listed in "show quic"
now. This will be adjusted in a future patch.
2025-11-25 14:30:18 +01:00
Amaury Denoyelle
a5801e542d MINOR: quic: split global CID tree between FE and BE sides
QUIC CIDs are stored in a global tree. Prior to this patch, CIDs used on
both frontend and backend sides were mixed together.

This patch implement CID storage separation between FE and BE sides. The
original tre quic_cid_trees is splitted as
quic_fe_cid_trees/quic_be_cid_trees.

This patch should reduce contention between frontend and backend usages.
Also, it should reduce the risk of random CID collision.
2025-11-25 14:30:18 +01:00
Amaury Denoyelle
4b596c1ea8 BUG/MINOR: quic/server: free quic_retry_token on srv drop
A recent patch has implemented caching of QUIC token received from a
NEW_TOKEN frame into the server cache. This value is stored per thread
into a <quic_retry_token> field.

This field is an ist, first set to an empty string. Via
qc_try_store_new_token(), it is reallocated to fit the size of the newly
stored token. Prior to this patch, the field was never freed so this
causes a memory leak.

Fix this by using istfree() on <quic_retry_token> field during
srv_drop().

No need to backport.
2025-11-25 14:30:18 +01:00
Amaury Denoyelle
cbfe574d8a BUG/MEDIUM: quic: do not prevent sending if no BE token
For QUIC client support, a token may be emitted along with INITIAL
packets during the handshake. The token is encoded during emission via
qc_enc_token() called by qc_build_pkt().

The token may be provided from different sources. First, it can be
retrieved via <retry_token> quic_conn member when a Retry packet was
received. If not present, a token may be reused from the server cache,
populated from NEW_TOKEN received from previous a connection.

Prior to this patch, the last method may cause an issue. If the upper
connection instance is released prior to the handshake completion, this
prevents access to a possible server token. This is considered an error
by qc_enc_token(). The error is reported up to calling functions,
preventing any emission to be performed. In the end, this prevented the
either the full quic_conn release or subsizing into quic_conn_closed
until the idle timeout completion (30s by default). With abortonclose
set now by default on HTTP frontends, early client shutdowns can easily
cause excessive memory consumption.

To fix this, change qc_enc_token() so that if connection is closed, no
token is encoded but also no error is reported. This allows to continue
emission and permit early connection release.

No need to backport.
2025-11-25 14:30:18 +01:00
Olivier Houchard
e27216b799 DOC: ssl: Note that 0rtt works fork QUIC with QuicTLS too.
Document that one can use 0rtt with QUIC when using QuicTLS too.
2025-11-25 13:17:45 +01:00
Olivier Houchard
f867068dc7 DOC: ssl: Document the restrictions on 0RTT.
Document that with QUIC, 0RTT only works with OpenSSL >= 3.5.2 and
AWS-LC, and for TLS/TCP, it only works with OpenSSL, and frontends
require that an ALPN be sent by the client to use the early data before
the handshake.
2025-11-25 11:46:22 +01:00
Jacques Heunis
91eb9b082b BUG/MINOR: freq_ctr: Prevent possible signed overflow in freq_ctr_overshoot_period
All of the other bandwidth-limiting code stores limits and intermediate
(byte) counters as unsigned integers. The exception here is
freq_ctr_overshoot_period which takes in unsigned values but returns a
signed value. While this has the benefit of letting the caller know how
far away from overshooting they are, this is not currently leveraged
anywhere in the codebase, and it has the downside of halving the positive
range of the result.

More concretely though, returning a signed integer when all intermediate
values are unsigned (and boundaries are not checked) could result in an
overflow, producing values that are at best unexpected. In the case of
flt_bwlim (the only usage of freq_ctr_overshoot_period in the codebase at
the time of writing), an overflow could cause the filter to wait for a
large number of milliseconds when in fact it shouldn't wait at all.

This is a niche possibility, because it requires that a bandwidth limit is
defined in the range [2^31, 2^32). In this case, the raw limit value would
not fit into a signed integer, and close to the end of the period, the
`(elapsed * freq)/period` calculation could produce a value which also
doesn't fit into a signed integer.

If at the same time `curr` (the number of events counted so far in the
current period) is small, then we could get a very large negative value
which overflows. This is undefined behaviour and could produce surprising
results. The most obvious outcome is flt_bwlim sometimes waiting for a
large amount of time in a case where it shouldn't wait at all, thereby
incorrectly slowing down the flow of data.

Converting just the return type from signed to unsigned (and checking for
the overflow) prevents this undefined behaviour. It also makes the range
of valid values consistent between the input and output of
freq_ctr_overshoot_period and with the input and output of other freq_ctr
functions, thereby reducing the potential for surprise in intermediate
calculations: now everything supports the full 0 - 2^32 range.
2025-11-24 14:10:13 +01:00
Amaury Denoyelle
2829165f61 BUG/MEDIUM: server: do not use default SNI if manually set
A new server feature "sni-auto" has been introduced recently. The
objective is to automatically set the SNI value to the host header if no
SNI is explicitely set.

  668916c1a2fc2180028ae051aa805bb71c7b690b
  MEDIUM: server/ssl: Base the SNI value to the HTTP host header by default

There is an issue with it : server SNI is currently always overwritten,
even if explicitely set in the configuration file. Adjust
check_config_validity() to ensure the default value is only used if
<sni_expr> is NULL.

This issue was detected as a memory leak on <sni_expr> was reported when
SNI is explicitely set on a server line.

This patch is related to github feature request #3081.

No need to backport, unless the above patch is.
2025-11-24 11:45:18 +01:00
William Lallemand
5dbf06e205 MINOR: httpclient: complete the https log
The httpsclient_log_format variable lacks a few values in the TLS fields
that are now available as fetches.

On the backend side we have:

"%[fc_err]/%[ssl_fc_err,hex]/%[ssl_c_err]/%[ssl_c_ca_err]/%[ssl_fc_is_resumed] %[ssl_fc_sni]/%sslv/%sslc"

We now have enough sample fetches to have this equivalent in the
httpclient:

"%[bc_err]/%[ssl_bc_err,hex]/%[ssl_c_err]/%[ssl_c_ca_err]/%[ssl_bc_is_resumed] %[ssl_bc_sni]/%[ssl_bc_protocol]/%[ssl_bc_cipher]"

Instead of the current:

"%[bc_err]/%[ssl_bc_err,hex]/-/-/%[ssl_bc_is_resumed] -/-/-"
2025-11-22 12:29:33 +01:00
William Lallemand
0cae2f0515 BUG/MINOR: acme: warning ‘ctx’ may be used uninitialized
Please compiler with maybe-uninitialized warning

src/acme.c: In function ‘cli_acme_chall_ready_parse’:
include/haproxy/task.h:215:9: error: ‘ctx’ may be used uninitialized [-Werror=maybe-uninitialized]
  215 |         _task_wakeup(t, f, MK_CALLER(WAKEUP_TYPE_TASK_WAKEUP, 0, 0))
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/acme.c:2903:17: note: in expansion of macro ‘task_wakeup’
 2903 |                 task_wakeup(ctx->task, TASK_WOKEN_MSG);
      |                 ^~~~~~~~~~~
src/acme.c:2862:26: note: ‘ctx’ was declared here
 2862 |         struct acme_ctx *ctx;
      |                          ^~~

Backport to 3.2.
2025-11-21 23:04:16 +01:00
William Lallemand
d77d3479ed BUG/MINOR: acme: better challenge_ready processing
Improve the challenge_ready processing:

- do a lookup directly instead looping in the task tree
- only do a task_wakeup when every challenges are ready to avoid starting
  the task and stopping it just after
- Compute the number of remaining challenge to setup
- Output a message giving the number of remaining challenges to setup
  and if the task started again.

Backport to 3.2.
2025-11-21 22:47:52 +01:00
Willy Tarreau
8418c001ce [RELEASE] Released version 3.3-dev14
Released version 3.3-dev14 with the following main changes :
    - MINOR: stick-tables: Rename stksess shards to use buckets
    - MINOR: quic: do not use quic_newcid_from_hash64 on BE side
    - MINOR: quic: support multiple random CID generation for BE side
    - MINOR: quic: try to clarify quic_conn CIDs fields direction
    - MINOR: quic: refactor qc_new_conn() prototype
    - MINOR: quic: remove <ipv4> arg from qc_new_conn()
    - MEDIUM: mworker: set the mworker-max-reloads to 50
    - BUG/MEDIUM: quic-be: prevent use of MUX for 0-RTT sessions without secrets
    - CLEANUP: startup: move confusing msg variable
    - BUG/MEDIUM: mworker: signals inconsistencies during startup and reload
    - BUG/MINOR: mworker: wrong signals during startup
    - BUG/MINOR: acme: P-256 doesn't work with openssl >= 3.0
    - REGTESTS: ssl: split the SSL reuse test into TLS 1.2/1.3
    - BUILD: Makefile: make install with admin tools
    - CI: github: make install-bin instead of make install
    - BUG/MINOR: ssl: remove dead code in ssl_sock_from_buf()
    - BUG/MINOR: mux-quic: implement max-reuse server parameter
    - MINOR: quic: fix trace on quic_conn_closed release
    - BUG/MINOR: quic: do not decrement jobs for backend conns
    - BUG/MINOR: quic: fix FD usage for quic_conn_closed on backend side
    - BUILD: Makefile: remove halog from install-admin
    - REGTESTS: ssl: add basic 0rtt tests for TLSv1.2, TLSv1.3 and QUIC
    - REGTESTS: ssl: also verify that 0-rtt properly advertises early-data:1
    - MINOR: quic/flags: add missing QUIC flags for flags dev tool.
    - MINOR: quic: uneeded xprt context variable passed as parameter
    - MINOR: limits: keep a copy of the rough estimate of needed FDs in global struct
    - MINOR: limits: explain a bit better what to do when fd limits are exceeded
    - BUG/MEDIUM: quic-be/ssl_sock: TLS callback called without connection
    - BUG/MINOR: acme: alert when the map doesn't exist at startup
    - DOC: acme: add details about the DNS-01 support
    - DOC: acme: explain how to dump the certificates
    - DOC: acme: configuring acme needs a crt file
    - DOC: acme: add details about key pair generation in ACME section
    - BUG/MEDIUM: queues: Don't forget to unlock the queue before exiting
    - MINOR: muxes: Support an optional ALPN string when defining mux protocols
    - MINOR: config: Do proto detection for listeners before checks about ALPN
    - BUG/MEDIUM: config: Use the mux protocol ALPN by default for listeners if forced
    - DOC: config: Add a note about conflict with ALPN/NPN settings and proto keyword
    - MINOR: quic: store source address for backend conns
    - BUG/MINOR: quic: flag conn with CO_FL_FDLESS on backend side
    - ADMIN: dump-certs: let dry-run compare certificates
    - BUG/MEDIUM: connection/ssl: also fix the ssl_sock_io_cb() regarding idle list
    - DOC: http: document 413 response code
    - MINOR: limits: display the computed maxconn using ha_notice()
    - BUG/MEDIUM: applet: Fix conditions to detect spinning loop with the new API
    - BUG/MEDIUM: cli: State the cli have no more data to deliver if it yields
    - MINOR: h3: adjust sedesc update for known input payload len
    - BUG/MINOR: mux-quic: fix sedesc leak on BE side
    - OPTIM: mux-quic: delay FE sedesc alloc to stream creation
    - BUG/MEDIUM: quic-be: quic_conn_closed buffer overflow
    - BUG/MINOR: mux-quic: check access on qcs stream-endpoint
    - BUG/MINOR: acme: handle multiple auth with the same name
    - BUG/MINOR: acme: prevent creating map entries with dns-01
v3.3-dev14
2025-11-21 14:13:44 +01:00
William Lallemand
548e7079cd BUG/MINOR: acme: prevent creating map entries with dns-01
We don't need map entries with dns-01.

The patch must be backported to 3.2.
2025-11-21 12:28:41 +01:00
William Lallemand
26093121a3 BUG/MINOR: acme: handle multiple auth with the same name
In case of the dns-01 challenge, it is possible to have a domain
"example.com" and "*.example.com" in the same request. This will create
2 different auth objects, which need 2 different challenges.

However the associated domain is "example.com" for both auth objects.

When doing a "challenge_ready", the algorithm will break at the first
domain found. But since you can have multiple time the same domain in
this case, breaking at the first one prevent to have all auth objects in
a ready state.

This patch just remove the break so we can loop on every auth objects.

Must be backported to 3.2.
2025-11-21 12:28:41 +01:00
Amaury Denoyelle
bbd83e3de9 BUG/MINOR: mux-quic: check access on qcs stream-endpoint
Since the following commit, allocation of stream-endpoint has been
delayed. The objective is to allocate it only for QCS attached to an
upper stream object.

  commit e6064c561684d9b079e3b5725d38dc3b5c1b5cd5
  OPTIM: mux-quic: delay FE sedesc alloc to stream creation

However, some MUX functions are unsafe as qcs->sd is dereferenced
without any check on it which will result in a crash. Fix this by
testing that qcs->sd is allocated before using it.

This does not need to be backported, unless the above patch is.
2025-11-21 11:16:07 +01:00
Frederic Lecaille
91f479604e BUG/MEDIUM: quic-be: quic_conn_closed buffer overflow
This bug impacts only the backends.

Recent commits have modified quic_rx_pkt_parse() for the QUIC backend to handle the
retry token, and version negotiation. This function is called for the quic_conn
even when is closing state (so for the quic_conn_closed struct). The quic_conn
struct and quic_conn_closed struct share some members thank to the leading
QUIC_CONN_COMMON struct. The recent modification impacts some members which do not
exist for the quic_connn_closed struct, leading to buffer overflows if modified.

For the backends only this patch:
  1- silently drops the Retry packet (received/parsed only by backends)
  2- silently drops the Initial packets received in closing state

This is safe for the Initial packets because in closing state the datagrams
are entirely skipped thanks to qc_rx_check_closing() in quic_dgram_parse().

No backport needed because the backend support arrived with the current dev.
2025-11-21 10:49:44 +01:00
Amaury Denoyelle
e6064c5616 OPTIM: mux-quic: delay FE sedesc alloc to stream creation
On frontend side, a stream-endpoint is allocated on every qcs_new()
invokation. However, this is only used for bidirectional request
streams.

This patch delays stream-endpoint allocation to qcs_attach_sc(), just
prior the instantiation of the upper stream object. This does not bring
any behavior change but is a nice optimization.
2025-11-21 10:34:08 +01:00
Amaury Denoyelle
4fb8908605 BUG/MINOR: mux-quic: fix sedesc leak on BE side
On backend side, streams are instantiated prior to their QCS MUX
counterpart. Thus, QCS can reuse the stream-endpoint already allocated
with the streams, either on qmux_init() or attach operation.

However, a stream-endpoint is also always allocated in every qcs_new()
invokation. For backend QCS, it is thus overwritten on
qmux_init()/attach operation. This causes a memleak.

Fix this by restricting allocation of stream-endpoint only for frontend
connection.

This does not need to be backported.
2025-11-21 10:34:08 +01:00
Amaury Denoyelle
9f16c64a8c MINOR: h3: adjust sedesc update for known input payload len 2025-11-21 10:34:08 +01:00
Christopher Faulet
0629ce8f4b BUG/MEDIUM: cli: State the cli have no more data to deliver if it yields
A regression was introduced in the commit 2d7e3ddd4 ("BUG/MEDIUM: cli: do
not return ACKs one char at a time"). When the CLI is processing a command
line, we no longer send response immediately. It is especially useful for
clients sending a bunch of commands with very short response.

However, in that state, the CLI applet must state it has no more data to
deliver. Otherwise it will be woken up again and again because data are
found in its output buffer with no blocking conditions. In worst cases, if
the command rate is really high, this can trigger the watchdog.

This patch must be backported where the patch above is, so probably as far
as 3.0.
2025-11-21 10:00:15 +01:00
Christopher Faulet
dfdccbd2af BUG/MEDIUM: applet: Fix conditions to detect spinning loop with the new API
There was a mixup between read/send events and ability for an applet to
receive and send. The fix seems obvious by reading it. The call-rate must be
incremented when nothing was received from the applet while it was allowed
and nothing was sent to the applet while it was allowed.

This patch must be backported as far as 3.0.
2025-11-21 09:41:05 +01:00
Willy Tarreau
4cbff2cad9 MINOR: limits: display the computed maxconn using ha_notice()
The computed maxconn was only displayed in verbose or debug modes. This
is too bad because lots of users just don't know what they're starting
with and can be trapped when an environment changes. Let's use ha_notice()
instead of a conditional fprintf() so that it gets displayed right after
the other startup messages, hoping that users will get used to seeing it
and more easily spot anomalies. See github issue #3191 for more context.
2025-11-20 18:38:09 +01:00
Lukas Tribus
a50c074b74 DOC: http: document 413 response code
Considering that we only use a "413 Payload Too Large" response in a single
situation with a specific config toogle (h1-accept-payload-with-any-method),
add some text to make it easier to find.

Should be backported to 2.6.

Link: https://github.com/cbonte/haproxy-dconv/issues/46
Link: https://discourse.haproxy.org/t/haproxy-error-413-paylod-too-large/9831/3
2025-11-20 18:07:01 +01:00
Willy Tarreau
05c409f1be BUG/MEDIUM: connection/ssl: also fix the ssl_sock_io_cb() regarding idle list
The fix in commit 9481cef948 ("BUG/MEDIUM: connection: do not reinsert a
purgeable conn in idle list") is also needed for ssl_sock_io_cb() which
can also release an idle connection and must perform the same checks.
This fix must be backported to all stable versions containing the fix
above.
2025-11-20 17:19:50 +01:00
William Lallemand
6aa236e964 ADMIN: dump-certs: let dry-run compare certificates
Let the --dry-run mode connect to the socket and compare the
certificates. It would exits the process just before trying to move
the previous certificate and replace it.

This allow to have the "[NOTICE] (1234) XXX is already up to date" message
with dry-run.
2025-11-20 16:50:20 +01:00
Amaury Denoyelle
b2664d4450 BUG/MINOR: quic: flag conn with CO_FL_FDLESS on backend side
Connection struct defines an handle which can point to either a FD or a
quic_conn. On the latter case, CO_FL_FDLESS must be set. This is already
the case on frontend side.

This patch fixes QUIC backend support. Before setting connection handle
member to a quic_conn instance, ensure that CO_FL_FDLESS flag is set on
the connection.

Prior to this patch, crash can occur in "show sess all".

No need to backport.
2025-11-20 16:44:03 +01:00
Amaury Denoyelle
cd2962ee64 MINOR: quic: store source address for backend conns
quic_conn has a local_addr member which is used to store the connection
source address. On backend side, this member is initialized to NULL as
the address is not yet known prior to connect. With this patch,
quic_connect_server() is extended so that local_addr is updated after
connect() success.

Also, quic_sock_get_src() is completed for the backend side which now
returns local_addr member. This step is necessary to properly support
fetches bc_src/bc_src_port.
2025-11-20 16:44:03 +01:00
Christopher Faulet
a14b7790ad DOC: config: Add a note about conflict with ALPN/NPN settings and proto keyword
If a mux protocol is forced and an incompatible ALPN or NPN settings are
used, connection errors may be experienced. There is no check performed
during HAProxy startup and It is not necessarily obvious. So a note is added
to warn users about this usage.
2025-11-20 16:14:52 +01:00
Christopher Faulet
0a7f3954b5 BUG/MEDIUM: config: Use the mux protocol ALPN by default for listeners if forced
Since the commit 5003ac7fe ("MEDIUM: config: set useful ALPN defaults for
HTTPS and QUIC"), the ALPN is set by default to "h2,http/1.1" for HTTPS
listeners. However, it is in conflict with the forced mux protocol, if
any. Indeed, with "proto" keyword, the mux can be forced. In that case, some
combinations with the default ALPN will triggers connections errors.

For instance, by setting "proto h2", it will not be possible to use the H1
multiplexer. So we must take care to not advertise it in the ALPN. Worse,
since the commit above, most modern HTTP clients will try to use the H2
because it is advertised in the ALPN. By setting "proto h1" on the bind line
will make all the traffic rejected in error.

To fix the issue, and thanks to previous commits, if it is defined, we are
now relying on the ALPN defined by the mux protocol by default. The H1
multiplexer (only the one that can be forced) defines it to "http/1.1" while
the H2 multiplexer defines it to "h2". So by default, if one or another of
these muxes is forced, and if no ALPN is set, the mux ALPN is used.

Other multiplexers are not defining any default ALPN for now, because it is
useless. In addition, only the listeners are concerned because there is no
default ALPN on the server side.Finally, there is no tests performed if the
ALPN is forced on the bind line. It is the user responsibility to properly
configure his listeners (at least for now).

This patch depends on:
  * MINOR: config: Do proto detection for listeners before checks about ALPN
  * MINOR: muxes: Support an optional ALPN string when defining mux protocols

The series must be backported as far as 2.8.
2025-11-20 16:14:52 +01:00
Christopher Faulet
2ef8b91a00 MINOR: config: Do proto detection for listeners before checks about ALPN
The verification of any forced mux protocol, via the "proto" keyword, for
listeners is now performed before any tests on the ALPN. It will be
mandatory to be able to force the default ALPN, if not forced on the bind
line.

This patch will be mandatory for the next fix.
2025-11-20 16:14:52 +01:00
Christopher Faulet
8e08a635eb MINOR: muxes: Support an optional ALPN string when defining mux protocols
When a multiplexer protocol is defined, it is now possible to specify the
ALPN it supports, in binary format. This info is optionnal. For now only the
h2 and the h1 multiplexers define an ALPN because this will be mandatory for
a fix. But this could be used in future for different purpose.

This patch will be mandatory for the next fix.
2025-11-20 16:14:52 +01:00
Olivier Houchard
e9d34f991e BUG/MEDIUM: queues: Don't forget to unlock the queue before exiting
In assign_server_and_queue(), there's a rare case when the server was
full, so we created a pendconn, another server was considered but in the
meanwhile the pendconn was unqueued already, so we just left the
function. We did so, however, while still holding the queue lock, which
will ultimately lead to a deadlock, and ultimately the watchdog would
kill the process.
To fix that, just unlock the queue before leaving.

This should be backported to 3.2.
2025-11-20 13:57:06 +01:00
William Lallemand
1b443bdec5 DOC: acme: add details about key pair generation in ACME section
In 3.3 it is possible to generate a key pair without needing a
existing certificate on the disk.
2025-11-20 12:48:22 +01:00
William Lallemand
d6e3e5b3a6 DOC: acme: configuring acme needs a crt file
Configuring acme in 3.2 needs a certificate on the disk.

To be backported to 3.2
2025-11-20 12:44:54 +01:00
William Lallemand
332dcaecba DOC: acme: explain how to dump the certificates
The certificates can be dumped with either the dataplaneapi or the
haproxy-dump-certs scripts.

Must be backported in 3.2 as well as the script.
2025-11-20 12:40:38 +01:00
William Lallemand
5ff4c066e7 DOC: acme: add details about the DNS-01 support
DNS-01 is supported and was backported in 3.2.

Backport to 3.2.
2025-11-20 12:37:48 +01:00
William Lallemand
e0665d4ffe BUG/MINOR: acme: alert when the map doesn't exist at startup
When configuring an acme section with the 'map' keyword, the user must
use an existing map. If the map doesn't exist, a log will be emitted
when trying to add the challenge to the map.

This patch change the behavior by checking at startup if the map exists,
so haproxy would warn and won't start with a non-existing map.

This must be backported in 3.2.
2025-11-20 12:22:19 +01:00
Frederic Lecaille
fab7da0fd0 BUG/MEDIUM: quic-be/ssl_sock: TLS callback called without connection
Contrary to TCP, QUIC does not SSL_free() its SSL *  object when its ->close()
XPRT callback is called. This has as side effect to trigger some BUG_ON(!conn)
with <conn> the connection from TLS callbacks registered at configuration
parsing time, so after this <conn> have been released.

This is the case for instance with ssl_sock_srv_verifycbk() whose role is to
add some checks to the built-in server certificate verification process.

This patch prevents the pointer to <conn> dereferencing inside several callbacks
shared between TCP and QUIC.

Thank you to @InputOutputZ for its report in GH #3188.

As the QUIC backend feature arrived with the current 3.3 dev, no need to backport.
2025-11-20 11:36:57 +01:00
Willy Tarreau
8438ca273f MINOR: limits: explain a bit better what to do when fd limits are exceeded
As shown in github issue #3191, the error message shown when FD limits
are exceeded is not very useful as-is, since the current hard limit is
not displayed, and no suggestion is made about what to change in the
config. Let's explain about maxconn/ulimit-n/fd-hard-limit, suggest
dropping them or setting them to a context-based value at roughly 49%
of the current limit minus the known used FDs for listeners and checks.
This allows common "large" hard limits to report mostly round maxconns.
Example:

  [ALERT]    (25330) : [haproxy.main()] Cannot raise FD limit to 4001020,
  current limit is 1024 and hard limit is 4096. You may prefer to let
  HAProxy adjust the limit by itself; for this, please just drop any
  'maxconn' and 'ulimit-n' from the global section, and possibly add
  'fd-hard-limit' lower than this hard limit. You may also force a new
  'maxconn' value that is a bit lower than half of the hard limit minus
  listeners and checks. This results in roughly 1500 here.
2025-11-20 08:44:52 +01:00
Willy Tarreau
91d4f4f618 MINOR: limits: keep a copy of the rough estimate of needed FDs in global struct
It's always a pain to guess the number of FDs that can be needed by
listeners, checks, threads, pollers etc. We have this estimate in
global.maxsock before calling set_global_maxconn(), but we lose it
the line after. Let's copy it into global.est_fd_usage and keep it.
This will be helpful to try to provide more accurate suggestions for
maxconn.
2025-11-20 08:44:52 +01:00
Frederic Lecaille
2c6720a163 MINOR: quic: uneeded xprt context variable passed as parameter
This quic_conn ->xrpt_ctx is passed to qc_send_ppkts(), the quic_conn is retrieved
from this context to be used inside this function and it is not used at all
by this function.

This patch simply directly passes the quic_conn to qc_send_ppkts(). This is only
what this function needs.
2025-11-20 08:17:44 +01:00
Frederic Lecaille
a88fdf8669 MINOR: quic/flags: add missing QUIC flags for flags dev tool.
Add missing QUIC_FL_CONN_XPRT_CLOSED quic_conn flags definition.
2025-11-20 08:10:58 +01:00