]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
3 years agoMEDIUM: cfgparse: numa detect topology on FreeBSD.
David CARLIER [Mon, 6 Dec 2021 11:00:10 +0000 (11:00 +0000)] 
MEDIUM: cfgparse: numa detect topology on FreeBSD.

allowing for all platforms supporting cpu affinity to have a chance
 to detect the cpu topology from a given valid node (e.g.
 DragonflyBSD seems to be NUMA aware from a kernel's perspective
 and seems to be willing start to provide userland means to get
 proper info).

3 years agoCLEANUP: cfgparse: modify preprocessor guards around numa detection code
Amaury Denoyelle [Wed, 15 Dec 2021 08:48:39 +0000 (09:48 +0100)] 
CLEANUP: cfgparse: modify preprocessor guards around numa detection code

numa_detect_topology() is always define now if USE_CPU_AFFINITY is
activated. For the moment, only on Linux an actual implementation is
provided. For other platforms, it always return 0.

This change has been made to easily add implementation of NUMA detection
for other platforms. The phrasing of the documentation has also been
edited to removed the mention of Linux-only on numa-cpu-mapping
configuration option.

3 years agoMINOR: cli: "show version" displays the current process version
William Lallemand [Tue, 14 Dec 2021 14:22:29 +0000 (15:22 +0100)] 
MINOR: cli: "show version" displays the current process version

This patch implements a simple "show version" command which returns
the version of the current process.

It's available from the master and the worker processes, so it is easy
to check if the master and the workers have the same version.

This is a minor patch that really improve compatibility checks
for scripts.

Could be backported in haproxy version as far as 2.0.

3 years agoREGTESTS: ssl: use X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY for cert check
Ilya Shipitsin [Sat, 4 Dec 2021 09:32:23 +0000 (14:32 +0500)] 
REGTESTS: ssl: use X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY for cert check

LibreSSL-3.4.2 introduced cert revocation check behaviour change, for some
checks now X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY (20) is returned.

https://github.com/libressl-portable/portable/issues/697

let us modify vtc accordingly

3 years agoMINOR: hq-interop: refix tx buffering
Amaury Denoyelle [Thu, 9 Dec 2021 09:07:23 +0000 (10:07 +0100)] 
MINOR: hq-interop: refix tx buffering

Incorrect usage of the buffer API : b_room() replaces b_size() to ensure
that we have enough size for http data copy.

3 years agoBUG/MEDIUM: mworker/cli: crash when trying to access an old PID in prompt mode
William Lallemand [Fri, 10 Dec 2021 13:14:53 +0000 (14:14 +0100)] 
BUG/MEDIUM: mworker/cli: crash when trying to access an old PID in prompt mode

The master process encounter a crash when trying to access an old
process which left from the master CLI.

To reproduce the problem, you need a prompt to a previous worker, then
wait for this worker to leave, once it left launch a command from this
prompt. The s->target is then filled with a NULL which is dereferenced
when trying to connect().

This patch fixes the problem by checking if s->target is NULL.

Must be backported as far as 2.0.

3 years agoDOC: config: fix error-log-format example
Lukas Tribus [Thu, 9 Dec 2021 00:27:14 +0000 (01:27 +0100)] 
DOC: config: fix error-log-format example

In commit 6f7497616 ("MEDIUM: connection: rename fc_conn_err and
bc_conn_err to fc_err and bc_err"), fc_conn_err became fc_err, so
update this example.

3 years agoDOC: config: retry-on list is space-delimited
Lukas Tribus [Wed, 8 Dec 2021 10:33:01 +0000 (11:33 +0100)] 
DOC: config: retry-on list is space-delimited

We are using comma-delimited list for init-addr for example, let's
document that this is space-delimited to avoid the guessing game.

3 years agoMINOR: h3: fix possible invalid dereference on htx parsing
Amaury Denoyelle [Wed, 8 Dec 2021 14:51:04 +0000 (15:51 +0100)] 
MINOR: h3: fix possible invalid dereference on htx parsing

The htx variable is only initialized if we have received a HTTP/3
HEADERS frame. Else it must not be dereferenced.

This should fix the compilation on CI with gcc.
  src/h3.c: In function ‘h3_decode_qcs’:
  src/h3.c:224:14: error: ‘htx’ may be used uninitialized in this function
  [-Werror=maybe-uninitialized]
    224 |   htx->flags |= HTX_FL_EOM

3 years agoMINOR: quic: Compilation fix for quic_rx_packet_refinc()
Frédéric Lécaille [Wed, 8 Dec 2021 14:24:15 +0000 (15:24 +0100)] 
MINOR: quic: Compilation fix for quic_rx_packet_refinc()

This was reported by the CI wich clang as compilator.

    In file included from src/ssl_sock.c:80:
    include/haproxy/xprt_quic.h:1100:50: error: passing 'int *' to parameter of
    type 'unsigned int *' converts between pointers to integer types with
    different sign [-Werror,-Wpointer-sign]
        } while (refcnt && !HA_ATOMIC_CAS(&pkt->refcnt, &refcnt, refcnt - 1));
                                                        ^~~~~~~

3 years agoBUG/MINOR: mux-quic: properly initialize flow control
Amaury Denoyelle [Wed, 8 Dec 2021 14:12:01 +0000 (15:12 +0100)] 
BUG/MINOR: mux-quic: properly initialize flow control

Initialize all flow control members on the qcc instance. Without this,
the value are undefined and it may be possible to have errors about
reached streams limit.

3 years agoMINOR: quic: notify the mux on CONNECTION_CLOSE
Amaury Denoyelle [Wed, 8 Dec 2021 13:51:04 +0000 (14:51 +0100)] 
MINOR: quic: notify the mux on CONNECTION_CLOSE

The xprt layer is reponsible to notify the mux of a CONNECTION_CLOSE
reception. In this case the flag QC_CF_CC_RECV is positionned on the
qcc and the mux tasklet is waken up.

One of the notable effect of the QC_CF_CC_RECV is that each qcs will be
released even if they have remaining data in their send buffers.

3 years agoMINOR: mux-quic: do not release qcs if there is remaining data to send
Amaury Denoyelle [Wed, 8 Dec 2021 13:42:55 +0000 (14:42 +0100)] 
MINOR: mux-quic: do not release qcs if there is remaining data to send

A qcs is not freed if there is remaining data in its buffer. In this
case, the flag QC_SF_DETACH is positionned.

The qcc io handler is responsible to remove the qcs if the QC_SF_DETACH
is set and their buffers are empty.

3 years agoBUG/MINOR: cli/server: Don't crash when a server is added with a custom id
Christopher Faulet [Tue, 7 Dec 2021 17:49:44 +0000 (18:49 +0100)] 
BUG/MINOR: cli/server: Don't crash when a server is added with a custom id

When a server is dynamically added via the CLI with a custom id, the key
used to insert it in the backend's tree of used names is not initialized.
The server id must be used but it is only used when no custom id is
provided. Thus, with a custom id, HAProxy crashes.

Now, the server id is always used to init this key, to be able to insert the
server in the corresponding tree.

This patch should fix the issue #1481. It must be backported as far as 2.4.

3 years agoMINOR: http-rules: Add capture action to http-after-response ruleset
Christopher Faulet [Mon, 6 Dec 2021 07:43:22 +0000 (08:43 +0100)] 
MINOR: http-rules: Add capture action to http-after-response ruleset

It is now possible to perform captures on the response when
http-after-response rules are evaluated. It may be handy to capture headers
from responses generated by HAProxy.

This patch is trivial, it may be backported if necessary.

3 years agoBUILD: mux-quic: fix compilation with DEBUG_MEM_STATS
Amaury Denoyelle [Tue, 7 Dec 2021 16:27:47 +0000 (17:27 +0100)] 
BUILD: mux-quic: fix compilation with DEBUG_MEM_STATS

Replace bug.h by api.h in mux_quic header.
This is required because bug.h uses atomic operations when compiled with
DEBUG_MEM_STATS. api.h takes care of including atomic.h before bug.h.

3 years agoMINOR: quic: add HTX EOM on request end
Amaury Denoyelle [Tue, 30 Nov 2021 10:23:29 +0000 (11:23 +0100)] 
MINOR: quic: add HTX EOM on request end

Set the HTX EOM flag on RX the app layer. This is required to notify
about the end of the request for the stream analyzers, else the request
channel never goes to MSG_DONE state.

3 years agoMINOR: mux-quic: remove uneeded code to check fin on TX
Amaury Denoyelle [Tue, 7 Dec 2021 15:50:14 +0000 (16:50 +0100)] 
MINOR: mux-quic: remove uneeded code to check fin on TX

Remove a wrong comparaison with the same buffer on both sides. In any
cases, the FIN is properly set by qcs_push_frame only when the payload
has been totally emptied.

3 years agoMINOR: hq-interop: fix tx buffering
Amaury Denoyelle [Tue, 7 Dec 2021 15:19:03 +0000 (16:19 +0100)] 
MINOR: hq-interop: fix tx buffering

On h09 app layer, if there is not enought size in the tx buffer, the
transfer is interrupted and the flag QC_SF_BLK_MROOM is positionned.
The transfer is woken up by the mux when new buffer size becomes
available.

This ensure that no data is silently discarded during transfer. Without
this, once the buffer is full the data were removed and thus not send to
the client resulting in a truncating payload.

3 years agoMINOR: quic: Remove QUIC TX packet length evaluation function
Frédéric Lécaille [Tue, 7 Dec 2021 14:27:44 +0000 (15:27 +0100)] 
MINOR: quic: Remove QUIC TX packet length evaluation function

Remove qc_eval_pkt() which has come with the multithreading support. It
was there to evaluate the length of a TX packet before building. We could
build from several thread TX packets without consuming a packet number for nothing (when
the building failed). But as the TX packet building functions are always
executed by the same thread, the one attached to the connection, this does
not make sense to continue to use such a function. Furthermore it is buggy
since we had to recently pad the TX packet under certain circumstances.

3 years agoMINOR: quic: Delete remaining RX handshake packets
Frédéric Lécaille [Mon, 6 Dec 2021 11:09:08 +0000 (12:09 +0100)] 
MINOR: quic: Delete remaining RX handshake packets

After the handshake has succeeded, we must delete any remaining
Initial or Handshake packets from the RX buffer. This cannot be
done depending on the state the connection (->st quic_conn struct
member value) as the packet are not received/treated in order.

3 years agoMINOR: quic: QUIC encryption level RX packets race issue
Frédéric Lécaille [Mon, 6 Dec 2021 07:56:38 +0000 (08:56 +0100)] 
MINOR: quic: QUIC encryption level RX packets race issue

The tree containing RX packets must be protected from concurrent accesses.

3 years agoMINOR: quic: Race issue when consuming RX packets buffer
Frédéric Lécaille [Thu, 2 Dec 2021 13:46:19 +0000 (14:46 +0100)] 
MINOR: quic: Race issue when consuming RX packets buffer

Add a null byte to the end of the RX buffer to notify the consumer there is no
more data to treat.
Modify quic_rx_packet_pool_purge() which is the function which remove the
RX packet from the buffer.
Also rename this function to quic_rx_pkts_del().
As the RX packets may be accessed by the QUIC connection handler (quic_conn_io_cb())
the function responsible of decrementing their reference counters must not
access other information than these reference counters! It was a very bad idea
to try to purge the RX buffer asap when executing this function.

3 years agoMINOR: quic: RX buffer full due to wrong CRYPTO data handling
Frédéric Lécaille [Thu, 2 Dec 2021 10:25:58 +0000 (11:25 +0100)] 
MINOR: quic: RX buffer full due to wrong CRYPTO data handling

Do not leave in the RX buffer packets with CRYPTO data which were
already received. We do this when parsing CRYPTO frame. If already
received we must not consider such frames as if they were not received
in order! This had as side effect to interrupt the transfer of long streams
(ACK frames not parsed).

3 years agoMEDIUM: mux-quic: handle when sending buffer is full
Amaury Denoyelle [Fri, 3 Dec 2021 13:40:01 +0000 (14:40 +0100)] 
MEDIUM: mux-quic: handle when sending buffer is full

Handle the case when the app layer sending buffer is full. A new flag
QC_SF_BLK_MROOM is set in this case and the transfer is interrupted. It
is expected that then the conn-stream layer will subscribe to SEND.

The MROOM flag is reset each time the muxer transfer data from the app
layer to its own buffer. If the app layer has been subscribed on SEND it
is woken up.

3 years agoMEDIUM: mux-quic: wake up xprt on data transferred
Amaury Denoyelle [Fri, 3 Dec 2021 13:39:29 +0000 (14:39 +0100)] 
MEDIUM: mux-quic: wake up xprt on data transferred

On qc_send, data are transferred for each stream from their qcs.buf to
the qcs.xprt_buf. Wake up the xprt to warn about new data available for
transmission.

3 years agoMEDIUM: mux-quic: subscribe on xprt if remaining data after send
Amaury Denoyelle [Fri, 3 Dec 2021 13:38:31 +0000 (14:38 +0100)] 
MEDIUM: mux-quic: subscribe on xprt if remaining data after send

The streams data are transferred from the qcs.buf to the qcs.xprt_buf
during qc_send. If the xprt_buf is not empty and not all data can be
transferred, subscribe the connection on the xprt for sending.

The mux will be woken up by the xprt when the xprt_buf will be cleared.
This happens on ACK reception.

3 years agoMINOR: mux-quic: implement subscribe on stream
Amaury Denoyelle [Mon, 6 Dec 2021 10:24:00 +0000 (11:24 +0100)] 
MINOR: mux-quic: implement subscribe on stream

Implement the subscription in the mux on the qcs instance.

Subscribe is now used by the h3 layer when receiving an incomplete frame
on the H3 control stream. It is also used when attaching the remote
uni-directional streams on the h3 layer.

In the qc_send, the mux wakes up the qcs for each new transfer executed.
This is done via the method qcs_notify_send().

The xprt wakes up the qcs when receiving data on unidirectional streams.
This is done via the method qcs_notify_recv().

3 years agoMEDIUM: quic: detect the stream FIN
Amaury Denoyelle [Fri, 3 Dec 2021 14:03:36 +0000 (15:03 +0100)] 
MEDIUM: quic: detect the stream FIN

Set the QC_SF_FIN_STREAM on the app layers (h3 / hq-interop) when
reaching the HTX EOM. This is used to warn the mux layer to set the FIN
on the QUIC stream.

3 years agoMEDIUM: mux-quic: implement release mux operation
Amaury Denoyelle [Mon, 6 Dec 2021 15:03:47 +0000 (16:03 +0100)] 
MEDIUM: mux-quic: implement release mux operation

Implement qc_release. This function is called by the upper layer on
connection close. For the moment, this only happens on client timeout.

This functions is used the free a qcs instance. If all bidirectional
streams are freed, the qcc instance and the connection are purged.

3 years agoMAJOR: mux-quic: implement a simplified mux version
Amaury Denoyelle [Fri, 3 Dec 2021 10:36:46 +0000 (11:36 +0100)] 
MAJOR: mux-quic: implement a simplified mux version

Re-implement the QUIC mux. It will reuse the mechanics from the previous
mux without all untested/unsupported features. This should ease the
maintenance.

Note that a lot of features are broken for the moment. They will be
re-implemented on the following commits to have a clean commit history.

3 years agoMINOR: h3: remove duplicated FIN flag position
Amaury Denoyelle [Mon, 6 Dec 2021 15:18:43 +0000 (16:18 +0100)] 
MINOR: h3: remove duplicated FIN flag position

The FIN flag is already set in h3_snd_buf on HTX EOM reception. The same
action in h3_resp_headers_send is duplicated and thus now removed.

3 years agoMEDIUM: xprt-quic: finalize app layer initialization after ALPN nego
Amaury Denoyelle [Fri, 3 Dec 2021 13:44:21 +0000 (14:44 +0100)] 
MEDIUM: xprt-quic: finalize app layer initialization after ALPN nego

The app layer is initialized after the handshake completion by the XPRT
stack. Call the finalize operation just after that.

Remove the erroneous call to finalize by the mux in the TPs callback as
the app layer is not yet initialized at this stage.

This should fix the missing H3 settings currently not emitted by
haproxy.

3 years agoMINOR: h3: add BUG_ON on control receive function
Amaury Denoyelle [Mon, 6 Dec 2021 13:26:52 +0000 (14:26 +0100)] 
MINOR: h3: add BUG_ON on control receive function

Add BUG_ON statement when handling a non implemented frames on the
control stream. This is required because frames must be removed from the
RX buffer or else it will stall the buffer.

3 years agoMINOR: quic: fix segfault on CONNECTION_CLOSE parsing
Amaury Denoyelle [Tue, 7 Dec 2021 14:32:00 +0000 (15:32 +0100)] 
MINOR: quic: fix segfault on CONNECTION_CLOSE parsing

At the moment the reason_phrase member of a
quic_connection_close/quic_connection_close_app structure is not
allocated. Comment the memcpy to it to avoid segfault.

3 years agoIMPORT: slz: use the correct CRC32 instruction when running in 32-bit mode
Willy Tarreau [Fri, 3 Dec 2021 16:38:42 +0000 (17:38 +0100)] 
IMPORT: slz: use the correct CRC32 instruction when running in 32-bit mode

Many ARMv8 processors also support Aarch32 and can run armv7 and even
thumb2 code. While armv8 compilers will not emit these instructions,
armv7 compilers that are aware of these processors will do. For
example, using gcc built for an armv7 target and passing it
"-mcpu=cortex-a72" or "-march=armv8-a+crc" will result in the CRC32
instruction to be used.

In this case the current assembly code fails because with the ARM and
Thumb2 instruction sets there is no such "%wX" half-registers. We need
to use "%X" instead as the native 32-bit register when running with a
32-bit instruction set, and use "%wX" when using the 64-bit instruction
set (A64).

This is slz upstream commit fab83248612a1e8ee942963fe916a9cdbf085097

3 years agoBUILD: tree-wide: avoid warnings caused by redundant checks of obj_types
Willy Tarreau [Mon, 6 Dec 2021 07:01:02 +0000 (07:01 +0000)] 
BUILD: tree-wide: avoid warnings caused by redundant checks of obj_types

At many places we use construct such as:

   if (objt_server(blah))
       do_something(objt_server(blah));

At -O2 the compiler manages to simplify the operation and see that the
second one returns the same result as the first one. But at -O1 that's
not always the case, and the compiler is able to emit a second
expression and sees the potential null that results from it, and may
warn about a potential null deref (e.g. with gcc-6.5). There are two
solutions to this:
  - either the result of the first test has to be passed to a local
    variable
  - or the second reference ought to be unchecked using the __objt_*
    variant.

This patch fixes all occurrences at once by taking the second approach
(the least intrusive). For constructs like:

   objt_server(blah) ? objt_server(blah)->name : "no name"

a macro could be useful. It would for example take the object type
(server), the field name (name) and the default value. But there
are probably not enough occurrences across the whole code for this
to really matter.

This should be backported wherever it applies.

3 years agoDOC: config: Specify %Ta is only available in HTTP mode
Christopher Faulet [Fri, 3 Dec 2021 09:48:36 +0000 (10:48 +0100)] 
DOC: config: Specify %Ta is only available in HTTP mode

%Ta format can only be used in HTTP mode but it was not specify in the
configuration manual.

This patch should fix the issue #1317.

3 years agoDOC: spoe: Clarify use of the event directive in spoe-message section
Christopher Faulet [Fri, 3 Dec 2021 09:18:09 +0000 (10:18 +0100)] 
DOC: spoe: Clarify use of the event directive in spoe-message section

Only one event is possible for a spoe-message section. If defined several
time, only the last one is considered. The documentation is now explicit on
this point.

This patch is related to the the issue #1351.

3 years agoBUG/MEDIUM: sample: Fix memory leak in sample_conv_jwt_member_query
Tim Duesterhus [Wed, 1 Dec 2021 22:04:15 +0000 (23:04 +0100)] 
BUG/MEDIUM: sample: Fix memory leak in sample_conv_jwt_member_query

The function leaked one full buffer per invocation. Fix this by simply removing
the call to alloc_trash_chunk(), the static chunk from get_trash_chunk() is
sufficient.

This bug was introduced in 0a72f5ee7c2a61bdb379436461269315c776b50a, which is
2.5-dev10. This fix needs to be backported to 2.5+.

3 years agoBUILD: bug: Fix error when compiling with -DDEBUG_STRICT_NOCRASH
Christopher Faulet [Fri, 3 Dec 2021 07:58:22 +0000 (08:58 +0100)] 
BUILD: bug: Fix error when compiling with -DDEBUG_STRICT_NOCRASH

ha_backtrace_to_stderr() must be declared in CRASH_NOW() macro whe HAProxy
is compiled with DEBUG_STRICT_NOCRASH. Otherwise an error is reported during
compilation:

include/haproxy/bug.h:58:26: error: implicit declaration of function ‘ha_backtrace_to_stderr’ [-Werror=implicit-function-declaration]
   58 | #define CRASH_NOW() do { ha_backtrace_to_stderr(); } while (0)

This patch must be backported as far as 2.4.

3 years agoBUG/MINOR: resolvers: Don't overwrite the error for invalid query domain name
Christopher Faulet [Thu, 2 Dec 2021 09:05:02 +0000 (10:05 +0100)] 
BUG/MINOR: resolvers: Don't overwrite the error for invalid query domain name

When a response is validated, the query domain name is checked to be sure it
is the same than the one requested. When an error is reported, the wrong
goto label was used. Thus, the error was lost. Instead of
RSLV_RESP_WRONG_NAME, RSLV_RESP_INVALID was reported.

This bug was introduced by the commit c1699f8c1 ("MEDIUM: resolvers: No
longer store query items in a list into the response").

This patch should fix the issue #1473. No backport is needed.

3 years agoBUG/MEDIUM: h1: Properly reset h1m flags when headers parsing is restarted
Christopher Faulet [Wed, 1 Dec 2021 17:01:48 +0000 (18:01 +0100)] 
BUG/MEDIUM: h1: Properly reset h1m flags when headers parsing is restarted

If H1 headers are not fully received at once, the parsing is restarted a
last time when all headers are finally received. When this happens, the h1m
flags are sanitized to remove all value set during parsing.

But some flags where erroneously preserved. Among others, H1_MF_TE_CHUNKED
flag was not removed, what could lead to parsing error.

To fix the bug and make things easy, a mask has been added with all flags
that must be preserved. It will be more stable. This mask is used to
sanitize h1m flags.

This patch should fix the issue #1469. It must be backported to 2.5.

3 years agoBUG/MAJOR: segfault using multiple log forward sections.
Emeric Brun [Wed, 1 Dec 2021 11:08:42 +0000 (12:08 +0100)] 
BUG/MAJOR: segfault using multiple log forward sections.

For each new log forward section, the proxy was added to the log forward
proxy list but the ref on the previous log forward section's proxy was
scratched using "init_new_proxy" which performs a memset. After configuration
parsing this list contains only the last section's proxy.

The post processing walk through this list to resolve "ring" names.
Since some section's proxies are missing in this list, the resolving
is not done for those ones and the pointer on the ring is kept to null
causing a segfault at runtime trying to write a log message
into the ring.

This patch shift the "init_new_proxy" before adding the ref on the
previous log forward section's proxy on currently parsed one.

This patch shoud fix github issue #1464

This patch should be backported to 2.3

3 years agoMEDIUM: resolvers: No longer store query items in a list into the response
Christopher Faulet [Wed, 1 Dec 2021 14:07:26 +0000 (15:07 +0100)] 
MEDIUM: resolvers: No longer store query items in a list into the response

When the response is parsed, query items are stored in a list, attached to
the parsed response (resolve_response).

First, there is one and only one query sent at a time. Thus, there is no
reason to use a list. There is a test to be sure there is only one query
item in the response. Then, the reference on this query item is only used to
validate the domain name is the one requested. So the query list can be
removed. We only expect one query item, no reason to loop on query records.
In addition, the query domain name is now immediately checked against the
resolution domain name. This way, the query item is only manipulated during
the response parsing.

3 years agoBUG/MEDIUM: resolvers: Detach query item on response error
Christopher Faulet [Wed, 1 Dec 2021 09:18:08 +0000 (10:18 +0100)] 
BUG/MEDIUM: resolvers: Detach query item on response error

When a new response is parsed, it is unexpected to have an old query item
still attached to the resolution. And indeed, when the response is parsed
and validated, the query item is detached and used for a last check on its
dname. However, this is only true for a valid response. If an error is
detected, the query is not detached. This leads to undefined behavior (most
probably a crash) on the next response because the first element in the
query list is referencing an old response.

This patch must be backported as far as 2.0.

3 years agoBUG/MINOR: server: Don't rely on last default-server to init server SSL context
Christopher Faulet [Wed, 1 Dec 2021 08:50:41 +0000 (09:50 +0100)] 
BUG/MINOR: server: Don't rely on last default-server to init server SSL context

During post-parsing stage, the SSL context of a server is initialized if SSL
is configured on the server or its default-server. It is required to be able
to enable SSL at runtime. However a regression was introduced, because the
last parsed default-server is used. But it is not necessarily the
default-server line used to configure the server. This may lead to
erroneously initialize the SSL context for a server without SSL parameter or
the skip it while it should be done.

The problem is the default-server used to configure a server is not saved
during configuration parsing. So, the information is lost during the
post-parsing. To fix the bug, the SRV_F_DEFSRV_USE_SSL flag is
introduced. It is used to know when a server was initialized with a
default-server using SSL.

For the record, the commit f63704488e ("MEDIUM: cli/ssl: configure ssl on
server at runtime") has introduced the bug.

This patch must be backported as far as 2.4.

3 years agoREGTESTS: h1: Add a script to validate H1 splicing support
Christopher Faulet [Fri, 26 Nov 2021 17:18:40 +0000 (18:18 +0100)] 
REGTESTS: h1: Add a script to validate H1 splicing support

This script is used to validate the spliciing is properly working for the H1
multiplexer. It relies on the H1 mux stats.

3 years agoMINOR: mux-h1: add stat for total amount of bytes received and sent
Christopher Faulet [Fri, 26 Nov 2021 17:12:51 +0000 (18:12 +0100)] 
MINOR: mux-h1: add stat for total amount of bytes received and sent

Add counters for total amount of bytes received and sent. Bytes received and
sent via kernel splicing are also counted.

3 years agoMINOR: mux-h1: add stat for total count of connections/streams
Christopher Faulet [Fri, 26 Nov 2021 17:12:04 +0000 (18:12 +0100)] 
MINOR: mux-h1: add stat for total count of connections/streams

Add counters for total number of http1 connections/stream since haproxy
startup. Contrary to open_conn/stream, they are never reset to zero.

3 years agoMINOR: mux-h1: count open connections/streams on stats
Christopher Faulet [Fri, 26 Nov 2021 17:10:39 +0000 (18:10 +0100)] 
MINOR: mux-h1: count open connections/streams on stats

Implement as a gauge h1 counters for currently open connections and
streams. The counters are decremented when closing the stream or the
connection.

3 years agoMINOR: mux-h1: add counters instance to h1c
Christopher Faulet [Fri, 26 Nov 2021 16:37:51 +0000 (17:37 +0100)] 
MINOR: mux-h1: add counters instance to h1c

Add pointer to counters as a member for h1c structure. This pointer is
initialized on h1_init function. This is useful to quickly access and
manipulate the counters inside every h1 functions.

3 years agoMINOR: mux-h1: register a stats module
Christopher Faulet [Fri, 26 Nov 2021 16:37:07 +0000 (17:37 +0100)] 
MINOR: mux-h1: register a stats module

Use statistics API to register a new stats module generating counters on h1
module. The counters are attached to frontend/backend instances.

3 years agoMINOR: mux-h1: Improve H1 traces by adding info about http parsers
Christopher Faulet [Fri, 26 Nov 2021 16:31:35 +0000 (17:31 +0100)] 
MINOR: mux-h1: Improve H1 traces by adding info about http parsers

Info about the request and the response parsers are now displayed in H1
traces for advanced and complete verbosity only. This should help debugging.

This patch may be backported as far as 2.4.

3 years agoBUG/MINOR: mux-h1: Fix splicing for messages with unknown length
Christopher Faulet [Fri, 26 Nov 2021 16:26:19 +0000 (17:26 +0100)] 
BUG/MINOR: mux-h1: Fix splicing for messages with unknown length

Splicing was disabled fo Messages with an unknown length (no C-L or T-E
header) with no valid reason. So now, it is possible to use the kernel
splicing for such messages.

This patch should be backported as far as 2.4.

3 years agoBUG/MEDIUM: mux-h1: Fix splicing by properly detecting end of message
Christopher Faulet [Fri, 26 Nov 2021 15:37:55 +0000 (16:37 +0100)] 
BUG/MEDIUM: mux-h1: Fix splicing by properly detecting end of message

Since the 2.4.4, the splicing support in the H1 multiplexer is buggy because
end of the message is not properly detected.

On the 2.4, when the requests is spliced, there is no issue. But when the
response is spliced, the client connection is always closed at the end of the
message. Note the response is still fully sent.

On the 2.5 and higher, when the last requests on a connection is spliced, a
client abort is reported. For other requests there is no issue. In all cases,
the requests are fully sent. When the response is spliced, the server connection
hangs till the server timeout and a server abort is reported. The response is
fully sent with no delay.

The root cause is the EOM block suppression. There is no longer extra block to
be sure to call a last time rcv_buf()/snd_buf() callback functions. At the end,
to fix the issue, we must now detect end of the message in rcv_pipe() and
snd_pipe() callback functions. To do so, we rely on the announced message length
to know when the payload is finished. This works because the chunk-encoded
messages are not spliced.

This patch must be backported as far as 2.4 after an observation period.

3 years agoMEDIUM: pool: Following up on previous pool trimming update.
David CARLIER [Fri, 26 Nov 2021 20:44:44 +0000 (20:44 +0000)] 
MEDIUM: pool: Following up on previous pool trimming update.

Apple libmalloc has its own notion of memory arenas as malloc_zone with
rich API having various callbacks for various allocations strategies but
here we just use the defaults.
In trim_all_pools,  we advise to purge each zone as much as possible, called "greedy" mode.

3 years agoBUG/MINOR: vars: Fix the set-var and unset-var converters
Remi Tricot-Le Breton [Fri, 26 Nov 2021 17:08:39 +0000 (18:08 +0100)] 
BUG/MINOR: vars: Fix the set-var and unset-var converters

In commit 3a4bedccc6 the variable logic was changed. Instead of
accessing variables by their name during runtime, the variable tables
are now indexed by a hash of the name. But the set-var and unset-var
converters try to access the correct variable by calculating a hash on
the sample instead of the already calculated variable hash.

It should be backported to 2.5.

3 years agoMINOR: quic: Delete the ODCIDs asap
Frédéric Lécaille [Tue, 30 Nov 2021 11:01:32 +0000 (12:01 +0100)] 
MINOR: quic: Delete the ODCIDs asap

As soon as the connection ID (the one choosen by the QUIC server) has been used
by the client, we can delete its original destination connection ID from its tree.

3 years agoMINOR: quic: Enable the Key Update process
Frédéric Lécaille [Tue, 30 Nov 2021 10:18:18 +0000 (11:18 +0100)] 
MINOR: quic: Enable the Key Update process

This patch modifies ha_quic_set_encryption_secrets() to store the
secrets received by the TLS stack and prepare the information for the
next key update thanks to quic_tls_key_update().
qc_pkt_decrypt() is modified to check if we must used the next or the
previous key phase information to decrypt a short packet.
The information are rotated if the packet could be decrypted with the
next key phase information. Then new secrets, keys and IVs are updated
calling quic_tls_key_update() to prepare the next key phase.
quic_build_packet_short_header() is also modified to handle the key phase
bit from the current key phase information.

3 years agoMINOR: quic: Add quic_tls_key_update() function for Key Update
Frédéric Lécaille [Tue, 30 Nov 2021 10:10:36 +0000 (11:10 +0100)] 
MINOR: quic: Add quic_tls_key_update() function for Key Update

This function derives the next RX and TX keys and IVs from secrets
for the next key update key phase. We also implement quic_tls_rotate_keys()
which rotate the key update key phase information to be able to continue
to decrypt old key phase packets. Most of these information are pointers
to unsigned char.

3 years agoMINOR: quic: Optional header protection key for quic_tls_derive_keys()
Frédéric Lécaille [Tue, 30 Nov 2021 10:06:41 +0000 (11:06 +0100)] 
MINOR: quic: Optional header protection key for quic_tls_derive_keys()

quic_tls_derive_keys() is responsible to derive the AEAD keys, IVs and$
header protection key from a secret provided by the TLS stack. We want
to make the derivation of the header protection key be optional. This
is required for the Key Update process where there is no update for
the header protection key.

3 years agoMINOR: quic: Add structures to maintain key phase information
Frédéric Lécaille [Tue, 30 Nov 2021 09:59:37 +0000 (10:59 +0100)] 
MINOR: quic: Add structures to maintain key phase information

When running Key Update process, we must maintain much information
especially when the key phase bit has been toggled by the peer as
it is possible that it is due to late packets. This patch adds
quic_tls_kp new structure to do so. They are used to store
previous and next secrets, keys and IVs associated to the previous
and next RX key phase. We also need the next TX key phase information
to be able to encrypt packets for the next key phase.

3 years agoMINOR: quic: Add a function to derive the key update secrets
Frédéric Lécaille [Tue, 30 Nov 2021 09:10:24 +0000 (10:10 +0100)] 
MINOR: quic: Add a function to derive the key update secrets

This is the function used to derive an n+1th secret from the nth one as
described in RFC9001 par. 6.1.

3 years agoMINOR: quic: Dynamically allocate the secrete keys
Frédéric Lécaille [Tue, 23 Nov 2021 20:02:04 +0000 (21:02 +0100)] 
MINOR: quic: Dynamically allocate the secrete keys

This is done for any encryption level. This is to prepare the Key Update feature.

3 years agoMINOR: quic: Possible crash when inspecting the xprt context
Frédéric Lécaille [Tue, 23 Nov 2021 14:59:59 +0000 (15:59 +0100)] 
MINOR: quic: Possible crash when inspecting the xprt context

haproxy may crash when running this statement in qc_lstnr_pkt_rcv():
conn_ctx = qc->conn->xprt_ctx;
because qc->conn may not be initialized. With this patch we ensure
qc->conn is correctly initialized before accessing its ->xprt_ctx
members. We zero the xrpt_ctx structure (ssl_conn_ctx struct), then
initialize its ->conn member with HA_ATOMIC_STORE. Then, ->conn and
->conn->xptr_ctx members of quic_conn struct can be accessed with HA_ATOMIC_LOAD()

3 years agoMINOR: quic: Rename qc_prep_hdshk_pkts() to qc_prep_pkts()
Frédéric Lécaille [Tue, 23 Nov 2021 10:36:51 +0000 (11:36 +0100)] 
MINOR: quic: Rename qc_prep_hdshk_pkts() to qc_prep_pkts()

qc_prep_hdshk_pkts() does not prepare only handshake packets but
any type of packet.

3 years agoMINOR: quic: Immediately close if no transport parameters extension found
Frédéric Lécaille [Mon, 22 Nov 2021 14:55:16 +0000 (15:55 +0100)] 
MINOR: quic: Immediately close if no transport parameters extension found

If the ClientHello callback does not manage to find a correct QUIC transport
parameters extension, we immediately close the connection with
missing_extension(109) as TLS alert which is turned into 0x16d QUIC connection
error.

3 years agoMINOR: quic: More accurate immediately close.
Frédéric Lécaille [Mon, 22 Nov 2021 13:25:57 +0000 (14:25 +0100)] 
MINOR: quic: More accurate immediately close.

When sending a CONNECTION_CLOSE frame to immediately close the connection,
do not provide CRYPTO data to the TLS stack. Do not built anything else than a
CONNECTION_CLOSE and do not derive any secret when in immediately close state.
Seize the opportunity of this patch to rename ->err quic_conn struct member
to ->error_code.

3 years agoMINOR: quic: Set "no_application_protocol" alert
Frédéric Lécaille [Fri, 19 Nov 2021 16:02:20 +0000 (17:02 +0100)] 
MINOR: quic: Set "no_application_protocol" alert

We set this TLS error when no application protocol could be negotiated
via the TLS callback concerned. It is converted as a QUIC CRYPTO_ERROR
error (0x178).

3 years agoBUILD: evports: remove a leftover from the dead_fd cleanup
Willy Tarreau [Tue, 30 Nov 2021 08:32:21 +0000 (09:32 +0100)] 
BUILD: evports: remove a leftover from the dead_fd cleanup

Commit b1f29bc62 ("MINOR: activity/fd: remove the dead_fd counter") got
rid of FD_UPDT_DEAD, but evports managed to slip through the cracks and
wasn't cleaned up, thus it doesn't build anymore, as reported in github
issue #1467. We just need to remove the related lines since the situation
is already handled by the remaining conditions.

Thanks to Dominik Hassler for reporting the issue and confirming the fix.

This must be backported to 2.5 only.

3 years agoBUG/MEDIUM: cli: Properly set stream analyzers to process one command at a time
Christopher Faulet [Mon, 18 Oct 2021 12:52:49 +0000 (14:52 +0200)] 
BUG/MEDIUM: cli: Properly set stream analyzers to process one command at a time

The proxy used by the master CLI is an internal proxy and no filter are
registered on it. Thus, there is no reason to take care to set or unset
filter analyzers in the master CLI analyzers. AN_REQ_FLT_END was set on the
request channel to prevent the infinite forward and be sure to be able to
process one commande at a time. However, the only work because
CF_FLT_ANALYZE flag was used by error as a channel analyzer instead of a
channel flag. This erroneously set AN_RES_FLT_END on the request channel,
that really prevent the infinite forward, be side effet.

In fact, We must avoid this kind of trick because this only work by chance
and may be source of bugs in future. Instead, we must always keep the CLI
request analyzer and add an early return if the response is not fully
processed. It happens when the CLI response analyzer is set.

This patch must be backported as far as 2.0.

3 years agoCI: github actions: add the output of $CC -dM -E-
Willy Tarreau [Fri, 26 Nov 2021 14:45:41 +0000 (15:45 +0100)] 
CI: github actions: add the output of $CC -dM -E-

Sometimes figuring what differs between platforms is useful to fix
build issues, to decide what ifdef to add for example. Let's always
call $CC -dM -E- before starting make.

3 years agoBUILD: pools: only detect link-time jemalloc on ELF platforms
Willy Tarreau [Fri, 26 Nov 2021 14:55:55 +0000 (15:55 +0100)] 
BUILD: pools: only detect link-time jemalloc on ELF platforms

The build broke on Windows and MacOS after commit ed232148a ("MEDIUM:
pool: refactor malloc_trim/glibc and jemalloc api addition detections."),
because the extern+attribute(weak) combination doesn't result in a really
weak symbol and it causes an undefined symbol at link time.

Let's reserve this detection to ELF platforms. The runtime detection using
dladdr() remains used if defined.

No backport needed, this is purely 2.6.

3 years agoBUG/MINOR: mworker: deinit of thread poller was called when not initialized
William Lallemand [Fri, 26 Nov 2021 13:43:57 +0000 (14:43 +0100)] 
BUG/MINOR: mworker: deinit of thread poller was called when not initialized

Commit 67e371e ("BUG/MEDIUM: mworker: FD leak of the eventpoll in wait
mode") introduced a regression. Upon a reload it tries to deinit the
poller per thread, but no poll loop was initialized after loading the
configuration.

This patch fixes the issue by moving this part of the code in
mworker_reload(), since this function will be called only when the
poller is fully initialized.

This patch must be backported in 2.5.

3 years agoMEDIUM: pool: support purging jemalloc arenas in trim_all_pools()
David Carlier [Thu, 25 Nov 2021 16:14:38 +0000 (16:14 +0000)] 
MEDIUM: pool: support purging jemalloc arenas in trim_all_pools()

In the case of Linux/glibc, falling back to malloc_trim if jemalloc
had not been detected beforehand.

3 years agoMEDIUM: pool: refactor malloc_trim/glibc and jemalloc api addition detections.
David Carlier [Thu, 25 Nov 2021 16:09:45 +0000 (16:09 +0000)] 
MEDIUM: pool: refactor malloc_trim/glibc and jemalloc api addition detections.

Attempt to detect jemalloc at runtime before hand whether linked or via
symbols overrides, and fall back to malloc_trim/glibc for Linux otherwise.

3 years agoMINOR: quic: use more verbose QUIC traces set at compile-time
Amaury Denoyelle [Thu, 25 Nov 2021 17:06:56 +0000 (18:06 +0100)] 
MINOR: quic: use more verbose QUIC traces set at compile-time

Remove the verbosity set to 0 on quic_init_stdout_traces. This will
generate even more verbose traces on stdout with the default verbosity
of 1 when compiling with -DENABLE_QUIC_STDOUT_TRACES.

3 years agoMINOR: quic: activate QUIC traces at compilation
Amaury Denoyelle [Thu, 25 Nov 2021 15:05:16 +0000 (16:05 +0100)] 
MINOR: quic: activate QUIC traces at compilation

Implement a function quic_init_stdout_traces called at STG_INIT. If
ENABLE_QUIC_STDOUT_TRACES preprocessor define is set, the QUIC trace
module will be automatically activated to emit traces on stdout on the
developer level.

The main purpose for now is to be able to generate traces on the haproxy
docker image used for QUIC interop testing suite. This should facilitate
test failure analysis.

3 years agoMINOR: qpack: support litteral field line with non-huff name
Amaury Denoyelle [Wed, 24 Nov 2021 15:04:03 +0000 (16:04 +0100)] 
MINOR: qpack: support litteral field line with non-huff name

Support qpack header using a non-huffman encoded name in a litteral
field line with name reference.

This format is notably used by picoquic client and should improve
haproxy interop covering.

3 years agoMEDIUM: quic: handle CIDs to rattach received packets to connection
Amaury Denoyelle [Wed, 24 Nov 2021 14:32:46 +0000 (15:32 +0100)] 
MEDIUM: quic: handle CIDs to rattach received packets to connection

Change the way the CIDs are organized to rattach received packets DCID
to QUIC connection. This is necessary to be able to handle multiple DCID
to one connection.

For this, the quic_connection_id structure has been extended. When
allocated, they are inserted in the receiver CID tree instead of the
quic_conn directly. When receiving a packet, the receiver tree is
inspected to retrieve the quic_connection_id. The quic_connection_id
contains now contains a reference to the QUIC connection.

3 years agoCLEANUP: quic: add comments on CID code
Amaury Denoyelle [Wed, 24 Nov 2021 14:29:53 +0000 (15:29 +0100)] 
CLEANUP: quic: add comments on CID code

Add minor comment to explain how the CID are stored in the QUIC
connection.

3 years agoREORG: quic: add comment on rare thread concurrence during CID alloc
Amaury Denoyelle [Wed, 24 Nov 2021 14:16:08 +0000 (15:16 +0100)] 
REORG: quic: add comment on rare thread concurrence during CID alloc

The comment is here to warn about a possible thread concurrence issue
when treating INITIAL packets from the same client. The macro unlikely
is added to further highlight this scarce occurence.

3 years agoMINOR: quic: do not reject PADDING followed by other frames
Amaury Denoyelle [Mon, 22 Nov 2021 14:22:48 +0000 (15:22 +0100)] 
MINOR: quic: do not reject PADDING followed by other frames

It is valid for a QUIC packet to contain a PADDING frame followed by
one or several other frames.

quic_parse_padding_frame() does not require change as it detect properly
the end of the frame with the first non-null byte.

This allow to use quic-go implementation which uses a PADDING-CRYPTO as
the first handshake packet.

3 years agoBUG/MEDIUM: mworker: FD leak of the eventpoll in wait mode
William Lallemand [Thu, 25 Nov 2021 09:03:44 +0000 (10:03 +0100)] 
BUG/MEDIUM: mworker: FD leak of the eventpoll in wait mode

Since 2.5, before re-executing in wait mode, the master can have a
working configuration loaded, with a eventpoll fd. This case was not
handled correctly and a new eventpoll FD is leaking in the master at
each reload, which is inherited by the new worker.

Must be backported in 2.5.

3 years agoBUG/MINOR: mworker: does not add the -sf in wait mode
William Lallemand [Wed, 24 Nov 2021 23:49:19 +0000 (00:49 +0100)] 
BUG/MINOR: mworker: does not add the -sf in wait mode

Since the wait mode is automatically executed after charging the
configuration, -sf was shown in argv[] with the previous PID, which is
normal, but also the current one. This is only a visual problem when
listing the processes, because -sf does not do anything in wait mode.

Fix the issue by removing the whole "-sf" part in wait mode, but the
executed command can be seen in the argv[] of the latest worker forked.

Must be backported in 2.5.

3 years agoBUG/MINOR: lua: remove loop initial declarations
Bertrand Jacquin [Wed, 24 Nov 2021 21:16:06 +0000 (21:16 +0000)] 
BUG/MINOR: lua: remove loop initial declarations

HAProxy is documented to support gcc >= 3.4 as per INSTALL file, however
hlua.c makes use of c11 only loop initial declarations leading to build
failure when using gcc-4.9.4:

  x86_64-unknown-linux-gnu-gcc -Iinclude  -Wchar-subscripts -Wcomment -Wformat -Winit-self -Wmain -Wmissing-braces -Wno-pragmas -Wparentheses -Wreturn-type -Wsequence-point -Wstrict-aliasing -Wswitch -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunused-label -Wunused-variable -Wunused-value -Wpointer-sign -Wimplicit -pthread -fdiagnostics-color=auto -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -O3 -msse -mfpmath=sse -march=core2 -g -fPIC -g -Wall -Wextra -Wundef -Wdeclaration-after-statement -fwrapv -Wno-unused-label -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered -Wno-missing-field-initializers -Wtype-limits      -DUSE_EPOLL  -DUSE_NETFILTER   -DUSE_PCRE2 -DUSE_PCRE2_JIT -DUSE_POLL -DUSE_THREAD -DUSE_BACKTRACE   -DUSE_TPROXY -DUSE_LINUX_TPROXY -DUSE_LINUX_SPLICE -DUSE_LIBCRYPT -DUSE_CRYPT_H -DUSE_GETADDRINFO -DUSE_OPENSSL -DUSE_LUA -DUSE_ACCEPT4   -DUSE_SLZ -DUSE_CPU_AFFINITY -DUSE_TFO -DUSE_NS -DUSE_DL -DUSE_RT      -DUSE_PRCTL  -DUSE_THREAD_DUMP        -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8  -I/usr/local/include -DCONFIG_HAPROXY_VERSION=\"2.5.0\" -DCONFIG_HAPROXY_DATE=\"2021/11/23\" -c -o src/connection.o src/connection.c
  src/hlua.c: In function 'hlua_config_prepend_path':
  src/hlua.c:11292:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
    for (size_t i = 0; i < 2; i++) {
    ^
  src/hlua.c:11292:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code

This commit moves loop iterator to an explicit declaration.

Must be backported to 2.5 because this issue was introduced in
v2.5-dev10~69 with commit 9e5e586e35c5 ("BUG/MINOR: lua: Fix lua error
 handling in `hlua_config_prepend_path()`")

3 years agoMEDIUM: mworker: seamless reload use the internal sockpairs
William Lallemand [Wed, 24 Nov 2021 17:45:37 +0000 (18:45 +0100)] 
MEDIUM: mworker: seamless reload use the internal sockpairs

With the master worker, the seamless reload was still requiring an
external stats socket to the previous process, which is a pain to
configure.

This patch implements a way to use the internal socketpair between the
master and the workers to transfer the sockets during the reload.
This way, the master will always try to transfer the socket, even
without any configuration.

The master will still reload with the -x argument, followed by the
sockpair@ syntax. ( ex -x sockpair@4 ). Which use the FD of internal CLI
to the worker.

3 years agoBUG/MINOR: lua: don't expose internal proxies
William Lallemand [Wed, 24 Nov 2021 15:14:24 +0000 (16:14 +0100)] 
BUG/MINOR: lua: don't expose internal proxies

Since internal proxies are now in the global proxy list, they are now
reachable from core.proxies, core.backends, core.frontends.

This patch fixes the issue by checking the PR_CAP_INT flag before
exposing them in lua, so the user can't have access to them.

This patch must be backported in 2.5.

3 years agoBUG/MINOR: httpclient: allow to replace the host header
William Lallemand [Wed, 24 Nov 2021 14:38:17 +0000 (15:38 +0100)] 
BUG/MINOR: httpclient: allow to replace the host header

This patch allows to replace the host header generated by the
httpclient instead of adding a new one, resulting in the server replying
an error 400.

The host header is now generated from the uri only if it wasn't found in
the list of headers.

Also add a new request in the VTC file to test this.

This patch must be backported in 2.5.

3 years agoBUG/MINOR: cache: Fix loop on cache entries in "show cache"
Christopher Faulet [Tue, 23 Nov 2021 15:03:05 +0000 (16:03 +0100)] 
BUG/MINOR: cache: Fix loop on cache entries in "show cache"

A regression was introduced in the commit da91842b6 ("BUG/MEDIUM: cache/cli:
make "show cache" thread-safe"). When cli_io_handler_show_cache() is called,
only one node is retrieved and is used to fill the output buffer in loop.
Once set, the "node" variable is never renewed. At the end, all nodes are
dumped but each one is duplicated several time into the output buffer.

This patch must be backported everywhere the above commit is. It means only
to 2.5 and 2.4.

3 years ago[RELEASE] Released version 2.6-dev0 v2.6-dev0
Willy Tarreau [Tue, 23 Nov 2021 14:50:11 +0000 (15:50 +0100)] 
[RELEASE] Released version 2.6-dev0

Released version 2.6-dev0 with the following main changes :
    - MINOR: version: it's development again

3 years agoMINOR: version: it's development again
Willy Tarreau [Tue, 23 Nov 2021 14:48:35 +0000 (15:48 +0100)] 
MINOR: version: it's development again

This essentially reverts 9dc4057df064.

3 years ago[RELEASE] Released version 2.5.0 v2.5.0
Willy Tarreau [Tue, 23 Nov 2021 14:40:21 +0000 (15:40 +0100)] 
[RELEASE] Released version 2.5.0

Released version 2.5.0 with the following main changes :
    - BUILD: SSL: add quictls build to scripts/build-ssl.sh
    - BUILD: SSL: add QUICTLS to build matrix
    - CLEANUP: sock: Wrap `accept4_broken = 1` into additional parenthesis
    - BUILD: cli: clear a maybe-unused  warning on some older compilers
    - BUG/MEDIUM: cli: make sure we can report a warning from a bind keyword
    - BUG/MINOR: ssl: make SSL counters atomic
    - CLEANUP: assorted typo fixes in the code and comments
    - BUG/MINOR: ssl: free correctly the sni in the backend SSL cache
    - MINOR: version: mention that it's stable now

3 years agoMINOR: version: mention that it's stable now
Willy Tarreau [Tue, 23 Nov 2021 14:38:10 +0000 (15:38 +0100)] 
MINOR: version: mention that it's stable now

This version will be maintained up to around Q1 2023. The INSTALL file
also mentions it.

3 years agoBUG/MINOR: ssl: free correctly the sni in the backend SSL cache
William Lallemand [Tue, 23 Nov 2021 14:15:09 +0000 (15:15 +0100)] 
BUG/MINOR: ssl: free correctly the sni in the backend SSL cache

__ssl_sock_load_new_ckch_instance() does not free correctly the SNI in
the session cache, it only frees the one in the current tid.

This bug was introduced with e18d4e8 ("BUG/MEDIUM: ssl: backend TLS
resumption with sni and TLSv1.3").

This fix must be backported where the mentionned commit was backported.
(all maintained versions).

3 years agoCLEANUP: assorted typo fixes in the code and comments
Ilya Shipitsin [Sat, 20 Nov 2021 18:11:12 +0000 (23:11 +0500)] 
CLEANUP: assorted typo fixes in the code and comments

This is 28th iteration of typo fixes

3 years agoBUG/MINOR: ssl: make SSL counters atomic
Willy Tarreau [Mon, 22 Nov 2021 16:46:13 +0000 (17:46 +0100)] 
BUG/MINOR: ssl: make SSL counters atomic

SSL counters were added with commit d0447a7c3 ("MINOR: ssl: add counters
for ssl sessions") in 2.4, but their updates were not atomic, so it's
likely that under significant loads they are not correct.

This needs to be backported to 2.4.

3 years agoBUG/MEDIUM: cli: make sure we can report a warning from a bind keyword
Willy Tarreau [Sat, 20 Nov 2021 19:10:41 +0000 (20:10 +0100)] 
BUG/MEDIUM: cli: make sure we can report a warning from a bind keyword

Since recent 2.5 commit c8cac04bd ("MEDIUM: listener: deprecate "process"
in favor of "thread" on bind lines"), the "process" bind keyword may
report a warning. However some parts like the "stats socket" parser
will call such bind keywords and do not expect to face warnings, so
this will instantly cause a fatal error to be reported. A concrete
effect is that "stats socket ... process 1" will hard-fail indicating
the keyword is deprecated and will be removed in 2.7.

We must relax this test, but the code isn't designed to report warnings,
it uses a single string and only supports reporting an error code (-1).

This patch makes a special case of the ERR_WARN code and uses ha_warning()
to report it, and keeps the rest of the existing error code for other
non-warning codes. Now "process" on the "stats socket" is properly
reported as a warning.

No backport is needed.

3 years agoBUILD: cli: clear a maybe-unused warning on some older compilers
Willy Tarreau [Sat, 20 Nov 2021 18:17:38 +0000 (19:17 +0100)] 
BUILD: cli: clear a maybe-unused  warning on some older compilers

The SHOW_TOT() and SHOW_AVG() macros used in cli_io_handler_show_activity()
produce a warning on gcc 4.7 on MIPS with threads disabled because the
compiler doesn't know that global.nbthread is necessarily non-null, hence
that at least one iteration is performed. Let's just change the loop for
a do {} while () that lets the compiler know it's always initialized. It
also has the tiny benefit of making the code shorter.