]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
2 weeks agoMINOR: debug: add thread-cpu bindings info in 'show dev' output
Valentine Krasnobaeva [Thu, 17 Jul 2025 10:05:46 +0000 (12:05 +0200)] 
MINOR: debug: add thread-cpu bindings info in 'show dev' output

Add thread-cpu bindings info in 'show dev' output, as it can be useful for
debugging.

2 weeks agoMINOR: debug: align output style of debug_parse_cli_show_dev with cpu_dump_topology
Valentine Krasnobaeva [Thu, 17 Jul 2025 10:03:47 +0000 (12:03 +0200)] 
MINOR: debug: align output style of debug_parse_cli_show_dev with cpu_dump_topology

Align titles style of debug_parse_cli_show_dev() with
cpu_dump_topology(). We will call the latter inside of
debug_parse_cli_show_dev() to show thread-cpu bindings info.

2 weeks agoMINOR: cpu-topo: write thread-cpu bindings into trash buffer
Valentine Krasnobaeva [Thu, 17 Jul 2025 16:18:20 +0000 (18:18 +0200)] 
MINOR: cpu-topo: write thread-cpu bindings into trash buffer

Write thread-cpu bindings and cluster summary into provided trash buffer.
Like this we can call this function in any place, when this info is needed.

2 weeks agoMINOR: cpu-topo: split cpu_dump_topology() to show its summary in show dev
Valentine Krasnobaeva [Thu, 17 Jul 2025 10:05:33 +0000 (12:05 +0200)] 
MINOR: cpu-topo: split cpu_dump_topology() to show its summary in show dev

cpu_dump_topology() prints details about each enabled CPU and a summary with
clusters info and thread-cpu bindings. The latter is often usefull for
debugging and we want to add it in the 'show dev' output.

So, let's split cpu_dump_topology() in two parts: cpu_topo_debug() to print the
details about each enabled CPU; and cpu_topo_dump_summary() to print only the
summary.

In the next commit we will modify cpu_topo_dump_summary() to write into local
trash buffer and it could be easily called from debug_parse_cli_show_dev().

2 weeks agoBUG/MINOR: halog: exit with error when some output filters are set simultaneosly
Valentine Krasnobaeva [Wed, 16 Jul 2025 12:35:28 +0000 (14:35 +0200)] 
BUG/MINOR: halog: exit with error when some output filters are set simultaneosly

Exit with an error if multiple output filters (-ic, -srv, -st, -tc, -u*, etc.)
are used at the same time.

halog is designed to process and display output for only one filter at a time.
Using multiple filters simultaneously can cause a crash because the program is
not designed to manage multiple, separate result sets (e.g., one for
IP counts, another for URLs).

Supporting simultaneous filters would require a redesign to collect entries for
each filter in separate ebtree. This would negatively impact performance and is
not requested for the moment. This patch prevents the crash by checking filter
combinations just after the command line parsing.

This issue was reported in GitHUB #3031.
This should be backported in all stable versions.

2 weeks agoBUG/MEDIUM: quic-be: CC buffer released from wrong pool
Frederic Lecaille [Thu, 17 Jul 2025 09:27:59 +0000 (11:27 +0200)] 
BUG/MEDIUM: quic-be: CC buffer released from wrong pool

The "connection close state" TX buffer is used to build the datagram with
basically a CONNECTION_CLOSE frame to notify the peer about the connection
closure. It allows the quic_conn memory release and its replacement by a lighter
quic_cc_conn struct.

For the QUIC backend, there is a dedicated pool to build such datagrams from
bigger TX buffers. But from quic_conn_release(), this is the pool dedicated
to the QUIC frontends which was used to release the QUIC backend TX buffers.

This patch simply adds a test about the target of the connection to release
the "connection close state" TX buffers from the correct pool.

No backport needed.

2 weeks agoDOC: connection: explain the rules for idle/safe/avail connections
Willy Tarreau [Wed, 16 Jul 2025 16:52:09 +0000 (18:52 +0200)] 
DOC: connection: explain the rules for idle/safe/avail connections

It's super difficult to find the rules that operate idle conns depending
on their idle/safe/avail/private status. Some are in lists, others not.
Some are in trees, others not. Some have a flag set, others not. This
documents the rules before the definitions in connection-t.h. It could
even be backported to help during backport sessions.

2 weeks agoMINOR: quic: Get rid of qc_is_listener()
Frederic Lecaille [Wed, 16 Jul 2025 14:35:31 +0000 (16:35 +0200)] 
MINOR: quic: Get rid of qc_is_listener()

Replace all calls to qc_is_listener() (resp. !qc_is_listener()) by calls to
objt_listener() (resp. objt_server()).
Remove qc_is_listener() implement and QUIC_FL_CONN_LISTENER the flag it
relied on.

2 weeks agoDEV: gdb: add a memprofile decoder to the debug tools
Willy Tarreau [Wed, 16 Jul 2025 12:42:34 +0000 (14:42 +0200)] 
DEV: gdb: add a memprofile decoder to the debug tools

"memprof_dump" will visit memprofile entries and dump them in a
synthetic format counting allocations/releases count/size, type
and calling address.

2 weeks agoBUG/MINOR: applet: Don't trigger BUG_ON if the tid is not on appctx init
Christopher Faulet [Wed, 16 Jul 2025 09:29:49 +0000 (11:29 +0200)] 
BUG/MINOR: applet: Don't trigger BUG_ON if the tid is not on appctx init

When an appctx is initialized, there is a BUG_ON() to be sure the appctx is
really initialized on the right thread to avoid bugs on the thread
affinity. However, it is possible to not choose the thread when the appctx
is created and let it starts on any thread. In that case, the thread
affinity is set when the appctx is initialized. So, we must take cate to not
trigger the BUG_ON() in that case.

For now, we never hit the bug because the thread affinity is always set
during the appctx creation.

This patch must be backport as far as 2.8.

2 weeks agoMINOR: h3: remove unused outbuf in h3_resp_headers_send()
Amaury Denoyelle [Tue, 15 Jul 2025 16:17:14 +0000 (18:17 +0200)] 
MINOR: h3: remove unused outbuf in h3_resp_headers_send()

Cleanup h3_resp_headers_send() by removing outbuf buffer variable which
is not necessary anymore.

2 weeks agoBUG/MINOR: quic: Wrong source address use on FreeBSD
Frederic Lecaille [Fri, 11 Jul 2025 07:02:22 +0000 (09:02 +0200)] 
BUG/MINOR: quic: Wrong source address use on FreeBSD

The bug is a listener only one, and only occured on FreeBSD.

The FreeBSD issue has been reported here:
https://forums.freebsd.org/threads/quic-http-3-with-haproxy.98443/
where QUIC traces could reveal that sendmsg() calls lead to EINVAL
syscall errnos.

Such a similar issue could be reproduced from a FreeBSD 14-2 VM
with reg-tests/quic/retry.vtc as reg test.

As noted by Olivier, this issue could be fixed within the VM binding
the listener socket to INADDR_ANY.

That said, the symptoms are not exactly the same as the one reporte by the user.
What could be observed from such a VM is that if the first recvmsg() call
returns the datagram destination address, and if the listener
listening address is bound to a specific address, the calls to
sendmsg() fail because of the IP_SENDSRCADDR ip option value
set by cmsg_set_saddr(). According to the ip(4) freebsd manual
such an IP options must be used if the listening socket is
bound to a specific address. It is to be noted that into a VM
the first call to recvmsg() of the first connection does not return the datagram
destination address. This leads the first quic_conn to be initialized without
->local_addr value. This is this value which is used by IP_SENDSRCADDR
ip option. In this case, the sendmsg() calls (without IP_SENDSRCADDR)
never fail. The issue appears at the second condition.

This patch replaces the conditions to use IP_SENDSRCADDR to a call to
qc_may_use_saddr(). This latter also checks that the listener listening
address is not INADDR_ANY to allow the use of the source address.
It is generalized to all the OSes. Indeed, there is no reason to set the source
address when the listener is bound to a specific address.

Must be backported as far as 2.8.

2 weeks agoBUG/MINOR: h3: properly handle interim response on BE side
Amaury Denoyelle [Fri, 11 Jul 2025 14:06:51 +0000 (16:06 +0200)] 
BUG/MINOR: h3: properly handle interim response on BE side

On backend side, H3 layer is responsible to decode a HTTP/3 response
into an HTX message. Multiple responses may be received on a single
stream with interim status codes prior to the final one.

h3_resp_headers_to_htx() is the function used solely on backend side
responsible for H3 response to HTX transcoding. This patch extends it to
be able to properly support interim responses. When such a response is
received, the new flag H3_SF_RECV_INTERIM is set. This is converted to
QMUX qcs flag QC_SF_EOI_SUSPENDED.

The objective of this latter flag is to prevent stream EOI to be
reported during stream rcv_buf callback, even if HTX message contains
EOM and is empty. QC_SF_EOI_SUSPENDED will be cleared when the final
response is finally converted, which unblock stream EOI notification for
next rcv_buf invocations. Note however that HTX EOM is untouched : it is
always set for both interim and final response reception.

As a minor adjustment, HTX_SL_F_BODYLESS is always set for interim
responses.

Contrary to frontend interim response handling, a flag is necessary on
QMUX layer. This is because H3 to HTX transcoding and rcv_buf callback
are two distinct operations, called under different context (MUX vs
stream tasklet).

Also note that H3 layer has two distinct flags for interim response
handling, one only used as a server (FE side) and the other as a client
(BE side). It was preferred to used two distinct flags which is
considered less error-prone, contrary to a single unified flag which
would require to always set the proxy side to ensure it is relevant or
not.

No need to backport.

2 weeks agoBUG/MEDIUM: h3: handle interim response properly on FE side
Amaury Denoyelle [Fri, 11 Jul 2025 12:25:30 +0000 (14:25 +0200)] 
BUG/MEDIUM: h3: handle interim response properly on FE side

On frontend side, HTTP/3 layer is responsible to transcode an HTX
response message into HTTP/3 HEADERS frame. This operations is handled
via h3_resp_headers_send().

Prior to this patch, if HTX EOM was encountered in the HTX message after
response transcoding, <fin> was reported to the QMUX layer. This will in
turn cause FIN stream bit to be set when the response is emitted.
However, this is not correct as a single HTX response can be constitued
of several interim message, each delimited by EOM block.

Most of the time, this bug will cause the client to close the connection
as it is invalid to receive an interim response with FIN bit set.

Fixes this by now properly differentiate interim and final response.
During interim response transcoding, the new flag H3_SF_SENT_INTERIM
will be set, which will prevent <fin> to be reported. Thus, <fin> will
only be notified for the final response.

This must be backported up to 2.6. Note that it relies on the previous
patch which also must be taken.

2 weeks agoMINOR: qmux: change API for snd_buf FIN transmission
Amaury Denoyelle [Thu, 10 Jul 2025 13:27:23 +0000 (15:27 +0200)] 
MINOR: qmux: change API for snd_buf FIN transmission

Previous patches have fixes interim response encoding via
h3_resp_headers_send(). However, it is still necessary to adjust h3
layer state-machine so that several successive HTTP responses are
accepted for a single stream.

Prior to this, QMUX was responsible to decree that the final HTX message
was encoded so that FIN stream can be emitted. However, with interim
response, MUX is in fact unable to properly determine this. As such,
this is the responsibility of the application protocol layer. To reflect
this, app_ops snd_buf callback is modified so that a new output argument
<fin> is added to it.

Note that for now this commit does not bring any functional change.
However, it will be necessary for the following patch. As such, it
should be backported prior to it to every versions as necessary.

2 weeks agoBUG/MINOR: h3: ensure that invalid status code are not encoded (FE side)
Amaury Denoyelle [Tue, 15 Jul 2025 16:15:36 +0000 (18:15 +0200)] 
BUG/MINOR: h3: ensure that invalid status code are not encoded (FE side)

On frontend side, H3 layer transcodes HTX status code into HTTP/3
HEADERS frame. This is done by calling qpack_encode_int_status().

Prior to this patch, the latter function was also responsible to reject
an invalid value, which guarantee that only valid codes are encoded
(between 100 and 999 values). However, this is not practical as it is
impossible to differentiate between an invalid code error and a buffer
room exhaustation.

Changes this so that now HTTP/3 layer first ensures that HTX code is
valid. The stream is closed with H3_INTERNAL_ERROR if invalid value is
present. Thus, qpack_encode_int_status() will only report an error due
to buffer room exhaustion. If a small buffer is used, a standard buffer
will be reallocated which should be sufficient to encode the response.

The impact of this bug is minimal. Its main benefit is code clarity,
while also removing an unnecessary realloc when confronting with an
invalid HTTP code.

This should be backported at least up to 3.1. Prior to it, smallbuf
mechanism isn't present, hence the impact of this patch is less
important. However, it may still be backported to older versions, which
should facilitate picking patches for HTTP 1xx interim response support.

2 weeks agoBUG/MINOR: h3: properly realloc buffer after interim response encoding
Amaury Denoyelle [Tue, 15 Jul 2025 08:59:07 +0000 (10:59 +0200)] 
BUG/MINOR: h3: properly realloc buffer after interim response encoding

Previous commit fixes encoding of several following HTTP response
message when interim status codes are first reported. However,
h3_resp_headers_send() still was unable to interrupt encoding if output
buffer room was not sufficient. This case may be likely because small
buffers are used for headers encoding.

This commit fixes this situation. If output buffer is not empty prior to
response encoding, this means that a previous interim response message
was already encoded before. In this case, and if remaining space is not
sufficient, use buffer release mechanism : this allows to restart
response encoding by using a newer buffer. This process has already been
used for DATA and trailers encoding.

This must be backported up to 2.6. However, note that buffer release
mechanism is not present for version 2.8 and lower. In this case, qcs
flag QC_SF_BLK_MROOM should be enough as a replacement.

2 weeks agoBUG/MEDIUM: h3: do not overwrite interim with final response
Amaury Denoyelle [Tue, 15 Jul 2025 08:58:06 +0000 (10:58 +0200)] 
BUG/MEDIUM: h3: do not overwrite interim with final response

An HTTP response may contain several interim response message prior (1xx
status) to a final response message (all other status codes). This may
cause issues with h3_resp_headers_send() called for response encoding
which assumes that it is only call one time per stream, most notably
during output buffer handling.

This commit fixes output buffer handling when h3_resp_headers_send() is
called multiple times due to an interim response. Prior to it, interim
response was overwritten with newer response message. Most of the time,
this resulted in error for the client due to QPACK decoding failure.
This is now fixed so that each response is encoded one after the other.

Note that if encoding of several responses is bigger than output buffer,
an error is reported. This can definitely occurs as small buffer are
used during header encoding. This situation will be improved by the next
patch.

This must be backported up to 2.6.

2 weeks agoMINOR: debug: report haproxy and operating system info in panic dumps
Willy Tarreau [Tue, 15 Jul 2025 13:21:23 +0000 (15:21 +0200)] 
MINOR: debug: report haproxy and operating system info in panic dumps

The goal is to help figure the OS version (kernel and userland), any
virtualization/containers, and the haproxy version and build features.
Sometimes even reporters themselve can be mistaken about the running
version or environment. Also printing this at the top hepls draw a
visual delimitation between warnings and panic. Now we get something
like this:

  PANIC! Thread 1 is about to kill the process.

  HAProxy info:
    version: 3.3-dev3-c863c0-18
    features: +51DEGREES +ACCEPT4 +BACKTRACE -CLOSEFROM +CPU_AFFINITY (...)

  Operating system info:
    virtual machine: no
    container: no
    kernel: Linux 6.1.131 #1 SMP PREEMPT_DYNAMIC Fri Mar 14 01:04:55 CET 2025 x86_64
    userland: Slackware 15.0 x86_64

  * Thread 1 : id=0x7f615a8775c0 act=1 glob=0 wq=1 rq=0 tl=0 tlsz=0 rqsz=0
        1/1    stuck=0 prof=0 harmless=0 isolated=0
               cpu_ns: poll=1835010197 now=1835066102 diff=55905
               (...)

2 weeks agoMEDIUM: proxy: register a post-section cleanup function
Willy Tarreau [Fri, 11 Jul 2025 06:58:48 +0000 (08:58 +0200)] 
MEDIUM: proxy: register a post-section cleanup function

For listen/frontend/backend, we now want to be able to clean up the
default-server directive that's no longer used past the end of the
section. For this we register a post-section function and perform the
cleanup there.

2 weeks agoMEDIUM: proxy: no longer allocate the default-server entry by default
Willy Tarreau [Fri, 11 Jul 2025 06:40:17 +0000 (08:40 +0200)] 
MEDIUM: proxy: no longer allocate the default-server entry by default

The default-server entry used to always be allocated. Now we'll postpone
its allocation for the first time we need it, i.e. during a "default-server"
directive, or when inheriting a defaults section which has one. The memory
savings are significant, on a large configuration with 100k backends and
no default-server directive, the memory usage dropped from 800MB RSS to
420MB (380 MB saved). It should be possible to also address configs using
default-server by releasing this entry when leaving the proxy section,
which is not done yet.

2 weeks agoMINOR: proxy: add checks for defsrv's validity
Willy Tarreau [Thu, 10 Jul 2025 15:03:13 +0000 (17:03 +0200)] 
MINOR: proxy: add checks for defsrv's validity

Now we only copy the default server's settings if such a default server
exists, otherwise we only initialize it. At the moment it always exists.

The change is mostly performed in srv_settings_cpy() since that's where
each caller passes through, and there's no point duplicating that test
everywhere.

2 weeks agoMEDIUM: proxy: take the defsrv out of the struct proxy
Willy Tarreau [Thu, 10 Jul 2025 14:16:24 +0000 (16:16 +0200)] 
MEDIUM: proxy: take the defsrv out of the struct proxy

The server struct has gone huge over time (~3.8kB), and having a copy
of it in the defsrv section of the struct proxy costs a lot of RAM,
that is not needed anymore at run time.

This patch replaces this struct with a dynamically allocated one. The
field is allocated and initialized during alloc_new_proxy() and is
freed when the proxy is destroyed for now. But the goal will be to
support freeing it after parsing the section.

2 weeks agoCLEANUP: server: be sure never to compare src against a non-existing defsrv
Willy Tarreau [Thu, 10 Jul 2025 14:42:42 +0000 (16:42 +0200)] 
CLEANUP: server: be sure never to compare src against a non-existing defsrv

The test in srv_ssl_settings_cpy() comparing src to the server's proxy's
default server does work but it's a subtle trap. Indeed, no check is made
on srv->proxy to be valid, and this only works because the compiler is
comparing pointer offsets. During the boot, it's common to have NULL here
in srv->proxy and of course in this case srv does not match that value
which is NULL plus epsilon. But when trying to turn defsrv to a dynamic
pointer instead, then the compiler is forced to dereference this NULL
srv->proxy and dies during init.

Let's always add the null check for srv->proxy before the test to avoid
this situation.

No backport is needed since the problem cannot happen yet.

2 weeks agoCLEANUP: stream: use server_find_by_addr() in sticking_rule_find_target()
Willy Tarreau [Thu, 10 Jul 2025 12:47:35 +0000 (14:47 +0200)] 
CLEANUP: stream: use server_find_by_addr() in sticking_rule_find_target()

This makes this function a bit less of a mess by no longer manipulating
the low-level server address nodes nor the proxy lock.

2 weeks agoCLEANUP: server: add server_find_by_addr()
Willy Tarreau [Thu, 10 Jul 2025 12:43:28 +0000 (14:43 +0200)] 
CLEANUP: server: add server_find_by_addr()

Server lookup by address requires locking and manipulation of the tree
from user code. Let's provide server_find_by_addr() which does that for
us.

2 weeks agoCLEANUP: server: simplify server_find_by_id()
Willy Tarreau [Wed, 9 Jul 2025 14:35:27 +0000 (16:35 +0200)] 
CLEANUP: server: simplify server_find_by_id()

At a few places we're seeing some open-coding of the same function, likely
because it looks overkill for what it's supposed to do, due to extraneous
tests that are not needed (e.g. check of the backend's PR_CAP_BE etc).
Let's just remove all these superfluous tests and inline it so that it
feels more suitable for use everywhere it's needed.

2 weeks agoCLEANUP: stream: lookup server ID using standard functions
Willy Tarreau [Wed, 9 Jul 2025 14:20:09 +0000 (16:20 +0200)] 
CLEANUP: stream: lookup server ID using standard functions

The server lookup in sticking_rule_find_target() uses an open-coded tree
search while we have a function for this server_find_by_id(). In addition,
due to the way it's coded, the stick-table lock also covers the server
lookup by accident instead of being released earlier. This is not a real
problem though since such feature is rarely used nowadays.

Let's clean all this stuff by first retrieving the ID under the lock and
then looking up the corresponding server.

2 weeks agoCLEANUP: cfgparse: lookup proxy ID using existing functions
Willy Tarreau [Wed, 9 Jul 2025 14:13:44 +0000 (16:13 +0200)] 
CLEANUP: cfgparse: lookup proxy ID using existing functions

The code used to detect proxy id conflicts uses an open-coded lookup
in the ID tree which is not necessary since we already have functions
for this. Let's switch to that instead.

2 weeks agoCLEANUP: server: use server_find_by_name() where relevant
Willy Tarreau [Thu, 10 Jul 2025 09:10:36 +0000 (11:10 +0200)] 
CLEANUP: server: use server_find_by_name() where relevant

Instead of open-coding a tree lookup, in sticking rules and server_find(),
let's just rely on server_find_by_name() which now does exactly the same.

2 weeks agoCLEANUP: server: rename findserver() to server_find_by_name()
Willy Tarreau [Thu, 10 Jul 2025 09:07:51 +0000 (11:07 +0200)] 
CLEANUP: server: rename findserver() to server_find_by_name()

Now it's more logical and matches what is done in the rest of these
functions. server_find() now relies on it.

2 weeks agoCLEANUP: server: rename server_find_by_name() to server_find()
Willy Tarreau [Thu, 10 Jul 2025 08:59:06 +0000 (10:59 +0200)] 
CLEANUP: server: rename server_find_by_name() to server_find()

This function doesn't just look at the name but also the ID when the
argument starts with a '#'. So the name is not correct and explains
why this function is not always used when the name only is needed,
and why the list-based findserver() is used instead. So let's just
call the function "server_find()", and rename its generation-id based
cousin "server_find_unique()".

2 weeks agoMINOR: server: use the tree to look up the server name in findserver()
Willy Tarreau [Thu, 10 Jul 2025 09:06:41 +0000 (11:06 +0200)] 
MINOR: server: use the tree to look up the server name in findserver()

Let's just use the tree-based lookup instead of walking through the list.
This function is used to find duplicates in "track" statements and a few
such places, so it's important not to waste too much time on large setups.

2 weeks agoREORG: server: move findserver() from proxy.c to server.c
Willy Tarreau [Thu, 10 Jul 2025 08:56:34 +0000 (10:56 +0200)] 
REORG: server: move findserver() from proxy.c to server.c

The reason this function was overlooked is that it had mostly equivalent
ones in server.c, let's move them together.

2 weeks agoCLEANUP: server: do not check for duplicates anymore in findserver()
Willy Tarreau [Thu, 10 Jul 2025 08:48:05 +0000 (10:48 +0200)] 
CLEANUP: server: do not check for duplicates anymore in findserver()

findserver() used to check for duplicate server names. These are no
longer accepted in 3.3 so let's get rid of that test and simplify the
code. Note that the function still only uses the list instead of the
tree.

3 weeks ago[RELEASE] Released version 3.3-dev3 v3.3-dev3
Willy Tarreau [Fri, 11 Jul 2025 14:45:50 +0000 (16:45 +0200)] 
[RELEASE] Released version 3.3-dev3

Released version 3.3-dev3 with the following main changes :
    - BUG/MINOR: quic-be: Wrong retry_source_connection_id check
    - MEDIUM: sink: change the sink mode type to PR_MODE_SYSLOG
    - MEDIUM: server: move _srv_check_proxy_mode() checks from server init to finalize
    - MINOR: server: move send-proxy* incompatibility check in _srv_check_proxy_mode()
    - MINOR: mailers: warn if mailers are configured but not actually used
    - BUG/MEDIUM: counters/server: fix server and proxy last_change mixup
    - MEDIUM: server: add and use a separate last_change variable for internal use
    - MEDIUM: proxy: add and use a separate last_change variable for internal use
    - MINOR: counters: rename last_change counter to last_state_change
    - MINOR: ssl: check TLS1.3 ciphersuites again in clienthello with recent AWS-LC
    - BUG/MEDIUM: hlua: Forbid any L6/L7 sample fetche functions from lua services
    - BUG/MEDIUM: mux-h2: Properly handle connection error during preface sending
    - BUG/MINOR: jwt: Copy input and parameters in dedicated buffers in jwt_verify converter
    - DOC: Fix 'jwt_verify' converter doc
    - MINOR: jwt: Rename pkey to pubkey in jwt_cert_tree_entry struct
    - MINOR: jwt: Remove unused parameter in convert_ecdsa_sig
    - MAJOR: jwt: Allow certificate instead of public key in jwt_verify converter
    - MINOR: ssl: Allow 'commit ssl cert' with no privkey
    - MINOR: ssl: Prevent delete on certificate used by jwt_verify
    - REGTESTS: jwt: Add test with actual certificate passed to jwt_verify
    - REGTESTS: jwt: Test update of certificate used in jwt_verify
    - DOC: 'jwt_verify' converter now supports certificates
    - REGTESTS: restrict execution to a single thread group
    - MINOR: ssl: Introduce new smp_client_hello_parse() function
    - MEDIUM: stats: add persistent state to typed output format
    - BUG/MINOR: httpclient: wrongly named httpproxy flag
    - MINOR: ssl/ocsp: stop using the flags from the httpclient CLI
    - MEDIUM: httpclient: split the CLI from the actual httpclient API
    - MEDIUM: httpclient: implement a way to use directly htx data
    - MINOR: httpclient/cli: add --htx option
    - BUILD: dev/phash: remove the accidentally committed a.out file
    - BUG/MINOR: ssl: crash in ssl_sock_io_cb() with SSL traces and idle connections
    - BUILD/MEDIUM: deviceatlas: fix when installed in custom locations.
    - DOC: deviceatlas build clarifications
    - BUG/MINOR: ssl/ocsp: fix definition discrepancies with ocsp_update_init()
    - MINOR: proto-tcp: Add support for TCP MD5 signature for listeners and servers
    - BUILD: cfgparse-tcp: Add _GNU_SOURCE for TCP_MD5SIG_MAXKEYLEN
    - BUG/MINOR: proto-tcp: Take care to initialized tcp_md5sig structure
    - BUG/MINOR: http-act: Fix parsing of the expression argument for pause action
    - MEDIUM: httpclient: add a Content-Length when the payload is known
    - CLEANUP: ssl: Rename ssl_trace-t.h to ssl_trace.h
    - MINOR: pattern: add a counter of added/freed patterns
    - CI: set DEBUG_STRICT=2 for coverity scan
    - CI: enable USE_QUIC=1 for OpenSSL versions >= 3.5.0
    - CI: github: add an OpenSSL 3.5.0 job
    - CI: github: update the stable CI to ubuntu-24.04
    - BUG/MEDIUM: quic: SSL/TCP handshake failures with OpenSSL 3.5
    - CI: github: update to OpenSSL 3.5.1
    - BUG/MINOR: quic: Missing TLS 1.3 QUIC cipher suites and groups inits (OpenSSL 3.5 QUIC API)
    - BUG/MINOR: quic-be: Malformed coalesced Initial packets
    - MINOR: quic: Prevent QUIC backend use with the OpenSSL QUIC compatibility module (USE_OPENSS_COMPAT)
    - MINOR: reg-tests: first QUIC+H3 reg tests (QUIC address validation)
    - MINOR: quic-be: Set the backend alpn if not set by conf
    - MINOR: quic-be: TLS version restriction to 1.3
    - MINOR: cfgparse: enforce QUIC MUX compat on server line
    - MINOR: server: support QUIC for dynamic servers
    - CI: github: skip a ssl library version when latest is already in the list
    - MEDIUM: resolvers: switch dns-accept-family to "auto" by default
    - BUG/MINOR: resolvers: don't lower the case of binary DNS format
    - MINOR: resolvers: do not duplicate the hostname_dn field
    - MINOR: proto-tcp: Register a feature to report TCP MD5 signature support
    - BUG/MINOR: listener: really assign distinct IDs to shards
    - MINOR: quic: Prevent QUIC build with OpenSSL 3.5 new QUIC API version < 3.5.1
    - BUG/MEDIUM: quic: Crash after QUIC server callbacks restoration (OpenSSL 3.5)
    - REGTESTS: use two haproxy instances to distinguish the QUIC traces
    - BUG/MEDIUM: http-client: Don't wake http-client applet if nothing was xferred
    - BUG/MEDIUM: http-client: Properly inc input data when HTX blocks are xferred
    - BUG/MEDIUM: http-client: Ask for more room when request data cannot be xferred
    - BUG/MEDIUM: http-client: Test HTX_FL_EOM flag before commiting the HTX buffer
    - BUG/MINOR: http-client: Ignore 1XX interim responses in non-HTX mode
    - BUG/MINOR: http-client: Reject any 101-switching-protocols response
    - BUG/MEDIUM: http-client: Drain the request if an early response is received
    - BUG/MEDIUM: http-client: Notify applet has more data to deliver until the EOM
    - BUG/MINOR: h3: fix https scheme request encoding for BE side
    - MINOR: h1-htx: Add function to format an HTX message in its H1 representation
    - BUG/MINOR: mux-h1: Use configured error files if possible for early H1 errors
    - BUG/MINOR: h1-htx: Don't forget to init flags in h1_format_htx_msg function
    - CLEANUP: assorted typo fixes in the code, commits and doc
    - BUILD: adjust scripts/build-ssl.sh to modern CMake system of QuicTLS
    - MINOR: debug: add distro name and version in postmortem

3 weeks agoMINOR: debug: add distro name and version in postmortem
Valentine Krasnobaeva [Thu, 10 Jul 2025 08:59:57 +0000 (10:59 +0200)] 
MINOR: debug: add distro name and version in postmortem

Since 2012, systemd compliant distributions contain
/etc/os-release file. This file has some standardized format, see details at
https://www.freedesktop.org/software/systemd/man/latest/os-release.html.

Let's read it in feed_post_mortem_linux() to gather more info about the
distribution.

(cherry picked from commit f1594c41368baf8f60737b229e4359fa7e1289a9)
Signed-off-by: Willy Tarreau <w@1wt.eu>
3 weeks agoBUILD: adjust scripts/build-ssl.sh to modern CMake system of QuicTLS
Ilia Shipitsin [Thu, 10 Jul 2025 18:12:35 +0000 (20:12 +0200)] 
BUILD: adjust scripts/build-ssl.sh to modern CMake system of QuicTLS

QuicTLS in master branch has migrated to CMake, let's adopt script to
it. Previous OpenSSL+QuicTLS patch is built as usual.

3 weeks agoCLEANUP: assorted typo fixes in the code, commits and doc
Ilia Shipitsin [Wed, 9 Jul 2025 19:05:55 +0000 (21:05 +0200)] 
CLEANUP: assorted typo fixes in the code, commits and doc

Corrected various spelling and phrasing errors to improve clarity and consistency.

3 weeks agoBUG/MINOR: h1-htx: Don't forget to init flags in h1_format_htx_msg function
Christopher Faulet [Thu, 10 Jul 2025 12:10:41 +0000 (14:10 +0200)] 
BUG/MINOR: h1-htx: Don't forget to init flags in h1_format_htx_msg function

The regression was introduced by commit 187ae28 ("MINOR: h1-htx: Add
function to format an HTX message in its H1 representation"). We must be
sure the flags variable must be initialized in h1_format_htx_msg() function.

This patch must be backported with the commit above.

3 weeks agoBUG/MINOR: mux-h1: Use configured error files if possible for early H1 errors
Christopher Faulet [Thu, 10 Jul 2025 08:10:37 +0000 (10:10 +0200)] 
BUG/MINOR: mux-h1: Use configured error files if possible for early H1 errors

The H1 multiplexer is able to produce some errors on its own to report early
errors, before the stream is created. In that case, the error files of the
proxy were tested to detect empty files (or /dev/null) but they were not
used to produce the error itself.

But the documentation states that configured error files are used in all
cases. And in fact, it is not really a problem to use these files. We must
just format a full HTX message. Thanks to the previous patch, it is now
possible.

This patch should fix the issue #3032. It should be backported to 3.2. For
older versions, it must be discussed but it should be quite easy to do.

3 weeks agoMINOR: h1-htx: Add function to format an HTX message in its H1 representation
Christopher Faulet [Thu, 10 Jul 2025 08:06:13 +0000 (10:06 +0200)] 
MINOR: h1-htx: Add function to format an HTX message in its H1 representation

The function h1_format_htx_msg() can now be used to convert a valid HTX
message in its H1 representation. No validity test is performed, the HTX
message must be valid. Only trailers are silently ignored if the message is
not chunked. In addition, the destination buffer must be empty. 1XX interim
responses should be supported. But again, there is no validity tests.

3 weeks agoBUG/MINOR: h3: fix https scheme request encoding for BE side
Amaury Denoyelle [Wed, 9 Jul 2025 15:30:29 +0000 (17:30 +0200)] 
BUG/MINOR: h3: fix https scheme request encoding for BE side

An HTTP/3 request must contains :scheme pseudo-header. Currently, only
"https" value is expected due to QUIC transport layer in use.

However, https value is incorrectly encoded due to a QPACK index value
mismatch in qpack_encode_scheme(). Fix it to ensure that scheme is now
properly set for HTTP/3 requests on the backend side.

No need to backport this.

3 weeks agoBUG/MEDIUM: http-client: Notify applet has more data to deliver until the EOM
Christopher Faulet [Wed, 9 Jul 2025 13:20:41 +0000 (15:20 +0200)] 
BUG/MEDIUM: http-client: Notify applet has more data to deliver until the EOM

When we leave the I/O handler with an unfinished request, we must report the
applet has more data to deliver. Otherwise, when the channel request buffer
is emptied, the http-client applet is not always woken up to forward the
remaining request data.

This issue was probably revealed by commit "BUG/MEDIUM: http-client: Don't
wake http-client applet if nothing was xferred". It is only an issue with
large POSTs, when the payload is streamed.

This patch must be backported as far as 2.6 with the commit above. But on
older versions, the applet API may differ. So be careful.

3 weeks agoBUG/MEDIUM: http-client: Drain the request if an early response is received
Christopher Faulet [Tue, 8 Jul 2025 06:45:10 +0000 (08:45 +0200)] 
BUG/MEDIUM: http-client: Drain the request if an early response is received

When a large request is sent, it is possible to have a response before the
end of the request. It is valid from HTTP perspective but it is an issue
with the current design of the http-client. Indded, the request and the
response are handled sequentially. So the response will be blocked, waiting
for the end of the request. Most of time, it is not an issue, except when
the request transfer is blocked. In that case, the applet is blocked.

With the current API, it is not possible to handle early response and
continue the request transfer. So, this case cannot be handle. In that case,
it seems reasonnable to drain the request if a response is received. This
way, the request transfer, from the caller point of view, is never blocked
and the response can be properly processed.

To do so, the action flag HTTPCLIENT_FA_DRAIN_REQ is added to the
http-client. When it is set, the request payload is just dropped. In that
case, we take care to not report the end of input to properly report the
request was truncated, especially in logs.

It is only an issue with large POSTs, when the payload is streamed.

This patch must be backported as far as 2.6.

3 weeks agoBUG/MINOR: http-client: Reject any 101-switching-protocols response
Christopher Faulet [Tue, 8 Jul 2025 06:57:16 +0000 (08:57 +0200)] 
BUG/MINOR: http-client: Reject any 101-switching-protocols response

Protocol updages are not supported by the http-client. So report an error is
a 101-switching-protocols response is received. Of course, it is unexpected
because the API is not designed to support upgrades. But it is better to
properly handle this case.

This patch could be backported as far as 2.6. It depends on the commit
"BUG/MINOR: http-client: Ignore 1XX interim responses in non-HTX mode".

3 weeks agoBUG/MINOR: http-client: Ignore 1XX interim responses in non-HTX mode
Christopher Faulet [Tue, 8 Jul 2025 06:38:31 +0000 (08:38 +0200)] 
BUG/MINOR: http-client: Ignore 1XX interim responses in non-HTX mode

When the response is re-formatted in raw message, the 1XX interim responses
must be skipped. Otherwise, information of the first interim response will
be saved (status line and headers) and those from the final response will be
dropped.

Note that for now, in HTX-mode, the interim messages are removed.

This patch must be backported as far as 2.6.

3 weeks agoBUG/MEDIUM: http-client: Test HTX_FL_EOM flag before commiting the HTX buffer
Christopher Faulet [Tue, 8 Jul 2025 06:24:45 +0000 (08:24 +0200)] 
BUG/MEDIUM: http-client: Test HTX_FL_EOM flag before commiting the HTX buffer

when htx_to_buf() function is called, if the HTX message is empty, the
buffer is reset. So HTX flags must not be tested after because the info may
be lost.

So now, we take care to test HTX_FL_EOM flag before calling htx_to_buf().

This patch must be backported as far as 2.8.

3 weeks agoBUG/MEDIUM: http-client: Ask for more room when request data cannot be xferred
Christopher Faulet [Tue, 8 Jul 2025 06:17:49 +0000 (08:17 +0200)] 
BUG/MEDIUM: http-client: Ask for more room when request data cannot be xferred

When the request payload cannot be xferred to the channel because its buffer
is full, we must request for more room by calling sc_need_room(). It is
important to be sure the httpclient applet will not be woken up in loop to
push more data while it is not possible.

It is only an issue with large POSTs, when the payload is streamed.

This patch must be backported as far as 2.6. Note that on 2.6,
sc_need_room() only takes one argument.

3 weeks agoBUG/MEDIUM: http-client: Properly inc input data when HTX blocks are xferred
Christopher Faulet [Tue, 8 Jul 2025 06:04:01 +0000 (08:04 +0200)] 
BUG/MEDIUM: http-client: Properly inc input data when HTX blocks are xferred

When HTX blocks from the requests are transferred into the channel buffer,
the return value of htx_xfer_blks() function must not be used to increment
the channel input value because meta data are counted here while they are
not part of input data. Because of this bug, it is possible to forward more
data than these present in the channel buffer.

Instead, we look at the input data before and after the transfer and the
difference is added.

It is only an issue with large POSTs, when the payload is streamed.

This patch must be backported as far as 2.6.

3 weeks agoBUG/MEDIUM: http-client: Don't wake http-client applet if nothing was xferred
Christopher Faulet [Tue, 8 Jul 2025 05:46:26 +0000 (07:46 +0200)] 
BUG/MEDIUM: http-client: Don't wake http-client applet if nothing was xferred

When data are transferred to or from the htt-pclient, the applet is
systematically woken up, even when no data are transferred. This could lead
to needlessly wakeups. When called from a lua script, if data are blocked
for a while, this leads to a wakeup ping-pong loop where the http-client
applet is woken up by the lua script which wakes back the script.

To fix the issue, in httpclient_req_xfer() and httpclient_res_xfer()
functions, we now take care to not wake the http-client applet up when no
data are transferred.

This patch must be backported as far as 2.6.

3 weeks agoREGTESTS: use two haproxy instances to distinguish the QUIC traces
Frederic Lecaille [Tue, 8 Jul 2025 17:47:39 +0000 (19:47 +0200)] 
REGTESTS: use two haproxy instances to distinguish the QUIC traces

The aim of this patch is to identify the QUIC traces between the QUIC frontend
and backend parts. Two haproxy instances are created. The c(1|2) http clients
connect to ha1 with TCP frontends and QUIC backends. ha2 embeds two QUIC listeners
with s1 as TCP backend. When the traces are activated, they are dumped to stderr.
Hopefully, they are prefixed by the haproxy instance name (h1 or h2). This is very
useful to identify the QUIC instances.

3 weeks agoBUG/MEDIUM: quic: Crash after QUIC server callbacks restoration (OpenSSL 3.5)
Frederic Lecaille [Wed, 9 Jul 2025 09:43:02 +0000 (11:43 +0200)] 
BUG/MEDIUM: quic: Crash after QUIC server callbacks restoration (OpenSSL 3.5)

Revert this patch which is no more useful since OpenSSL 3.5.1 to remove the
QUIC server callback restoration after SSL context switch:

    MINOR: quic: OpenSSL 3.5 internal QUIC custom extension for transport parameters reset

It was required for 3.5.0. That said, there was no CI for OpenSSL 3.5 at the date
of this commit. The CI recently revealed that the QUIC server side could crash
during QUIC reg tests just after having restored the callbacks as implemented by
the commit above.

Also revert this commit which is no more useful because it arrived with the commit
above:

BUG/MEDIUM: quic: SSL/TCP handshake failures with OpenSSL 3.

Must be backported to 3.2.

3 weeks agoMINOR: quic: Prevent QUIC build with OpenSSL 3.5 new QUIC API version < 3.5.1
Frederic Lecaille [Wed, 9 Jul 2025 12:31:36 +0000 (14:31 +0200)] 
MINOR: quic: Prevent QUIC build with OpenSSL 3.5 new QUIC API version < 3.5.1

The QUIC listener part was impacted by the 3.5.0 OpenSSL new QUIC API with several
issues which have been fixed by 3.5.1.

Add a #error to prevent such OpenSSL 3.5 new QUIC API use with version below 3.5.1.

Must be backported to 3.2.

3 weeks agoBUG/MINOR: listener: really assign distinct IDs to shards
Willy Tarreau [Wed, 9 Jul 2025 13:52:33 +0000 (15:52 +0200)] 
BUG/MINOR: listener: really assign distinct IDs to shards

A fix was made in 3.0 for the case where sharded listeners were using
a same ID with commit 0db8b6034d ("BUG/MINOR: listener: always assign
distinct IDs to shards"). However, the fix is incorrect. By checking the
ID of temporary node instead of the kept one in bind_complete_thread_setup()
it ends up never inserting the used nodes at this point, thus not reserving
them. The side effect is that assigning too close IDs to subsequent
listeners results in the same ID still being assigned twice since not
reserved. Example:

   global
       nbthread 20

   frontend foo
       bind :8000 shards by-thread id 10
       bind :8010 shards by-thread id 20

The first one will start a series from 10 to 29 and the second one a
series from 20 to 39. But 20 not being inserted when creating the shards,
it will remain available for the post-parsing phase that assigns all
unassigned IDs by filling holes, and two listeners will have ID 20.

By checking the correct node, the problem disappears. The patch above
was marked for backporting to 2.6, so this fix should be backported that
far as well.

3 weeks agoMINOR: proto-tcp: Register a feature to report TCP MD5 signature support
Christopher Faulet [Tue, 8 Jul 2025 07:14:08 +0000 (09:14 +0200)] 
MINOR: proto-tcp: Register a feature to report TCP MD5 signature support

"HAVE_TCP_MD5SIG" feature is now registered if TCP MD5 signature is
supported. This will help the feature detection in the reg-test script
dedicated to this feature.

3 weeks agoMINOR: resolvers: do not duplicate the hostname_dn field
Willy Tarreau [Mon, 7 Jul 2025 14:57:24 +0000 (16:57 +0200)] 
MINOR: resolvers: do not duplicate the hostname_dn field

The hostdn.key field in the server contains a pure copy of the hostname_dn
since commit 3406766d57 ("MEDIUM: resolvers: add a ref between servers and
srv request or used SRV record") which wanted to lowercase it. Since it's
not necessary, let's drop this useless copy. In addition, the return from
strdup() was not tested, so it could theoretically crash the process under
heavy memory contention.

3 weeks agoBUG/MINOR: resolvers: don't lower the case of binary DNS format
Willy Tarreau [Mon, 7 Jul 2025 14:33:02 +0000 (16:33 +0200)] 
BUG/MINOR: resolvers: don't lower the case of binary DNS format

The server's "hostname_dn" is in Domain Name format, not a pure string, as
converted by resolv_str_to_dn_label(). It is made of lower-case string
components delimited by binary lengths, e.g. <0x03>www<0x07>haproxy<0x03)org.
As such it must not be lowercased again in srv_state_srv_update(), because
1) it's useless on the name components since already done, and 2) because
it would replace component lengths 97 and above by 32-char shorter ones.
Granted, not many domain names have that large components so the risk is
very low but the operation is always wrong anyway. This was brought in
2.5 by commit 3406766d57 ("MEDIUM: resolvers: add a ref between servers
and srv request or used SRV record").

In the same vein, let's fix the confusing strcasecmp() that are applied
to this binary format, and use memcmp() instead. Here there's basically
no risk to incorrectly match the wrong record, but that test alone is
confusing enough to provoke the existence of the bug above.

Finally let's update the component for that field to mention that it's
in this format and already lower cased.

Better not backport this, the risk of facing this bug is almost zero, and
every time we touch such files something breaks for bad reasons.

3 weeks agoMEDIUM: resolvers: switch dns-accept-family to "auto" by default
Willy Tarreau [Mon, 7 Jul 2025 14:53:53 +0000 (16:53 +0200)] 
MEDIUM: resolvers: switch dns-accept-family to "auto" by default

As notified in the 3.2 announce [1], dns-accept-family needed to switch
to "auto" by default in 3.3. This is now done.

[1] https://www.mail-archive.com/haproxy@formilux.org/msg45917.html

3 weeks agoCI: github: skip a ssl library version when latest is already in the list
William Lallemand [Mon, 7 Jul 2025 17:38:18 +0000 (19:38 +0200)] 
CI: github: skip a ssl library version when latest is already in the list

Skip the job for "latest" libssl version, when this version is the same
as a one already in the list.

This avoid having 2 jobs for OpenSSL 3.5.1 since no new dev version are
available for now and 3.5.1 is already in the list.

3 weeks agoMINOR: server: support QUIC for dynamic servers
Amaury Denoyelle [Mon, 7 Jul 2025 09:42:25 +0000 (11:42 +0200)] 
MINOR: server: support QUIC for dynamic servers

To properly support QUIC for dynamic servers, it is required to extend
add server CLI handler :
* ensure conformity between server address and proto
* automatically set proto to QUIC if not specified
* prepare_srv callback must be called to initialize required SSL context

Prior to this patch, crashes may occur when trying to use QUIC with
dynamic servers.

Also, destroy_srv callback must be called when a dynamic server is
deallocated. This ensures that there is no memory leak due to SSL
context.

No need to backport.

3 weeks agoMINOR: cfgparse: enforce QUIC MUX compat on server line
Amaury Denoyelle [Mon, 7 Jul 2025 09:20:28 +0000 (11:20 +0200)] 
MINOR: cfgparse: enforce QUIC MUX compat on server line

Add postparsing checks to control server line conformity regarding QUIC
both on the server address and the MUX protocol. An error is reported in
the following case :
* proto quic is explicitely specified but server address does not
  specify quic4/quic6 prefix
* another proto is explicitely specified but server address uses
  quic4/quic6 prefix

3 weeks agoMINOR: quic-be: TLS version restriction to 1.3
Frederic Lecaille [Fri, 4 Jul 2025 14:38:06 +0000 (16:38 +0200)] 
MINOR: quic-be: TLS version restriction to 1.3

This patch skips the TLS version settings. They have as a side effect to add
all the TLS version extensions to the ClientHello message (TLS 1.0 to TLS 1.3).
QUIC supports only TLS 1.3.

3 weeks agoMINOR: quic-be: Set the backend alpn if not set by conf
Frederic Lecaille [Thu, 3 Jul 2025 18:53:00 +0000 (20:53 +0200)] 
MINOR: quic-be: Set the backend alpn if not set by conf

Simply set the alpn string to "h3,hq_interop" if there is no "alpn" setting for
QUIC backends.

3 weeks agoMINOR: reg-tests: first QUIC+H3 reg tests (QUIC address validation)
Frederic Lecaille [Wed, 2 Jul 2025 16:10:19 +0000 (18:10 +0200)] 
MINOR: reg-tests: first QUIC+H3 reg tests (QUIC address validation)

First simple VTC file for QUIC reg tests. Two listeners are configured, one without
Retry enabled and the other without. Two clients simply tries to connect to these
listeners to make an basic H3 request.

3 weeks agoMINOR: quic: Prevent QUIC backend use with the OpenSSL QUIC compatibility module...
Frederic Lecaille [Wed, 2 Jul 2025 15:56:03 +0000 (17:56 +0200)] 
MINOR: quic: Prevent QUIC backend use with the OpenSSL QUIC compatibility module (USE_OPENSS_COMPAT)

Make the server line parsing fail when a QUIC backend is configured  if haproxy
is built to use the OpenSSL stack compatibility module. This latter does not
support the QUIC client part.

3 weeks agoBUG/MINOR: quic-be: Malformed coalesced Initial packets
Frederic Lecaille [Wed, 2 Jul 2025 14:37:02 +0000 (16:37 +0200)] 
BUG/MINOR: quic-be: Malformed coalesced Initial packets

This bug fix completes this patch which was not sufficient:

   MINOR: quic-be: Allow sending 1200 bytes Initial datagrams

This patch could not allow the build of well formed Initial packets coalesced to
others (Handshake) packets. Indeed, the <padding> parameter passed to qc_build_pkt()
is deduced from a first value: <padding> value and must be set to 1 for
the last encryption level. As a client, the last encryption level is always
the Handshake encryption level. But <padding> was always set to 1 for a QUIC
client, leading the first Initial packet to be malformed because considered
as the second one into the same datagram.

So, this patch sets <padding> value passed to qc_build_pkt() to 1 only when there
is no last encryption level at all, to allow the build of Initial only packets
(not coalesced) or when it frames to send (coalesced packets).

No need to backport.

3 weeks agoBUG/MINOR: quic: Missing TLS 1.3 QUIC cipher suites and groups inits (OpenSSL 3.5...
Frederic Lecaille [Wed, 2 Jul 2025 12:54:41 +0000 (14:54 +0200)] 
BUG/MINOR: quic: Missing TLS 1.3 QUIC cipher suites and groups inits (OpenSSL 3.5 QUIC API)

This bug impacts both QUIC backends and frontends with OpenSSL 3.5 as QUIC API.

The connections to a haproxy QUIC listener from a haproxy QUIC backend could not
work at all without HelloRetryRequest TLS messages emitted by the backend
asking the QUIC client to restart the handshake followed by TLS alerts:

    conn. @(nil) OpenSSL error[0xa000098] read_state_machine: excessive message size

Furthermore, the Initial CRYPTO data sent by the client were big (about two 1252 bytes
packets) (ClientHello TLS message). After analyzing the packets a key_share extension
with <unknown> as value was long (more that 1Ko). This extension is in relation with
the groups but does not belong to the groups supported by QUIC.

That said such connections could work with ngtcp2 as backend built against the same
OSSL TLS stack API but with a HelloRetryRequest.

ngtcp2 always set the QUIC default cipher suites and group, for all the stacks it
supports as implemented by this patch.

So this patch configures both QUIC backend and frontend cipher suites and groups
calling SSL_CTX_set_ciphersuites() and SSL_CTX_set1_groups_list() with the correct
argument, except for SSL_CTX_set1_groups_list() which fails with QUIC TLS for
a unknown reason at this time.

The call to SSL_CTX_set_options() is useless from ssl_quic_initial_ctx() for the QUIC
clients. One relies on ssl_sock_prepare_srv_ssl_ctx() to set them for now on.

This patch is effective for all the supported stacks without impact for AWS-LC,
and QUIC TLS and fixes the connections for haproxy QUIC frontend and backends
when builts against OpenSSL 3.5 QUIC API).

A new define HAVE_OPENSSL_QUICTLS has been added to openssl-compat.h to distinguish
the QUIC TLS stack.

Must be backported to 3.2.

3 weeks agoCI: github: update to OpenSSL 3.5.1
William Lallemand [Mon, 7 Jul 2025 11:58:38 +0000 (13:58 +0200)] 
CI: github: update to OpenSSL 3.5.1

Update the OpenSSL 3.5 job to 3.5.1.

This must be backported to 3.2.

3 weeks agoBUG/MEDIUM: quic: SSL/TCP handshake failures with OpenSSL 3.5
Frederic Lecaille [Mon, 7 Jul 2025 10:01:22 +0000 (12:01 +0200)] 
BUG/MEDIUM: quic: SSL/TCP handshake failures with OpenSSL 3.5

This bug arrived with this commit:

    MINOR: quic: OpenSSL 3.5 internal QUIC custom extension for transport parameters reset

To make QUIC connection succeed with OpenSSL 3.5 API, a call to quic_ssl_set_tls_cbs()
was needed from several callback which call SSL_set_SSL_CTX(). This has as side effect
to set the QUIC callbacks used by the OpenSSL 3.5 API.

But quic_ssl_set_tls_cbs() was also called for TCP sessions leading the SSL stack
to run QUIC code, if the QUIC support is enabled.

To fix this, simply ignore the TCP connections inspecting the <ssl_qc_app_data_index>
index value which is NULL for such connections.

Must be backported to 3.2.

3 weeks agoCI: github: update the stable CI to ubuntu-24.04
William Lallemand [Mon, 7 Jul 2025 07:29:33 +0000 (09:29 +0200)] 
CI: github: update the stable CI to ubuntu-24.04

Update the stable CI to ubuntu-24.04.

Must be backported to 3.2.

3 weeks agoCI: github: add an OpenSSL 3.5.0 job
William Lallemand [Mon, 7 Jul 2025 07:27:17 +0000 (09:27 +0200)] 
CI: github: add an OpenSSL 3.5.0 job

Add an OpenSSL 3.5.0 job to test USE_QUIC.

This must be backported to 3.2.

3 weeks agoCI: enable USE_QUIC=1 for OpenSSL versions >= 3.5.0
Ilia Shipitsin [Mon, 7 Jul 2025 06:53:21 +0000 (08:53 +0200)] 
CI: enable USE_QUIC=1 for OpenSSL versions >= 3.5.0

OpenSSL 3.5.0 introduced experimental support for QUIC. This change enables the use_quic option when a compatible version of OpenSSL is detected, allowing QUIC-based functionality to be leveraged where applicable. Feature remains disabled for earlier versions to ensure compatibility.

3 weeks agoCI: set DEBUG_STRICT=2 for coverity scan
Ilia Shipitsin [Sat, 5 Jul 2025 15:18:42 +0000 (17:18 +0200)] 
CI: set DEBUG_STRICT=2 for coverity scan

enabling DEBUG_STRICT=2 will enable BUG_ON_HOT() and help coverity
in bug detection

for the reference: https://github.com/haproxy/haproxy/issues/3008

4 weeks agoMINOR: pattern: add a counter of added/freed patterns
Willy Tarreau [Fri, 4 Jul 2025 22:07:25 +0000 (00:07 +0200)] 
MINOR: pattern: add a counter of added/freed patterns

Patterns are allocated when loading maps/acls from a file or dynamically
via the CLI, and are released only from the CLI (e.g. "clear map xxx").
These ones do not use pools and are much harder to monitor, e.g. in case
a script adds many and forgets to clear them, etc.

Let's add a new pair of metrics "PatternsAdded" and "PatternsFreed" that
will report the number of added and freed patterns respectively. This
can allow to simply graph both. The difference between the two normally
represents the number of allocated patterns. If Added grows without
Freed following, it can indicate a faulty script that doesn't perform
the needed cleanup. The metrics are also made available to Prometheus
as patterns_added_total and patterns_freed_total respectively.

4 weeks agoCLEANUP: ssl: Rename ssl_trace-t.h to ssl_trace.h
Remi Tricot-Le Breton [Fri, 4 Jul 2025 13:17:59 +0000 (15:17 +0200)] 
CLEANUP: ssl: Rename ssl_trace-t.h to ssl_trace.h

This header does not actually contain any structures so it's best to
remove the '-t' from the name for better consistency.

4 weeks agoMEDIUM: httpclient: add a Content-Length when the payload is known
William Lallemand [Fri, 4 Jul 2025 07:05:21 +0000 (09:05 +0200)] 
MEDIUM: httpclient: add a Content-Length when the payload is known

This introduce a change of behavior in the httpclient API. When
generating a request with a payload buffer, the size of the buffer
payload is known and does not need to be streamed in chunks.

This patch force to sends payload buffer using a Content-Length header
in the request, however the behavior does not change if a callback is
still used instead of a buffer.

4 weeks agoBUG/MINOR: http-act: Fix parsing of the expression argument for pause action
Christopher Faulet [Fri, 4 Jul 2025 12:34:08 +0000 (14:34 +0200)] 
BUG/MINOR: http-act: Fix parsing of the expression argument for pause action

When the "pause" action is parsed, if an expression is used instead of a
static value, the position of the current argument after the expression
evaluation is incremented while it should not. The sample_parse_expr()
function already take care of it. However, it should still be incremented
when an time value was parsed.

This patch must be backported to 3.2.

4 weeks agoBUG/MINOR: proto-tcp: Take care to initialized tcp_md5sig structure
Christopher Faulet [Fri, 4 Jul 2025 06:32:05 +0000 (08:32 +0200)] 
BUG/MINOR: proto-tcp: Take care to initialized tcp_md5sig structure

When the TCP MD5 signature is enabled, on a listening socket or an outgoing
one, the tcp_md5sig structure must be initialized first.

It is a 3.3-specific issue. No backport needed.

4 weeks agoBUILD: cfgparse-tcp: Add _GNU_SOURCE for TCP_MD5SIG_MAXKEYLEN
Christopher Faulet [Thu, 3 Jul 2025 14:30:14 +0000 (16:30 +0200)] 
BUILD: cfgparse-tcp: Add _GNU_SOURCE for TCP_MD5SIG_MAXKEYLEN

It is required for the musl librairy to be sure TCP_MD5SIG_MAXKEYLEN is
defined and avoid build errors.

4 weeks agoMINOR: proto-tcp: Add support for TCP MD5 signature for listeners and servers
Christopher Faulet [Thu, 3 Jul 2025 13:16:47 +0000 (15:16 +0200)] 
MINOR: proto-tcp: Add support for TCP MD5 signature for listeners and servers

This patch adds the support for the RFC2385 (Protection of BGP Sessions via
the + TCP MD5 Signature Option) for the listeners and the servers. The
feature is only available on Linux. Keywords are not exposed otherwise.

By setting "tcp-md5sig <password>" option on a bind line, TCP segments of
all connections instantiated from the listening socket will be signed with a
16-byte MD5 digest. The same option can be set on a server line to protect
outgoing connections to the corresponding server.

The primary use case for this option is to allow BGP to protect itself
against the introduction of spoofed TCP segments into the connection
stream. But it can be useful for any very long-lived TCP connections.

A reg-test was added and it will be executed only on linux. All other
targets are excluded.

4 weeks agoBUG/MINOR: ssl/ocsp: fix definition discrepancies with ocsp_update_init()
William Lallemand [Thu, 3 Jul 2025 13:08:37 +0000 (15:08 +0200)] 
BUG/MINOR: ssl/ocsp: fix definition discrepancies with ocsp_update_init()

Since patch 20718f40b6 ("MEDIUM: ssl/ckch: add filename and linenum
argument to crt-store parsing"), the definition of ocsp_update_init()
and its declaration does not share the same arguments.

Must be backported to 3.2.

4 weeks agoDOC: deviceatlas build clarifications
David Carlier [Wed, 2 Jul 2025 13:11:30 +0000 (14:11 +0100)] 
DOC: deviceatlas build clarifications

Update accordingly the related documentation, removing/clarifying confusing
parts as it was more complicated than it needed to be.

4 weeks agoBUILD/MEDIUM: deviceatlas: fix when installed in custom locations.
David Carlier [Wed, 2 Jul 2025 13:00:07 +0000 (14:00 +0100)] 
BUILD/MEDIUM: deviceatlas: fix when installed in custom locations.

We are reusing DEVICEATLAS_INC/DEVICEATLAS_LIB when the DeviceAtlas
library had been compiled and installed with cmake and make install targets.
Works fine except when ldconfig is unaware of the path, thus adding
cflags/ldflags into the mix.

Ideally, to be backported down to the lowest stable branch.

4 weeks agoBUG/MINOR: ssl: crash in ssl_sock_io_cb() with SSL traces and idle connections
William Lallemand [Wed, 2 Jul 2025 14:05:20 +0000 (16:05 +0200)] 
BUG/MINOR: ssl: crash in ssl_sock_io_cb() with SSL traces and idle connections

TRACE_ENTER is crashing in ssl_sock_io_cb() in case a connection idle is
being stolen. Indeed the function could be called with a NULL context
and dereferencing it will crash.

This patch fixes the issue by initializing ctx only once it is usable,
and moving TRACE_ENTER after the initialization.

This must be backported to 3.2.

4 weeks agoBUILD: dev/phash: remove the accidentally committed a.out file
Willy Tarreau [Wed, 2 Jul 2025 08:54:03 +0000 (10:54 +0200)] 
BUILD: dev/phash: remove the accidentally committed a.out file

Commit 41f28b3c53 ("DEV: phash: Update 414 and 431 status codes to phash")
accidentally committed a.out, resulting in build/checkout issues when
locally rebuilt. Let's drop it.

This should be backported to 3.1.

4 weeks agoMINOR: httpclient/cli: add --htx option
William Lallemand [Thu, 30 Jan 2025 16:15:36 +0000 (17:15 +0100)] 
MINOR: httpclient/cli: add --htx option

Use the new HTTPCLIENT_O_RES_HTX flag when using the CLI httpclient with
--htx.

It allows to process directly the response in HTX, then the htx_dump()
function is used to display a debug output.

Example:

echo "httpclient --htx GET https://haproxy.org" | socat /tmp/haproxy.sock
 htx=0x79fd72a2e200(size=16336,data=139,used=6,wrap=NO,flags=0x00000010,extra=0,first=0,head=0,tail=5,tail_addr=139,head_addr=0,end_addr=0)
[0] type=HTX_BLK_RES_SL    - size=31     - addr=0      HTTP/2.0 301
[1] type=HTX_BLK_HDR       - size=15     - addr=31     content-length: 0
[2] type=HTX_BLK_HDR       - size=32     - addr=46     location: https://www.haproxy.org/
[3] type=HTX_BLK_HDR       - size=25     - addr=78     alt-svc: h3=":443"; ma=3600
[4] type=HTX_BLK_HDR       - size=35     - addr=103    set-cookie: served=2:TLSv1.3+TCP:IPv4
[5] type=HTX_BLK_EOH       - size=1      - addr=138    <empty>

4 weeks agoMEDIUM: httpclient: implement a way to use directly htx data
William Lallemand [Wed, 5 Feb 2025 21:28:09 +0000 (22:28 +0100)] 
MEDIUM: httpclient: implement a way to use directly htx data

Add a HTTPCLIENT_O_RES_HTX flag which allow to store directly the HTX
data in the response buffer instead of extracting the data in raw
format.

This is useful when the data need to be reused in another request.

4 weeks agoMEDIUM: httpclient: split the CLI from the actual httpclient API
William Lallemand [Tue, 1 Jul 2025 13:03:46 +0000 (15:03 +0200)] 
MEDIUM: httpclient: split the CLI from the actual httpclient API

This patch split the httpclient code to prevent confusion between the
httpclient CLI command and the actual httpclient API.

Indeed there was a confusion between the flag used internally by the
CLI command, and the actual httpclient API.

hc_cli_* functions as well as HC_C_F_* defines were moved to
httpclient_cli.c.

4 weeks agoMINOR: ssl/ocsp: stop using the flags from the httpclient CLI
William Lallemand [Tue, 1 Jul 2025 13:43:45 +0000 (15:43 +0200)] 
MINOR: ssl/ocsp: stop using the flags from the httpclient CLI

The ocsp-update uses the flags from the httpclient CLI, which are not
supposed to be used elsewhere since this is a state for the CLI.

This patch implements HC_OCSP flags for the ocsp-update.

4 weeks agoBUG/MINOR: httpclient: wrongly named httpproxy flag
William Lallemand [Fri, 24 Jan 2025 16:53:04 +0000 (17:53 +0100)] 
BUG/MINOR: httpclient: wrongly named httpproxy flag

The HC_F_HTTPPROXY flag was wrongly named and does not use the correct
value, indeed this flag was meant to be used for the httpclient API, not
the httpclient CLI.

This patch fixes the problem by introducing HTTPCLIENT_FO_HTTPPROXY
which has must be set in hc->flags.

Also add a member 'options' in the httpclient structure, because the
member flags is reinitialized when starting.

Must be backported as far as 3.0.

4 weeks agoMEDIUM: stats: add persistent state to typed output format
Aurelien DARRAGON [Tue, 15 Apr 2025 09:49:42 +0000 (11:49 +0200)] 
MEDIUM: stats: add persistent state to typed output format

Add a fourth character to the second column of the "typed output format"
to indicate whether the value results from a volatile or persistent metric
('V' or 'P' characters respectively). A persistent metric means the value
could possibily be preserved across reloads by leveraging a shared memory
between multiple co-processes. Such metrics are identified as "shared" in
the code (since they are possibly shared between multiple co-processes)

Some reg-tests were updated to take that change into account, also, some
outputs in the configuration manual were updated to reflect current
behavior.

4 weeks agoMINOR: ssl: Introduce new smp_client_hello_parse() function
Mariam John [Wed, 30 Apr 2025 17:11:14 +0000 (12:11 -0500)] 
MINOR: ssl: Introduce new smp_client_hello_parse() function

In this patch we introduce a new helped function called `smp_client_hello_parse()` to extract
information presented in a TLS client hello handshake message. 7 sample fetches have also been
modified to use this helped function to do the common client hello parsing and use the result
to do further processing of extensions/cipher.

Fixes: #2532
4 weeks agoREGTESTS: restrict execution to a single thread group
Willy Tarreau [Mon, 30 Jun 2025 16:44:07 +0000 (18:44 +0200)] 
REGTESTS: restrict execution to a single thread group

When threads are enabled and running on a machine with multiple CCX
or multiple nodes, thread groups are now enabled since 3.3-dev2, causing
load-balancing algorithms to randomly fail due to incoming connections
spreading over multiple groups and using different load balancing indexes.

Let's just force "thread-groups 1" into all configs when threads are
enabled to avoid this.

4 weeks agoDOC: 'jwt_verify' converter now supports certificates
Remi Tricot-Le Breton [Mon, 30 Jun 2025 14:56:31 +0000 (16:56 +0200)] 
DOC: 'jwt_verify' converter now supports certificates

The 'jwt_verify' converter can now accept certificates as a second
parameter, which can be updated via the CLI.

4 weeks agoREGTESTS: jwt: Test update of certificate used in jwt_verify
Remi Tricot-Le Breton [Mon, 30 Jun 2025 14:56:30 +0000 (16:56 +0200)] 
REGTESTS: jwt: Test update of certificate used in jwt_verify

Using certificates in the jwt_verify converter allows to make use of the
CLI certificate updates, which is still impossible with public keys (the
legacy behavior).

4 weeks agoREGTESTS: jwt: Add test with actual certificate passed to jwt_verify
Remi Tricot-Le Breton [Mon, 30 Jun 2025 14:56:29 +0000 (16:56 +0200)] 
REGTESTS: jwt: Add test with actual certificate passed to jwt_verify

The jwt_verify can now take public certificates as second parameter,
either with actual certificate path (no previously mentioned) or from a
predefined crt-store or from a variable.

4 weeks agoMINOR: ssl: Prevent delete on certificate used by jwt_verify
Remi Tricot-Le Breton [Mon, 30 Jun 2025 14:56:28 +0000 (16:56 +0200)] 
MINOR: ssl: Prevent delete on certificate used by jwt_verify

A ckch_store used in JWT verification might not have any ckch instances
or crt-list entries linked but we don't want to be able to remove it via
the CLI anyway since it would make all future jwt_verify calls using
this certificate fail.

4 weeks agoMINOR: ssl: Allow 'commit ssl cert' with no privkey
Remi Tricot-Le Breton [Mon, 30 Jun 2025 14:56:27 +0000 (16:56 +0200)] 
MINOR: ssl: Allow 'commit ssl cert' with no privkey

The ckch_stores might be used to store public certificates only so in
this case we won't provide private keys when updating the certificate
via the CLI.
If the ckch_store is actually used in a bind or server line an error
will still be raised if the private key is missing.

4 weeks agoMAJOR: jwt: Allow certificate instead of public key in jwt_verify converter
Remi Tricot-Le Breton [Mon, 30 Jun 2025 14:56:26 +0000 (16:56 +0200)] 
MAJOR: jwt: Allow certificate instead of public key in jwt_verify converter

The 'jwt_verify' converter could only be passed public keys as second
parameter instead of full-on public certificates. This patch allows
proper certificates to be used.
Those certificates can be loaded in ckch_stores like any other
certificate which means that all the certificate-related operations that
can be made via the CLI can now benefit JWT validation as well.

We now have two ways JWT validation can work, the legacy one which only
relies on public keys which could not be stored in ckch_stores without
some in depth changes in the way the ckch_stores are built. In this
legacy way, the public keys are fully stored in a cache dedicated to JWT
only which does not have any CLI commands and any way to update them
during runtime. It also requires that all the public keys used are
passed at least once explicitely to the 'jwt_verify' converter so that
they can be loaded during init.
The new way uses actual certificates, either already stored in the
ckch_store tree (if predefined in a crt-store or already used previously
in the configuration) or loaded in the ckch_store tree during init if
they are explicitely used in the configuration like so:
    var(txn.bearer),jwt_verify(txn.jwt_alg,"cert.pem")

When using a variable (or any other way that can only be resolved during
runtime) in place of the converter's <key> parameter, the first time we
encounter a new value (for which we don't have any entry in the jwt
tree) we will lock the ckch_store tree and try to perform a lookup in
it. If the lookup fails, an entry will still be inserted into the jwt
tree so that any following call with this value avoids performing the
ckch_store tree lookup.