26981 Commits

Author SHA1 Message Date
Willy Tarreau
57eed982f3 CLEANUP: tree-wide: fix comment typos all over the tree (~68)
This covers hpack, quic, h3, map, acl, pattern, tcpchecks, clienthello.
Only comments were touched, 100% harmless, no need to backport.
2026-04-29 15:11:44 +02:00
Willy Tarreau
50f0dbbcd0 BUG/MINOR: fix various typos and spelling mistakes in user-visible messages
A few typos like "not unhandled" in error messages, and some spelling
mistakes mostly in cfgparse error messages were fixed. One spelling
mistake in a function name was fixed as well (ssl_sock_chose_sni_ctx
renamed to ssl_sock_choose_sni_ctx). Those which apply may be worth
being backported.
2026-04-29 15:11:44 +02:00
Olivier Houchard
261aa23522 BUG/MEDIUM: tasks: Do not loop in task_schedule() if a task is running
Commit 7e1cc0fcdbcace75a957a69fc8a4d991f7b30fdb made it so we'd loop in
task_schedule() if the task is currently running, so that we'd be sure
that the task would not overwrite the expire field. However,
task_schedule() may be called while a lock is held, and if the running
task attempts to acquire that lock, it will lead to a deadlock.
So instead, if the task is running, just wake it up, so that we're sure
that it will reschedule itself correctly, as it should do anyway. We
already do nothing if the task is in a run queue, so it is expected that
tasks do that, and if they do not, then it is a bug.

This should fix github issue #3350
This should be backported where 7e1cc0fcdbcace75a957a69fc8a4d991f7b30fdb
has been backported, which should be up to 2.8.
2026-04-29 12:16:42 +02:00
Christopher Faulet
f9c2d47677 BUG/MAJOR: mux-h1: Deal with true 64-bits integer to emit chunks size
Functions emitting chunks size are using size_t integer to do so. Depending
on the code path, these functions can be called using an unsigned long long
integer (h1m->curr_len for instance). On 64-bits architectures, there is no
issue. But on the 32-bits architecture, it is a problem. size_t are 32-bits
integer so the 64-bits parameter will be casted to a 32-bits integer. For
chunk size exceeding 4GB, the wrong size will be emitted.

To fix the issue, these functions are now using true 64-bits
integer. h1s_consume_kop() was also modified accordingly.

In addition, when a size_t is compared to a 64-bits integer, an explicit
cast is used to be sure the right type is used.

This patch must be backported as far as 3.0. It must be backported after
1ef74fc7c ("BUG/MEDIUM: mux_h1: fix stack buffer overflow in
h1_append_chunk_size()").
2026-04-29 11:47:37 +02:00
Christopher Faulet
a46b0eec72 BUG/MEDIUM: h1: Enforce the authority validation during H1 request parsing
When a H1 request was parsed, only a light validation was performed on the
URI, mainly because there was no distinction between the different parts of
the URI. So only characters in the range [0x21, 0x7e], excluding the "#" was
allowed.

To be consistant with the H2 and H3 parser, the authority is now validated,
using http_authority_has_forbidden_char() function.

This patch should be backported as far as 2.8. For previous verions,
http_authority_has_forbidden_char() function does not exist.
2026-04-29 10:03:39 +02:00
Christopher Faulet
b743b566b4 BUG/MAJOR: http: forbid comma character in authority value
Strictly speaking, the comma character in authority is allowed by RFC3986.
However, it is pretty ambiguous for Host header value because comma is also
the value separator for headers supporting multiple value. It is also very
unlikely to have comma in host header value or authority. So instead of
dealing with this case with all the risks of bugs that this entails, we've
decided to forbid the comma in authority and host header value during the
parsing. Concretely, only http_authority_has_forbidden_char() was updated.

The internal API was not updated to prevent comma to be inserted when the
host header value is updated for instance. But this should be so uncommon
that it is not really a concern.

This patch should be backported as far as 2.8. For previous verions,
http_authority_has_forbidden_char() function does not exist.
2026-04-29 10:03:39 +02:00
Christopher Faulet
dd92232012 MEDIUM: http-htx: Make authority update optional when adding a header
This patch is similar to the previous one but for header addtion. It is now
possible to skip the authority updated. An extra argument was added to
http_add_header() function for this purpose.
2026-04-29 10:03:39 +02:00
Christopher Faulet
9368f4eaa2 MEDIUM: http-htx: Make authority update optional when replacing a header value
When a header value is replaced, a test is performed to verify if the
authority must be updated or not. But there are some places where we know it
is useless. First, when the caller know the header is not the host
header. Then when the host header value is updated because the authority was
changed.

So now, an extra argument was added to http_replace_header() and
http_replace_header_value() functions to specify if the authority update
must be performed or not.
2026-04-29 10:03:39 +02:00
Christopher Faulet
8d2ea3c1ce BUG/MEDIUM: http-htx: Loop on full host value during scheme based normalization
During scheme based normalization, when the authority is normalized, the
host headers are updated accordingly. Only full host header values must be
updated. Comma-separated list are not expected here.

It is important to do so to be consistant with other places where the host
header is updated (when the request URI is changed for instance).
2026-04-29 10:03:39 +02:00
Christopher Faulet
632b54ebfc BUG/MEDIUM: http-htx: Don't use data from HTX message to update authority
When a host header value is updated, the authority can also be updated
accordingly. When it is performed, we must not use the new host header value
from the HTX message. Instead we must use the data passed as argument. It is
unexpected but the host header can have several comma-separated values.
Using the full header value can lead to unexpected result.

Note: having multiple comma-separated values for the host header should not
      be supported. The comma should be part of the host value. But it is
      quite ambiguous. This will be fixed in another commit.

This patch must be backported to all stable versions.
2026-04-29 10:03:39 +02:00
Christopher Faulet
48afa73af8 BUG/MAJOR: http-htx: Store new host in a chunk for scheme-based normalization
During the scheme based normalization, The original authority value is used
to replace every host headers. It is an issue, because when the HTX message
is modified the blocks may be reorganised to find free space. For instance a
defragmentation can be performed. So the address of the authority can
change. To perform such rewrite, the new value must be stored in a temporary
buffer. It is especially important because the start-line is also updated,
so the original authority could be moved, making it invalid.

Because of this bug, it is possible to mix HTX block values. There is no
overflow but the start-line can be crushed with data from the host header
value, making it invalid for the server.

So, to fix the issue, the new host header value is now the one in the trash
chunk used to rewrite the start line. But in that case, the trash chunk must
be allocated to be sure it remains valid when replacing all host headers
values.

This patch must be backported as far as 2.6.
2026-04-29 10:03:26 +02:00
Tim Duesterhus
213ee17119 CLEANUP: Reapply ha_free.cocci (2)
This reapplies ha_free.cocci across the whole src/ tree.
2026-04-29 04:39:12 +02:00
Tim Duesterhus
0bf844aaca CLEANUP: Reapply strcmp.cocci (3)
This reapplies strcmp.cocci across the whole src/ tree.
2026-04-29 04:39:12 +02:00
Tim Duesterhus
0a1d9e4551 CLEANUP: Reapply ist.cocci (4)
This reapplies ist.cocci across the whole src/ tree.
2026-04-29 04:39:12 +02:00
William Lallemand
29b974fc4e BUILD: 51d: fix bool definition on dummy lib v4
Modern compiler breaks when defining bool, false and true.
Include <stdbool.h> instead.

$ make -j$(nproc) TARGET=linux-glibc USE_51DEGREES=1 \
   51DEGREES_VER=4 51DEGREES_SRC=addons/51degrees/dummy/v4hash/
2026-04-28 18:12:35 +02:00
Amaury Denoyelle
4bffea8579 BUG/MINOR: mux_quic: free frames emitted with QMux
When using QUIC, mux instantiates quic_frame objects but does not free
them. This is performed only when acknowledgment are received.

This is not the case for QMux protocol, as the transport layer is much
simpler in this case. As such, mux is responsible to free up the frames
after emission.

This patch fixes qcc_qstrm_send_frames() by adding the necessary
qc_frm_free() calls as soon as a frame is emitted. This fixes a memory
leak. This function ensures that the freed object is removed from its
parent list, so LIST_DEL_INIT() is not necessary anymore.

No need to backport.
2026-04-28 15:59:28 +02:00
Amaury Denoyelle
4449323464 MINOR: mux_quic: remove superfluous b_size() before b_alloc()
b_alloc() does nothing if a buffer is already allocated. As such, it is
not necessary to call b_size() as a check prior to it. Removes its usage
in qcc_qstrm_recv() so that the code is similar to other b_alloc()
usages.
2026-04-28 15:59:28 +02:00
Maxime Henrion
194bad6aaf MINOR: lb: cleanups
Remove exports for functions that are not called directly anymore, and
make them static. This involves some reordering to avoid the need for a
forward static declaration.

Also remove the old callback fields from the lbprm struct.
2026-04-28 15:31:51 +02:00
Maxime Henrion
583a947123 MEDIUM: lb: use the LB ops tables
Remove manual initialization of the callbacks and use the ops field in
the lbprm struct to invoke those callbacks.
2026-04-28 15:31:51 +02:00
Maxime Henrion
16a4de0d5c MINOR: lb: infrastructure for declarative initialization
This creates an ops structure for the various callbacks into the LB
algorithms, and defines those ops structure for each algorithm. A new
proxy_init callback is added for the initialization functions called
from proxy_finalize(). Since one of them needs to return an int in case
of an error, we change all the others to also return an int so we have a
uniform type.

No functional changes.
2026-04-28 15:31:51 +02:00
Willy Tarreau
5ddba59a02 BUG/MINOR: http_ana: use scf to report term_evts in http_wait_for_request()
http_wait_for_request() improperly reports term events on the scb instead
of scf, causing some request parsing failures to possibly be reported as
response errors. This was introduced in 3.2 with commit 2dc02f75b1 ("MEDIUM:
tevt/stconn/stream: Add dedicated termination events for stream location")
so it must be backported there.
2026-04-27 18:58:51 +02:00
Willy Tarreau
1ef74fc7ce BUG/MEDIUM: mux_h1: fix stack buffer overflow in h1_append_chunk_size()
The char tmp[10] buffer can only hold 8 hex digits + CRLF suffix. If chksz
exceeds 4GB (0xFFFFFFFF), the do-while loop writes more than 8 hex digits,
overflowing the stack buffer by 1+ bytes. In practice the buffer is aligned
from the end and leaves a 6-byte hole before it on 64-bit systems, leaving
enough room to be harmless, and 4 on 32-bit platforms which save it from
touching lower variables. So it is safe but just by luck.

Fix by increasing tmp[] to 18 bytes, sufficient for up to 16 hex digits
(2^64 - 1) plus CRLF.
2026-04-27 18:58:51 +02:00
Amaury Denoyelle
5160b84c7a MINOR: mux_quic/h3: report termination events at stream layer
This patch adds termination level on QUIC MUX at the stream layer.
Similarly to the previous patch, error codes should be similar to the
ones already used in H2.

Most of the values are reported via qcc_reset_stream() which have now an
extra argument for this. This is used by application protocol H3 and
hq-interop.

qmux_sctl() callback is extended to support MUX_SCTL_TEVTS to report the
current stream termination event at the upper layer.
2026-04-27 15:02:58 +02:00
Amaury Denoyelle
f8a1d24e31 MINOR: mux_quic/h3: report termination events at connection level
Implement termination event log in QUIC MUX layer at the connection
level. The objective is to reuse similar codes already used on H2.

Most of the error values are reported via qcc_set_error() which have now
an extra argument to specify the term event code. This is in particular
used in H3 application protocol code.

Also, qmux_ctl() now implements MUX_CTL_TEVTS to report the current
connection termination code to the upper layer. Callback qmux_sctl()
display the connection term event code on MUX_SCTL_DBG_STR.
2026-04-27 15:02:58 +02:00
Amaury Denoyelle
ca8d1cc84d MINOR: mux_quic: display QCS sd on traces
Add SD pointer and flags value when logging a QCS instance in
qmux_dump_qcs_info(). This changes output for bot htraces and
MUX_SCTL_DBG_STR.
2026-04-27 15:02:58 +02:00
Amaury Denoyelle
0da40e272c MINOR: mux_quic: return conn error code in debug string
Similarly to H2, mux_quic now returns connection error code when stream
debug string is retrieved via MUX_SCTL_DBG_STR operation.
2026-04-27 15:02:58 +02:00
Willy Tarreau
f8385ef165 CLEANUP: tree-wide: fix around 20 mistakes in comments in h2,tools,peers
This cleans up around 12 non-visible typos in h2 and mux-h2, 6 in peers,
3 in tools, and also addresses a leftover after commit 9294e8822f in 2.4
which changed the word fingerprint calculation without updating the
comment about the possible output values. No backport needed.
2026-04-27 14:47:39 +02:00
Willy Tarreau
14a113472d CLEANUP: mux-h2: remove duplicate forward declaration of h2s_rxbuf_{head,tail}()
These were strangely committed together with commit e4cb0ad632 ("MINOR:
mux-h2/traces: add buffer-related info to h2s and h2c").
2026-04-27 14:44:29 +02:00
Willy Tarreau
4527620b09 CLEANUP: tools: drop upper case check after tolower()
In update_word_fingerprint_with_len() we convert a character to lower
case, then it's checked against lower case, upper case and digits. Let's
just drop the upper case check which cannot happen.
2026-04-27 14:44:29 +02:00
Willy Tarreau
5efaece577 CLEANUP: peers: fix a few user-visible spelling mistakes
Just a few "leason" and "messafe" in traces. This can be backported.
2026-04-27 14:44:29 +02:00
Willy Tarreau
0aabd1cfeb BUG/MINOR: peers: fix wrong flag reported twice for dump_flags
Flag PEERS_F_DBG_RESYNC_REMOTEASSIGN was missing and
PEERS_F_DBG_RESYNC_REMOTEABORT appeared twice instead, so the former
would not appear in flags dumps. This can be backported to 3.0.0.
2026-04-27 14:44:29 +02:00
Willy Tarreau
24914b67b7 BUG/MINOR: peers: fix logical "and" when checking for local in PEER_APP_ST_STARTING
The expression to check both peer->local and appctx_is_back() uses a
bitwise '&' instead of a logical '&&'. Fortunately both values are
always either 0 or 1 so there is no impact. This can be backported to
all stable versions.
2026-04-27 14:44:29 +02:00
Willy Tarreau
25c8d7b094 BUG/MINOR: sample: fix NULL strm dereference in sample_conv_when
Several cases in sample_conv_when (FORWARDED, TOAPPLET, PROCESSED, ACL)
access smp->strm->scb without checking if strm is NULL. The strm field
may be NULL (e.g., tcp-request connection). Let's add NULL checks to
prevent dereferencing a NULL pointer.

This should be backported to 3.1.
2026-04-27 14:44:29 +02:00
Willy Tarreau
7465b5ec38 BUG/MINOR: sample: fix memory leak in smp_resolve_args error paths
Several error paths in smp_resolve_args used 'continue' which skipped
LIST_DELETE and free(cur), leaking the arg_list node. Changed all to
'break' to ensure proper cleanup on all error paths. This is harmless
since when such issues are met, the process refuses to start, so no
backport is really needed.
2026-04-27 14:44:29 +02:00
Willy Tarreau
a4f27d96c6 BUG/MINOR: sample: fix memory leak in check_when_cond() when ACL is not found
When find_acl_by_name() and find_acl_default() both fail when parsing
converter "when(ACL,foo)", the previously allocated acl_sample struct
is leaked. Free it before returning 0. This can be backported to stable
versions.
2026-04-27 14:44:29 +02:00
Willy Tarreau
eb97e21a8f BUG/MINOR: tools: free previously allocated strings on strdup failure in backup_env()
When strdup() fails after some entries have already been strdup'd, the function
returned -1 without freeing previously allocated strings. Added cleanup loop to
free all previously strdup'd entries and reset init_env.

This can be backported to 3.1.
2026-04-27 14:44:29 +02:00
Willy Tarreau
d5efce7a13 BUG/MINOR: tools: fix memory leak in indent_msg() on out of memory
When malloc() fails in indent_msg, the function returned NULL without
freeing the original *out string as it was supposed to. The caller loses
both the original string (leaked) and gets NULL back. Fixed to free *out
and set it to NULL before returning.
2026-04-27 14:44:29 +02:00
Willy Tarreau
84cb8dd126 BUG/MINOR: tools: my_memspn/my_memcspn wrong cast causing incorrect byte reading
Both functions cast void * to int * and dereference, reading 4 bytes as an
integer instead of a single byte. This is passed to memchr() which expects a
byte value. On unaligned addresses this causes crashes on ARM/mips etc, and
search for the wrong byte on big endian platforms. Fixed to cast to
const unsigned char * and dereference a single byte. This is marked as
minor because these functions were added in 2.2 by commit 5eb96cbcbc
("MINOR: standard: Add my_memspn and my_memcspn") and have not been used
since then.
2026-04-27 14:44:29 +02:00
Willy Tarreau
c6600d7835 CLEANUP: tree-wide: address various spelling mistakes in comments from -dev7
These ones were found in recent patches merged since -dev7. There is no
user-visible change so no backport is needed.
2026-04-27 10:50:12 +02:00
Willy Tarreau
61e843a0b4 BUG/MINOR: tree-wide: fix a few user-visible spelling mistakes from dev7
These spelling mistakes in documentation, traces or error messages
were introduced after -dev7. Some might possibly deserve being
backported.
2026-04-27 10:49:51 +02:00
Willy Tarreau
0522264eb4 BUG/MINOR: ssl: fix double-free on failed realloc in ssl_sock.c
Recent commit 90bfbea7c0 ("BUG/MINOR: ssl: fix memory leaks on realloc
failure in ssl_sock.c") accidentally turned a memory leak in case of
allocation failure into a double-free: the original pointer must no
longer be released. In addition, the allocated_size has to be reset
in case of failure. This needs to be backported to 3.3 like previous
commit.
2026-04-27 09:15:21 +02:00
Miroslav Zagorac
720b3d1f56 BUILD: ot: emitted deprecation warning at build time
Warn at Makefile parse time that the opentracing filter was deprecated
in haproxy 3.3 and will be removed in 3.5, complementing the runtime
warning emitted at filter init.
2026-04-27 08:23:00 +02:00
Miroslav Zagorac
4f53bbc15c MEDIUM: ot: emitted deprecation warning at filter init
The opentracing filter was deprecated in haproxy 3.3 and will be removed
in 3.5.  A warning is now issued during filter initialization, unless the
global 'expose-deprecated-directives' directive is set.  The notice is
emitted only once regardless of the number of filter instances.
2026-04-27 08:18:58 +02:00
Christopher Faulet
1124968dc1 DOC: config: Fix typo in tune.bufsize.large description
"butes" was used instead of "bytes".

Should fix the issue #3322.
2026-04-27 07:35:08 +02:00
Christopher Faulet
0f7f695b8f DOC: config: Fix log-format example with last rule expressions
%[] were missing.
2026-04-27 07:35:08 +02:00
BiancaDogareci
fa17a50c62 BUG/MINOR: ssl: fix memory leak on realloc failure in acme.ips
Fix a realloc() bug in ckchs_dup() when copying the acme.ips array,
where overwriting the original pointer with NULL on allocation failure
loses reference to the original memory block.

Use my_realloc2() which safely handles the failure.

No backport needed.
2026-04-25 16:12:25 +02:00
Ilia Shipitsin
90bfbea7c0 BUG/MINOR: ssl: fix memory leaks on realloc failure in ssl_sock.c
Replace bare realloc() calls with my_realloc2(), which frees the original
pointer on allocation failure, preventing a memory leak when the pointer
is subsequently overwritten with NULL.

Must be backported to 3.3.
2026-04-25 11:08:31 +02:00
Ilia Shipitsin
0c4b7d7f34 BUG/MINOR: ssl: fix memory leaks on realloc failure in ssl_ckch.c
Replace bare realloc() calls with my_realloc2(), which frees the original
pointer on allocation failure, preventing a memory leak when the pointer
is subsequently overwritten with NULL.

Must be backported to 3.2.
2026-04-25 11:08:21 +02:00
Amaury Denoyelle
352db46b08 BUG/MEDIUM: stats: fix crash on 'dump stats-file'
A crash occurs immediately when stats-file dump is requested by the
command-line. The issue is caused by the introduction of watchers when
iterating over the proxies list, which is now required with dynamic
backends.

  commit 20376c54e2166a0882b71b26326360786f79ebdb
  MINOR: stats: protect proxy iteration via watcher

The above patch initializes the new proxy watcher for stats dump and
HTML. However, this was forgotten for stats-file command context. Fix
this by adding the missing watcher_init() in cli_parse_show_stat().

No need to backport.
2026-04-24 16:04:21 +02:00
Pierre Cheynier
85c3f3c1fd MINOR: sample: converter for frontend existence check
Introduced a new sample converter using keyword "fe_exists" checking if
a frontend with a given name exists.
2026-04-24 15:22:09 +02:00