summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* REGTESTS: ssl: test the TLS resumption2021-11-17-fix-tls-resumeWilliam Lallemand2021-11-181-0/+141
| | | | | This test is able to check if the TLS resumption is working correctly with TLSv1.2, TLSv1.3, with tickets and session cache.
* BUG/MEDIUM: ssl: abort with the correct SSL error when SNI not foundWilliam Lallemand2021-11-181-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | Since commit c2aae74 ("MEDIUM: ssl: Handle early data with OpenSSL 1.1.1"), the codepath of the clientHello callback changed, letting a unknown SNI escaped with a 'return 1' instead of passing through the abort label. This patch switch the code path of the allow_early and abort label, so the default code path is the abort one, letting the clientHello return the correct SSL_AD_UNRECOGNIZED_NAME in case of errors. Which means the client will now receive: OpenSSL error[0x14094458] ssl3_read_bytes: tlsv1 unrecognized name Instead of: OpenSSL error[0x14094410] ssl3_read_bytes: sslv3 alert handshake failure Which was the error emitted before HAProxy 1.8. This patch must be carrefuly backported as far as 1.8 once we validate its impact.
* BUG/MEDIUM: ssl: backend TLS resumption with sni and TLSv1.3William Lallemand2021-11-183-7/+29
| | | | | | | | | | | | | | | | | | | | | When establishing an outboud connection, haproxy checks if the cached TLS session has the same SNI as the connection we are trying to resume. This test was done by calling SSL_get_servername() which in TLSv1.2 returned the SNI. With TLSv1.3 this is not the case anymore and this function returns NULL, which invalidates any outboud connection we are trying to resume if it uses the sni keyword on its server line. This patch fixes the problem by storing the SNI in the "reused_sess" structure beside the session itself. The ssl_sock_set_servername() now have a RWLOCK because this session cache entry could be access by the CLI when trying to update a certificate on the backend. This fix must be backported in every maintained version, however the RWLOCK only exists since version 2.4.
* REGTESTS: extend the default I/O timeouts and make them overridableWilly Tarreau2021-11-18142-506/+512
| | | | | | | | | | | | | | | | | | With the CI occasionally slowing down, we're starting to see again some spurious failures despite the long 1-second timeouts. This reports false positives that are disturbing and doesn't provide as much value as this could. However at this delay it already becomes a pain for developers to wait for the tests to complete. This commit adds support for the new environment variable HAPROXY_TEST_TIMEOUT that will allow anyone to modify the connect, client and server timeouts. It was set to 5 seconds by default, which should be plenty for quite some time in the CI. All relevant values that were 200ms or above were replaced by this one. A few larger values were left as they are special. One test for the set-timeout action that used to rely on a fixed 1-sec value was extended to a fixed 5-sec, as the timeout is normally not reached, but it needs to be known to compare the old and new values.
* REGTESTS: make tcp-check_min-recv fail fastWilly Tarreau2021-11-181-0/+3
| | | | | | | | | | This test was dependent on the check/server timeout to detect a failure, which is not logical since we also use that one as an upper bound for success in the second test, and that needlessly extends the test duration. Let's make sur the timeout strikes immediately with only 1 ms timeout. Now the total tests time is around 5.3-5.4s down from 8.7s in dev14. There is still quite some room for improvement in the peers tests which all wait 2s before starting but this will be more complicated.
* REGTEST: set retries count to zero for all tests that expect at 503Willy Tarreau2021-11-189-1/+9
| | | | | | | | | Some tests expect a 503, typically those that check that wrong CA/CRL will not be accepted between a server and a frontend. But such tests tend to last very long simply because of the 1-second turn-around on connection retries that happens during the failure. Let's properly set the retries count to zero for these ones. One test purposely wants to exhaust the retries so the retries was set to 1 instead.
* SCRIPT: run-regtests: avoid calling awk to compute the versionWilly Tarreau2021-11-181-1/+6
| | | | | | | | | | For each test, the version number is evaluated using a call to awk, which can be slow to start depending on the versions and OS. This is only needed for a printf() call to keep only leading digits of each component, multiply them by 1000 and pad them to 3 digits, something that's clearly doable in plain shell in a portable way. This is what this patch does, and it saves yet another 400 ms here on the full test sequence.
* SCRIPT: run-regtests: avoid several calls to grep to test for featuresWilly Tarreau2021-11-181-2/+5
| | | | | | | grep is used in the arguments loops to check for features such as OPENSSL or LUA or services like prometheus-exporter. Let's just look for the words inside the list, which requires to prepend a delimitor at the beginning of the list and add one at the end.
* SCRIPTS: run-regtests: reduce the number of processes needed to check optionsWilly Tarreau2021-11-181-14/+36
| | | | | | | | | | | | | | | run-tegtests is starting to take a lot of time to spot which tests are eligible, because for each test file a lot of "sed" sub-processes are launched. This commit eliminates calls to sed by using the shell's internal processing and parsing the VTC file only once. Instead of extracting each option one by one from the file, all entries that look like a valid option are passed to a single case/esac statement and their value is extracted. Splitting into lists is simply done by adjusting the IFS depending on the list's delimiter, which, contrary to the // pattern modifier, is supported on every shell. This was tested on both bash and dash, and the tests' execution time dropped by 31% from 8.7 seconds to 6.0 seconds.
* MINOR: config: support default values for environment variablesWilly Tarreau2021-11-182-3/+20
| | | | | | | | | | | | Sometimes it is really useful to be able to specify a default value for an optional environment variable, like the ${name-value} construct in shell. In fact we're really missing this for a number of settings in reg tests, starting with timeouts. This commit simply adds support for the common syntax above. Other common forms like '+' to replace existing variables, or ':-' and ':+' to act on empty variables, were not implemented at this stage, as they are less commonly needed.
* CLEANUP: ssl: fix wrong #else commentaryWilliam Lallemand2021-11-181-1/+1
| | | | | | | | | The else is not for boringSSL but for the lack of Client Hello callback. Should have been changed in 1fc44d4 ("BUILD: ssl: guard Client Hello callbacks with HAVE_SSL_CLIENT_HELLO_CB macro instead of openssl version"). Could be backported in 2.4.
* BUG/MINOR: quic: fix version negotiation packet generationAmaury Denoyelle2021-11-181-2/+2
| | | | | Fix wrong memcpy usage for source and connection ID in generated Version Negotiation packet.
* DOC: internals: document the scheduler APIWilly Tarreau2021-11-181-0/+226
| | | | | | Another non-trivial part that is often needed. Exported functions and flags available to applications were documented as well as some restrictions and falltraps.
* BUG/MEDIUM: mworker: cleanup the listeners when reexecutingWilliam Lallemand2021-11-181-1/+3
| | | | | | | | | | | | | | | | | | | Previously, the cleanup of the listeners was done in mworker_loop(), which was called once the configuration file was parsed. HAProxy was switching in wait mode when the configuration failed to load, so no listeners where created. Since the latest change on the mworker mode, HAProxy switch to wait mode after successfuly loading the configuration, without cleaning its listeners, because it was done in mworker_loop, resulting in the master not closing its listeners and keeping them. The master needs its configuration to know which listeners it need to close, so that must be done before the exec(). This patch fixes the problem by cleaning the listeners in the mworker_reexec() function. No backport needeed.
* MEDIUM: quic: send version negotiation packet on unknown versionAmaury Denoyelle2021-11-181-2/+107
| | | | | | | | | | If the client announced a QUIC version not supported by haproxy, emit a Version Negotiation Packet, according to RFC9000 6. Version Negotiation. This is required to be able to use the framework for QUIC interop testing from https://github.com/marten-seemann/quic-interop-runner. The simulator checks that the server is available by sending packets to force the emission of a Version Negotiation Packet.
* MINOR: quic: support hq-interopAmaury Denoyelle2021-11-184-1/+144
| | | | | | | | | Implement a new app_ops layer for quic interop. This layer uses HTTP/0.9 on top of QUIC. Implementation is minimal, with the intent to be able to pass interoperability test suite from https://github.com/marten-seemann/quic-interop-runner. It is instantiated if the negotiated ALPN is "hq-interop".
* MEDIUM: quic: inspect ALPN to install app_opsAmaury Denoyelle2021-11-184-5/+25
| | | | | | | | | | Remove the hardcoded initialization of h3 layer on mux init. Now the ALPN is looked just after the SSL handshake. The app layer is then installed if the ALPN negotiation returned a supported protocol. This required to add a get_alpn on the ssl_quic layer which is just a call to ssl_sock_get_alpn() from ssl_sock. This is mandatory to be able to use conn_get_alpn().
* MINOR: quic: redirect app_ops snd_buf through muxAmaury Denoyelle2021-11-184-4/+9
| | | | | | | | | | This change is required to be able to use multiple app_ops layer on top of QUIC. The stream-interface will now call the mux snd_buf which is just a proxy to the app_ops snd_buf function. The architecture may be simplified in the structure to install the app_ops on the stream_interface and avoid the detour via the mux layer on the sending path.
* BUG/MINOR: h3: ignore unknown frame typesAmaury Denoyelle2021-11-181-3/+4
| | | | | | | | | When receiving an unknown h3 frame type, the frame must be discarded silently and the processing of the remaing frames must continue. This is according to the HTTP/3 draft34. This issue was detected when using the quiche client which uses GREASE frame to test interoperability.
* DOC: internals: document the list APIWilly Tarreau2021-11-171-0/+195
| | | | | This one is aging and not always trivial. Let's indicate what the macros do and what traps not to fall into.
* REGTESTS: ssl_crt-list_filters: feature cmd incorrectly setWilliam Lallemand2021-11-171-1/+1
| | | | | | | | | | The feature cmd was incorrectly set to: feature cmd "$HAPROXY_PROGRAM -cc 'feature(OPENSSL)' && 'openssl_version_atleast(1.1.1)'" Which was incorrect since the quotes must surrendered the -cc argument. Also the test requires openssl and does not work with libressl.
* BUG/MEDIUM: mux-h1: Handle delayed silent shut in h1_process() to release H1CChristopher Faulet2021-11-151-3/+11
| | | | | | | | | | | | | | | | The commit a85c522d4 ("BUG/MINOR: mux-h1: Save shutdown mode if the shutdown is delayed") revealed several hidden bugs in connection's shutdown handling. One of them is about delayed silent shudown. If outgoing data are not fully sent, we delayed the shutdown. However, in h1_process(), only normal (or clean) shutdown are really detected. If a silent (or dirty) shutdown is performed, the H1 connection is not immediately released. Of course, in this situation, the client never acknowledged the shutdown. Thus, the H1 connection remains open till the client timeout. This patch should fix the issues #1448 and #1453. It must be backported as far as 2.0.
* DOC: log: Add comments to specify when session's listener is defined or notChristopher Faulet2021-11-151-0/+4
| | | | | | | | | When a log message is emitted, The session's listener is always defined when the session's owner is an inbound connection while it is undefined for a health-check. It is not obvious. So, comments have been added to make it clear. This patch is related to the issue #1434.
* CLEANUP: peers: Remove useless test on peer variable in peer_trace()Christopher Faulet2021-11-151-3/+2
| | | | | | A useless test on peer variable was reported by cppcheck in peer_trace(). This patch should fix the issue #1165.
* BUG/MINOR: stick-table/cli: Check for invalid ipv6 keyChristopher Faulet2021-11-151-1/+2
| | | | | | | | | When an ipv6 key is used to filter a CLI command on a stick table (clear/set/show table ...), the return value of inet_pton() call must be checked to be sure the key is valid. This patch should fix the issue #1163. It should be backported to all supported versions.
* [RELEASE] Released version 2.5-dev14v2.5-dev14Willy Tarreau2021-11-144-3/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Released version 2.5-dev14 with the following main changes : - DEV: coccinelle: Remove unused `expression e` - DEV: coccinelle: Add rule to use `istend()` where possible - CLEANUP: Apply ist.cocci - CLEANUP: Re-apply xalloc_size.cocci - CLEANUP: halog: make the default usage message fit in small screens - MINOR: h3/qpack: fix gcc11 warnings - MINOR: mux-quic: fix gcc11 warning - MINOR: h3: fix potential NULL dereference - MINOR: quic: Fix potential null pointer dereference - CLEANUP: halog: remove unused strl2ui() - OPTIM: halog: improve field parser speed for modern compilers - OPTIM: halog: skip fields 64 bits at a time when supported - DEV: coccinelle: Add rule to use `isttrim()` where possible - CLEANUP: Apply ist.cocci - DEV: coccinelle: Add rule to use `chunk_istcat()` instead of `chunk_memcat()` - DEV: coccinelle: Add rule to use `chunk_istcat()` instead of `chunk_strncat()` - CLEANUP: Apply ist.cocci - CLEANUP: chunk: Remove duplicated chunk_Xcat implementation - CLEANUP: chunk: remove misleading chunk_strncat() function - BUG/MINOR: cache: properly ignore unparsable max-age in quotes - Revert "DEV: coccinelle: Add rule to use `chunk_istcat()` instead of `chunk_strncat()`" - DOC: stats: fix location of the text representation - DOC: internals: document the IST API - BUG/MINOR: httpclient/lua: rcv freeze when no request payload - BUG/MEDIUM: httpclient: channel_add_input() must use htx->data - MINOR: promex: backend aggregated server check status - DOC: config: Fix typo in ssl_fc_unique_id description - BUG/MINOR: http-ana: Apply stop to the current section for http-response rules - Revert "BUG/MINOR: http-ana: Don't eval front after-response rules if stopped on back" - DOC: config: Be more explicit in "allow" actions description - DOC: lua: Be explicit with the Reply object limits - MINOR: mux-h1: Slightly Improve H1 traces - BUG/MEDIUM: conn-stream: Don't reset CS flags on close - CLEANUP: mworker: remove any relative PID reference - MEDIUM: mworker: reexec in waitpid mode after successful loading - MINOR: mworker: clarify starting/failure messages - MINOR: mworker: only increment the number of reload in wait mode - MINOR: mworker: implement a reload failure counter - MINOR: mworker: ReloadFailed shown depending on failedreload - MINOR: mworker: change the way we set PROC_O_LEAVING - BUG/MINOR: mworker: doesn't launch the program postparser - DOC: management: edit the "show proc" example to show the current output - BUG/MEDIUM: httpclient/cli: free of unallocated hc->req.uri - REGTESTS: httpclient/lua: add greater body values - BUG/MINOR: mux-h2: Fix H2_CF_DEM_SHORT_READ value - BUG/MINOR: pools: don't mark ourselves as harmless in DEBUG_UAF mode - BUG/MEDIUM: connection: make cs_shutr/cs_shutw//cs_close() idempotent - BUILD: makefile: simplify detection of libatomic
* BUILD: makefile: simplify detection of libatomicWilly Tarreau2021-11-141-9/+17
| | | | | | | | | | | | | | | | | | | | We've had libatomic enabled on arm and aarch64 for some Raspberry PI while usually it's not needed, but it was a bit arbitrary and in issue #1455 it was reported that RISCV requires it for single-byte atomics. This changes the approach to detect the explicit requirement of external functions for the builtins, as reported with *_LOCK_FREE=1. If any of the atomics requires libatomic, it will be used. Older compilers do not report any such atomic as they use sync_* instead and will not match it nor include libatomic (which usually is not present there). On x86, the rules depend on -march. i386 uses LOCK_FREE=1 for all of them. i486 uses it only for the 8-byte CAS and i586 doesn't require it at all. For this reason, the build flags are used during the test. This was tested with armv7, aarch64, mips, riscv, i
* BUG/MEDIUM: connection: make cs_shutr/cs_shutw//cs_close() idempotentWilly Tarreau2021-11-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 1.8 when muxes and conn_streams were introduced, the call to conn_full_close() was replaced with a call to cs_close() which only relied on shutr/shutw (commits 6978db35e ("MINOR: connection: add cs_close() to close a conn_stream") and a553ae96f ("MEDIUM: connection: replace conn_full_close() with cs_close()")). By then this was fine, and the rare risk of non-idempotent calls was addressed by the muxes implementing the functions (e.g. mux_pt). Later with commit 325607397 ("MEDIUM: stream: do not forcefully close the client connection anymore"), stream_free() started to call cs_close() instead of forcibly closing the connection via conn_full_close(). At this point this started to break idempotence because it was possible to emit a shutw() (e.g. when option httpclose was set), then to have it called agian upon stream_free() via cs_close(). By then it was not a problem since only mux_pt would implement this and did check for idempotence. When HTX was implemented and mux-h1/h2 offered support for shutw/shutr, the idempotence changed a little bit because the last shutdown mode (normal/silent) was recorded and used at the moment of closing. The call to cs_close() uses the silent mode and will replace the current one. This has an effect on data pending in the buffer if the FIN could not be sent before cs_close(), because lingering may be disabled and final data lost in the network stack. Interestingly, during 2.4-dev3, this was addressed as the side effect of an improvement by commit 3c82d8b32 ("MINOR: mux-h1: Rework how shutdowns are handled"), where the H1 mux's shutdown function becomes explicitly idempotent. However older versions (2.3 to 2.0) do not have it. This patch addresses the issue globally by making sure that cs_shutr() and cs_shutw() are idempotent and cannot have their data truncated by a late cs_close(). It fixes the truncation that is observed in 2.3 and 2.2 as described in issue #1450. This must be backported as far as 2.0, along with commit f14d750bf ("BUG/MEDIUM: conn-stream: Don't reset CS flags on close") which it depends on.
* BUG/MINOR: pools: don't mark ourselves as harmless in DEBUG_UAF modeWilly Tarreau2021-11-121-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When haproxy is built with DEBUG_UAF=1, some particularly slow allocation functions are used for each pool, and it was not uncommon to see the watchdog trigger during performance tests. For this reason the allocation functions were surrounded by a pair of thread_harmless calls to mention that the function was waiting in slow syscalls. The problem is that this also releases functions blocked in thread_isolate() which can then start their work. In order to protect against the accidental removal of a shared resource in this situation, in 2.5-dev4 with commit ba3ab7907 ("MEDIUM: servers: make the server deletion code run under full thread isolation") was added thread_isolate_full() for functions which want to be totally protected due to being manipulating some data. But this is not sufficient, because there are still places where we can allocate/free (thus sleep) under a lock, such as in long call chains involving the release of an idle connection. In this case, if one thread asks for isolation, one thread might hang in pool_alloc_area_uaf() with a lock held (for example the conns_lock when coming from conn_backend_get()->h1_takeover()->task_new()), with another thread blocked on a lock waiting for that one to release it, both keeping their bit clear in the thread_harmless mask, preventing the first thread from being released, thus causing a deadlock. In addition to this, it was already seen that the "show fd" CLI handler could wake up during a pool_free_area_uaf() with an incompletely released memory area while deleting a file descriptor, and be fooled showing bad pointers, or during a pool_alloc() on another thread that was in the process of registering a freshly allocated connection to a new file descriptor. One solution could consist in replacing all thread_isolate() calls by thread_isolate_full() but then that makes thread_isolate() useless and only shifts the problem by one slot. A better approach could possibly consist in having a way to mark that a thread is entering an extremely slow section. Such sections would be timed so that this is not abused, and the bit would be used to make the watchdog more patient. This would be acceptable as this would only affect debugging. The approach used here for now consists in removing the harmless bits around the UAF allocator, thus essentially undoing commit 85b2cae63 ("MINOR: pools: make the thread harmless during the mmap/munmap syscalls"). This is marked as minor because nobody is expected to be running with DEBUG_UAF outside of development or serious debugging, so this issue cannot affect regular users. It must be backported to stable branches that have thread_harmless_now() around the mmap() call.
* BUG/MINOR: mux-h2: Fix H2_CF_DEM_SHORT_READ valueChristopher Faulet2021-11-101-1/+1
| | | | | | | | | | The value for H2_CF_DEM_SHORT_READ flag is wrong. 2 bits are erroneously set, 0x200 and 0x80000. It is not an issue because both bits are not used anywhere else. The typo was introduced in the commit b5f7b5296 ("BUG/MEDIUM: mux-h2: Handle remaining read0 cases on partial frames"). Thus this patch must also be backported as far a 2.0.
* REGTESTS: httpclient/lua: add greater body valuesWilliam Lallemand2021-11-101-2/+6
| | | | | Add greater body values and checks in order to check the behavior with sizes greater than an haproxy buffer size.
* BUG/MEDIUM: httpclient/cli: free of unallocated hc->req.uriWilliam Lallemand2021-11-101-1/+1
| | | | | | | | | | | | httpclient_new() sets the hc->req.uri ist without duplicating its memory, which is a problem since the string in the ist could be inaccessible at some point. The API was made to use a ist which was allocated dynamically, but httpclient_new() didn't do that, which result in a crash when calling istfree(). This patch fixes the problem by doing an istdup() Fix issue #1452.
* DOC: management: edit the "show proc" example to show the current outputWilliam Lallemand2021-11-101-6/+8
| | | | | | | | The "show proc" output changed and it's time to update the example. The output does not display the relative PID anymore since the nbproc keyword disappeared, and it displays the number of failed reloads since the last successful one.
* BUG/MINOR: mworker: doesn't launch the program postparserWilliam Lallemand2021-11-101-0/+5
| | | | | | | | | | When in wait mode, the mworker-prog postparser is launched, but unfortunately the child structure doesn't contain all required information to be able to launch the test. This test is only required when doing a configuration parsing. Must be backported as far as 2.0.
* MINOR: mworker: change the way we set PROC_O_LEAVINGWilliam Lallemand2021-11-101-4/+12
| | | | | | | | Since the wait mode is always used once we successfuly loaded the configuration, every processes were marked as old workers. To fix this, the PROC_O_LEAVING flag is set only on the processes which have a number of reloads greater than the current processes.
* MINOR: mworker: ReloadFailed shown depending on failedreloadWilliam Lallemand2021-11-101-1/+2
| | | | | | The ReloadFailed prompt in the master CLI is shown only when failedreloads > 0. It was previously using a check on the wait mode, but we always use the wait mode now.
* MINOR: mworker: implement a reload failure counterWilliam Lallemand2021-11-103-2/+24
| | | | | | Implement a reload failure counter which counts the number of failure since the last success. This counter is available in 'show proc' over the master CLI.
* MINOR: mworker: only increment the number of reload in wait modeWilliam Lallemand2021-11-102-2/+10
| | | | | | Since the wait mode will be started in any case of succesful or failed reload, change the way haproxy computes the number of reloads of the processes.
* MINOR: mworker: clarify starting/failure messagesWilliam Lallemand2021-11-101-3/+3
| | | | | | | | | | | | Clarify the startup and reload messages: On a successful configuration load, haproxy will emit "Loading success." after successfuly forked the children. When it didn't success to load the configuration it will emit "Loading failure!". When trying to reload the master process, it will emit "Reloading HAProxy".
* MEDIUM: mworker: reexec in waitpid mode after successful loadingWilliam Lallemand2021-11-101-7/+25
| | | | | | | | | Use the waitpid mode after successfully loading the configuration, this way the memory will be freed in the master, and will preserve the memory. This will be useful when doing a reload with a configuration which has large maps or a lot of SSL certificates, avoiding an OOM because too much memory was allocated in the master.
* CLEANUP: mworker: remove any relative PID referenceWilliam Lallemand2021-11-102-12/+11
| | | | | | | | | nbproc was removed, it's time to remove any reference to the relative PID in the master-worker, since there can be only 1 current haproxy process. This patch cleans up the alerts and warnings emitted during the exit of a process, as well as the "show proc" output.
* BUG/MEDIUM: conn-stream: Don't reset CS flags on closeChristopher Faulet2021-11-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | cs_close() and cs_drain_and_close() are called to close a conn-stream. cs_shutr() and cs_shutw() are called with the appropriate modes. But the conn-stream is not released at this stage. However the flags are reset. Thus, after a cs_close(), we loose shutdown flags. If cs_close() is performed several times, it is a problem. And indeed, it is possible. On one hand, the stream-interface may close the conn-stream. On the other end, the stream always closes it when it is released. It is a problem for the H1 multiplexer. Because the conn-stream flags are reset, the shutr and shutw are performed twice. For a delayed shutdown, the dirty mode is used instead of the normal one because the last call to h1_shutw() overwrite H1C flags set by the first call. This leads to dirty shutdowns while normal ones are required. At the end, it is possible to truncate the messages. This bug was revealed by the commit a85c522d4 ("BUG/MINOR: mux-h1: Save shutdown mode if the shutdown is delayed"). This patch is related to the issue #1450. It must be backported as far as 2.0.
* MINOR: mux-h1: Slightly Improve H1 tracesChristopher Faulet2021-11-101-3/+8
| | | | | Connection and conn-stream pointers and flags are now dumped, if available, in each trace messages. In addition, shutr and shutw mode is now reported.
* DOC: lua: Be explicit with the Reply object limitsChristopher Faulet2021-11-091-5/+13
| | | | | | | | | | | | | | | In HTTP, when a lua action is evaluated, a reply object can be used to send a response to the client and interrupt the transaction. This reply object is converted into HTX and is limited to the response channel buffer. Its size, once converted, cannot exceed the buffer size. There is no streaming at this stage. However, this limitation was not documented. Note that, for now, there is no easy way to know if the reply will fit or not int the response channel buffer. Thus the reply must be reasonably small. Otherwise a 500-Internal-Error message is returned. This patch is related to the issue #1447. It may be backported as far as 2.2.
* DOC: config: Be more explicit in "allow" actions descriptionChristopher Faulet2021-11-091-4/+3
| | | | | | | | | | | TCP/HTTP allow actions stop rules evaluation of the current section only. Only the http-response description was accurate on this point. Thus, the documentation is now explicit on this point for all other concerned rulesets. This patch may be backported, to all supported versions for tcp-request and http-request documentation, and as far as 2.2 for http-after-response documentation.
* Revert "BUG/MINOR: http-ana: Don't eval front after-response rules if ↵Christopher Faulet2021-11-092-9/+8
| | | | | | | | | | | | | | | | | | stopped on back" This reverts commit 597909f4e67866c4f3ecf77f95f2cd4556c0c638 http-after-response rules evaluation was changed to do the same that was done for http-response, in the code. However, the opposite must be performed instead. Only the rules of the current section must be stopped. Thus the above commit is reverted and the http-response rules evaluation will be fixed instead. Note that only "allow" action is concerned. It is most probably an uncommon action for an http-after-request rule. This patch must be backported as far as 2.2 if the above commit was backported.
* BUG/MINOR: http-ana: Apply stop to the current section for http-response rulesChristopher Faulet2021-11-092-1/+3
| | | | | | | | | | | | | | | | | A TCP/HTTP action can stop the rules evaluation. However, it should be applied on the current section only. For instance, for http-requests rules, an "allow" on a frontend must stop evaluation of rules defined in this frontend. But the backend rules, if any, must still be evaluated. For http-response rulesets, according the configuration manual, the same must be true. Only "allow" action is concerned. However, since the beginning, this action stops evaluation of all remaining rules, not only those of the current section. This patch may be backported to all supported versions. But it is not so critical because the bug exists since a while. I doubt it will break any existing configuration because the current behavior is counterintuitive.
* DOC: config: Fix typo in ssl_fc_unique_id descriptionChristopher Faulet2021-11-091-1/+1
| | | | | | | | In ssl_fc_unique_id decription, threre is a reference to the wrong sample fetch. ssl_bc_unique_id is used instead of ssl_fc_unique_id. This patch should fix the issue #1449. It may be backported to all supportted versions.
* MINOR: promex: backend aggregated server check statusWilliam Dauchy2021-11-093-103/+131
| | | | | | | | | | | | | | | | | | | - add new metric: `haproxy_backend_agg_server_check_status` it counts the number of servers matching a specific check status this permits to exclude per server check status as the usage is often to rely on the total. Indeed in large setup having thousands of servers per backend the memory impact is not neglible to store the per server metric. - realign promex_str_metrics array quite simple implementation - we could improve it later by adding an internal state to the prometheus exporter, thus to avoid counting at every dump. this patch is an attempt to close github issue #1312. It may bebackported to 2.4 if requested. Signed-off-by: William Dauchy <wdauchy@gmail.com>
* BUG/MEDIUM: httpclient: channel_add_input() must use htx->datahaproxy-httpclient-lua-2021-11-08William Lallemand2021-11-081-11/+27
| | | | | | | | | | | | | | | | The httpclient uses channel_add_input() to notify the channel layer that it must forward some data. This function was used with b_data(&req->buf) which ask to send the size of a buffer (because of the HTX metadata which fill the buffer completely). This is wrong and will have the consequence of trying to send data that doesn't exist, letting HAProxy looping at 100% CPU. When using htx channel_add_input() must be used with the size of the htx payload, and not the size of a buffer. When sending the request payload it also need to sets the buffer size to 0, which is achieved with a htx_to_buf() when the htx payload is empty.