[PATCH 2/3] MINOR: Add `ha_generate_uuid_v7`

2024-04-19 Thread Tim Duesterhus
This function generates a version 7 UUID as per draft-ietf-uuidrev-rfc4122bis-14. --- include/haproxy/tools.h | 1 + src/tools.c | 25 + 2 files changed, 26 insertions(+) diff --git a/include/haproxy/tools.h b/include/haproxy/tools.h index

[PATCH 3/3] MINOR: Add support for UUIDv7 to the `uuid` sample fetch

2024-04-19 Thread Tim Duesterhus
This adds support for UUIDv7 to the existing `uuid` sample fetch that was added in 8a694b859cf98f8b0855b4aa5a50ebf64b501215. --- doc/configuration.txt | 3 ++- src/sample.c | 40 +--- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git

[PATCH 0/3] Add support for UUIDv7

2024-04-19 Thread Tim Duesterhus
No reg-tests added, as those doesn't allow meaningfully testing that the UUIDv7 is actually a UUIDv7. I have manually checked the output against https://uuid7.com/. Best regards Tim Duesterhus (3): MINOR: tools: Rename `ha_generate_uuid` to `ha_generate_uuid_v4` MINOR: Add `ha_generate_uuid_v7`

[PATCH 1/3] MINOR: tools: Rename `ha_generate_uuid` to `ha_generate_uuid_v4`

2024-04-19 Thread Tim Duesterhus
This is in preparation of adding support for other UUID versions. --- addons/ot/src/scope.c | 2 +- include/haproxy/tools.h | 2 +- src/flt_spoe.c | 2 +- src/sample.c| 2 +- src/tools.c | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git

[PATCH] MINOR: systemd: Include MONOTONIC_USEC field in RELOADING=1 message

2024-04-03 Thread Tim Duesterhus
As per the `sd_notify` manual: > A field carrying the monotonic timestamp (as per CLOCK_MONOTONIC) formatted > in decimal in μs, when the notification message was generated by the client. > This is typically used in combination with "RELOADING=1", to allow the > service manager to properly

[PATCH 2/4] CLEANUP: Reapply strcmp.cocci (2)

2024-03-29 Thread Tim Duesterhus
This reapplies strcmp.cocci across the whole src/ tree. --- src/event_hdl.c | 2 +- src/hlua_fcn.c | 8 src/sample.c| 2 +- src/tcp_act.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/event_hdl.c b/src/event_hdl.c index f5bb5b6e7e..f4f7b19e4d 100644

[PATCH 3/4] CLEANUP: Reapply xalloc_cast.cocci

2024-03-29 Thread Tim Duesterhus
This reapplies xalloc_cast.cocci across the whole src/ tree. --- src/cpuset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpuset.c b/src/cpuset.c index 82e350f132..a20b81a25d 100644 --- a/src/cpuset.c +++ b/src/cpuset.c @@ -280,7 +280,7 @@ int cpu_map_configured(void)

[PATCH 1/4] CLEANUP: Reapply ist.cocci (3)

2024-03-29 Thread Tim Duesterhus
This reapplies ist.cocci across the whole src/ tree. --- src/resolvers.c | 4 ++-- src/stick_table.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/resolvers.c b/src/resolvers.c index f97fb29b01..d68208555f 100644 --- a/src/resolvers.c +++ b/src/resolvers.c @@

[PATCH 2/2] REGTESTS: Remove REQUIRE_VERSION=1.9 from all tests (2)

2024-03-29 Thread Tim Duesterhus
see also: 2a5fb62ad REGTESTS: Remove REQUIRE_VERSION=1.9 from all tests --- reg-tests/http-messaging/truncated.vtc | 1 - 1 file changed, 1 deletion(-) diff --git a/reg-tests/http-messaging/truncated.vtc b/reg-tests/http-messaging/truncated.vtc index 7579f6d763..7f262d75dc 100644 ---

[PATCH 1/2] REGTESTS: Do not use REQUIRE_VERSION for HAProxy 2.5+ (4)

2024-03-29 Thread Tim Duesterhus
Introduced in: dfb1cea69 REGTESTS: promex: Adapt script to be less verbose 36d936dd1 REGTESTS: write a full reverse regtest b57f15158 REGTESTS: provide a reverse-server test with name argument f0bff2947 REGTESTS: provide a reverse-server test see also: fbbbc33df REGTESTS: Do not use

[PATCH] CI: Update to actions/cache@v4

2024-02-08 Thread Tim Duesterhus
No functional change, but this upgrade is required, due to the v3 runtime being deprecated: > Node.js 16 actions are deprecated. Please update the following actions to use > Node.js 20: actions/cache@v3. For more information see: >

[PATCH] DOC: config: add missing colon to "bytes_out" sample fetch keyword (2)

2023-11-30 Thread Tim Duesterhus
This reapplies 1eb049dc677f2de950158615ed3d8306ee5102d6, as the change was accidentally reverted in 5ef48e063ecf992646c7af374153f106050fb8ec. --- doc/configuration.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index

[PATCH 1/3] REGTESTS: sample: Test the behavior of consecutive delimiters for the field converter

2023-11-30 Thread Tim Duesterhus
This is in preparation of a follow-up patch to fix the word converter. --- reg-tests/converter/field.vtc | 4 1 file changed, 4 insertions(+) diff --git a/reg-tests/converter/field.vtc b/reg-tests/converter/field.vtc index 1243728c01..3b1d8198e3 100644 --- a/reg-tests/converter/field.vtc

[PATCH 2/3] BUG/MINOR: sample: Make the `word` converter compatible with `-m found`

2023-11-30 Thread Tim Duesterhus
Previously an expression like: path,word(2,/) -m found always returned `true`. Bug exists since the `word` converter exists. That is: c9a0f6d0232cf44d6b08d1964b9097a45a6c65f0 The same bug was previously fixed for the `field` converter in commit 4381d26edc03faa46401eb0fe82fd7be84be14fd.

[PATCH 3/3] DOC: Clarify the differences between field() and word()

2023-11-30 Thread Tim Duesterhus
word() mentions that delimiters at the start and end are ignored, but it does not mention that consecutive delimiters are merged. May be backported as far as the patch applies. --- doc/configuration.txt | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git

[PATCH] CLEANUP: Re-apply xalloc_size.cocci (3)

2023-11-05 Thread Tim Duesterhus
This reapplies the xalloc_size.cocci patch across the whole `src/` tree. see 16cc16dd8235e7eb6c38b7abd210bd1e1d96b1d9 see 63ee0e4c01b94aee5fc6c6dd98cfc4480ae5ea46 see 9fb57e8c175a0b852b06a0780f48eb8eaf321a47 --- src/log.c| 3 ++- src/proto_quic.c | 2 +- src/server.c | 4 ++--

[PATCH] CI: Update to actions/checkout@v4

2023-09-06 Thread Tim Duesterhus
No functional change, but we should keep this current. see 5f4ddb54b05ae0355b1f64c22263a6bc381410df --- .github/workflows/aws-lc.yml | 2 +- .github/workflows/codespell.yml| 2 +- .github/workflows/compliance.yml | 2 +- .github/workflows/contrib.yml

[PATCH] REGTESTS: Do not use REQUIRE_VERSION for HAProxy 2.5+ (3)

2023-08-07 Thread Tim Duesterhus
Introduced in: 424981cde REGTEST: add ifnone-forwardfor test b015b3eb1 REGTEST: add RFC7239 forwarded header tests see also: fbbbc33df REGTESTS: Do not use REQUIRE_VERSION for HAProxy 2.5+ --- reg-tests/http-rules/forwarded-header-7239.vtc | 2 +- reg-tests/http-rules/ifnone-forwardfor.vtc

[PATCH] BUG/MINOR: Fix Lua's `get_stats` function

2023-06-01 Thread Tim Duesterhus
Lua's `get_stats` function stopped working in 4cfb0019e65bce79953164eddf54c1bbb61add62, due to the addition a new field ST_F_PROTO without a corresponding entry in `stat_fields`. Fix the issue by adding the entry, like a46b142e8807ea640e041d3a29e3fd427844d559 did previously for a different field.

[PATCH] BUG/MINOR: ssl: Stop leaking `err` in ssl_sock_load_ocsp()

2023-03-19 Thread Tim Duesterhus
Previously performing a config check of `.github/h2spec.config` would report a 20 byte leak as reported in GitHub Issue #2082. The leak was introduced in a6c0a59e9af65180c3ff591b91855bea8d19b352, which is dev only. No backport needed. --- src/ssl_sock.c | 2 ++ 1 file changed, 2 insertions(+)

[PATCH 3/3] REGTESTS: Remove tests with REQUIRE_VERSION_BELOW=1.9

2023-01-04 Thread Tim Duesterhus
HAProxy 2.0 is the lowest supported version, thus this never matches. --- reg-tests/http-rules/h1_to_h1c.vtc | 186 - 1 file changed, 186 deletions(-) delete mode 100644 reg-tests/http-rules/h1_to_h1c.vtc diff --git a/reg-tests/http-rules/h1_to_h1c.vtc

[PATCH 1/3] REGTESTS: Remove REQUIRE_VERSION=1.9 from all tests

2023-01-04 Thread Tim Duesterhus
HAProxy 2.0 is the lowest supported version, thus this always matches. see 1b095cac9468d0c3eeb157e9b1a2947487bd3c83 --- reg-tests/cache/basic.vtc | 2 -- reg-tests/cache/sample_fetches.vtc | 2 -- reg-tests/compression/basic.vtc

[PATCH 2/3] REGTESTS: Remove REQUIRE_VERSION=2.0 from all tests

2023-01-04 Thread Tim Duesterhus
HAProxy 2.0 is the lowest supported version, thus this always matches. see 1b095cac9468d0c3eeb157e9b1a2947487bd3c83 --- reg-tests/balance/balance-uri.vtc | 1 - reg-tests/checks/tcp-checks-socks4.vtc | 1 - reg-tests/http-rules/acl_cli_spaces.vtc| 2 --

[PATCH 2/6] CI: Add in-memory cache for the latest OpenSSL/LibreSSL

2022-12-29 Thread Tim Duesterhus
These functions were previously called once per compiler. Add the `lru_cache` decorator to only perform one HTTP request each. --- .github/matrix.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/matrix.py b/.github/matrix.py index 7cd04e88a6..3df259cd8c 100755 ---

[PATCH 6/6] CI: Reformat `matrix.py` using `black`

2022-12-29 Thread Tim Duesterhus
The initial version of matrix.py was formatted using `black` [1], but with all the later changes, the formatting diverged quite a bit. This patch reformats the script using black, fixing the indentation of some statements and shortening overlong lines. [1] https://github.com/psf/black ---

[PATCH 1/6] CI: Improve headline in matrix.py

2022-12-29 Thread Tim Duesterhus
Since 4a04cd35ae89bf6a3bb7620f7a49804de3240ac4 (CI: github: split ssl lib selection based on git branch) the branch, instead of the workflow type is passed. The headline should reflect that. --- .github/matrix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH 5/6] CI: Explicitly check environment variable against `None` in matrix.py

2022-12-29 Thread Tim Duesterhus
For consistency with `GITHUB_OUTPUT` at the bottom. --- .github/matrix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/matrix.py b/.github/matrix.py index e03453aa4d..c58bb7acd4 100755 --- a/.github/matrix.py +++ b/.github/matrix.py @@ -29,7 +29,7 @@ def

[PATCH 0/5] Changes to matrix.py

2022-12-29 Thread Tim Duesterhus
with. Best regards Tim Duesterhus (6): CI: Improve headline in matrix.py CI: Add in-memory cache for the latest OpenSSL/LibreSSL CI: Use proper `if` blocks instead of conditional expressions in matrix.py CI: Unify the `GITHUB_TOKEN` name across matrix.py and vtest.yml CI: Explicitly check

[PATCH 4/6] CI: Unify the `GITHUB_TOKEN` name across matrix.py and vtest.yml

2022-12-29 Thread Tim Duesterhus
This makes naming a little clearer in matrix.py, because the name matches the name of the actual secret. --- .github/matrix.py | 4 ++-- .github/workflows/vtest.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/matrix.py b/.github/matrix.py index

[PATCH 3/6] CI: Use proper `if` blocks instead of conditional expressions in matrix.py

2022-12-29 Thread Tim Duesterhus
For complex expressions, such as the ones modified, the condition expression is much less readable, especially with the actual condition in the middle of the "then" and "else" part. --- .github/matrix.py | 29 - 1 file changed, 24 insertions(+), 5 deletions(-) diff

[PATCH] CI: Add `schedule` to vtest.yml

2022-12-06 Thread Tim Duesterhus
William, On 12/6/22 19:40, William Lallemand wrote: > I disagree, porting to a new API is not something you would do just > before a release, you need to do it progressively if possible, because > it could introduce heavy development and sometimes discussions with the > library developers and

[PATCH 2/2] CI: Replace the deprecated `::set-output` command by writing to $GITHUB_OUTPUT in workflow definition

2022-10-14 Thread Tim Duesterhus
See "CI: Replace the deprecated `::set-output` command by writing to $GITHUB_OUTPUT in matrix.py" for the reasoning behind this commit. --- .github/workflows/compliance.yml | 4 ++-- .github/workflows/vtest.yml | 4 ++-- .github/workflows/windows.yml| 2 +- 3 files changed, 5

[PATCH 1/2] CI: Replace the deprecated `::set-output` command by writing to $GITHUB_OUTPUT in matrix.py

2022-10-14 Thread Tim Duesterhus
As announced in https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ the `::set-output` command is deprecated, because processes during the workflow execution might output untrusted information that might include the `::set-output` command, thus

[PATCH 2/2] CLEANUP: Reapply strcmp.cocci

2022-10-08 Thread Tim Duesterhus
This reapplies strcmp.cocci across the whole src/ tree. --- src/cfgparse-quic.c | 4 ++-- src/flt_bwlim.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cfgparse-quic.c b/src/cfgparse-quic.c index 5268e9adaf..f6706f2e0d 100644 --- a/src/cfgparse-quic.c +++

[PATCH 0/2] Reapply Coccinelle patches

2022-10-08 Thread Tim Duesterhus
Willy, as with the past branches, I've reapplied the Coccinelle patches to do some cleanup before the release. Best regards Tim Duesterhus (2): CLEANUP: Reapply ist.cocci (2) CLEANUP: Reapply strcmp.cocci src/cfgparse-quic.c | 4 ++-- src/flt_bwlim.c | 4 ++-- src/hlua.c | 3

[PATCH 1/2] CLEANUP: Reapply ist.cocci (2)

2022-10-08 Thread Tim Duesterhus
This reapplies ist.cocci across the whole src/ tree. --- src/hlua.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/hlua.c b/src/hlua.c index 19932a5b12..1595368796 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -6511,8 +6511,7 @@ static void _hlua_http_msg_delete(struct

[PATCH] CLEANUP: Re-apply xalloc_size.cocci (2)

2022-06-01 Thread Tim Duesterhus
This reapplies the xalloc_size.cocci patch across the whole `src/` tree. see 16cc16dd8235e7eb6c38b7abd210bd1e1d96b1d9 see 63ee0e4c01b94aee5fc6c6dd98cfc4480ae5ea46 --- src/ncbuf.c | 2 +- src/proto_quic.c | 2 +- src/quic_sock.c | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-)

[haproxy/docs PATCH] Replace `primary` with `info` for HAProxy 2.5 on index.html

2022-05-31 Thread Tim Duesterhus
2.5 is neither the newest stable version, nor the newest LTS version, thus there is no reason for it to be highlighted. --- docs/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.html b/docs/index.html index 4aa77c9..403fce9 100644 --- a/docs/index.html +++

[PATCH] DOC: Fix formatting in configuration.txt to fix dconv

2022-05-27 Thread Tim Duesterhus
The missing space before the colon causes haproxy-dconv to misparse the configuration.txt. --- doc/configuration.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index 3a5728539..6343f9f13 100644 --- a/doc/configuration.txt

[PATCH] REGTESTS: Do not use REQUIRE_VERSION for HAProxy 2.5+ (2)

2022-05-23 Thread Tim Duesterhus
Introduced in: 18c13d3bd MEDIUM: http-ana: Add a proxy option to restrict chars in request header names see also: fbbbc33df REGTESTS: Do not use REQUIRE_VERSION for HAProxy 2.5+ --- reg-tests/http-rules/restrict_req_hdr_names.vtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH v2] CLEANUP: tools: Crash if inet_ntop fails due to ENOSPC in sa2str

2022-05-23 Thread Tim Duesterhus
This is impossible, because we pass a destination buffer that is appropriately sized to hold an IPv6 address. This is related to GitHub issue #1599. --- src/tools.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools.c b/src/tools.c index 79d1d5c9b..4ecbdc4d7 100644

[PATCH 1/2] BUG/MEDIUM: tools: Fix `inet_ntop` usage in sa2str

2022-05-22 Thread Tim Duesterhus
The given size must be the size of the destination buffer, not the size of the (binary) address representation. This fixes GitHub issue #1599. The bug was introduced in 92149f9a82a9b55c598f1cc815bc330c555f3561 which is in 2.4+. The fix must be backported there. --- src/tools.c | 2 +- 1 file

[PATCH 2/2] CLEANUP: tools: Crash if inet_ntop fails in sa2str

2022-05-22 Thread Tim Duesterhus
This is impossible, because we pass a destination buffer that is appropriately sized to hold an IPv6 address. This is related to GitHub issue #1599. --- src/tools.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools.c b/src/tools.c index b9a1121c6..ce82fea4a 100644

[PATCH] CLEANUP: tools: Clean up non-QUIC error message handling in str2sa_range()

2022-05-22 Thread Tim Duesterhus
If QUIC support is enabled both branches of the ternary conditional are identical, upsetting Coverity. Move the full conditional into the non-QUIC preprocessor branch to make the code more clear. This resolves GitHub issue #1710. --- src/tools.c | 7 --- 1 file changed, 4 insertions(+), 3

[PATCH] CLEANUP: http_ana: Make use of the return value of stream_generate_unique_id()

2022-05-17 Thread Tim Duesterhus
Even if `unique_id` and `s->unique_id` are identical it is a bit odd to `isttest()` `unique_id` and then use `s->unique_id` in the call to `http_add_header()`. This "issue" was introduced in a17e66289c08a5bfadc1bb5b5f2c618c9299fe1b, because before that commit the function returned the length of

[PATCH v2 2/3] CLEANUP: Add missing header to hlua_fcn.c

2022-05-14 Thread Tim Duesterhus
Found with -Wmissing-prototypes: src/hlua_fcn.c:53:5: fatal error: no previous prototype for function 'hlua_checkboolean' [-Wmissing-prototypes] int hlua_checkboolean(lua_State *L, int index) ^ src/hlua_fcn.c:53:1: note: declare 'static' if the function is not intended to be

[PATCH 3/3] CLEANUP: Remove unused function hlua_get_top_error_string

2022-05-14 Thread Tim Duesterhus
This function has no prototype defined in a header and is not used in hlua.c either, thus it can be safely removed. Found with -Wmissing-prototypes. --- src/hlua.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/src/hlua.c b/src/hlua.c index ef967a515..abe3556b6 100644 ---

[PATCH 1/3] CLEANUP: Add missing header to ssl_utils.c

2022-05-14 Thread Tim Duesterhus
Found with -Wmissing-prototypes: src/ssl_utils.c:22:5: fatal error: no previous prototype for function 'cert_get_pkey_algo' [-Wmissing-prototypes] int cert_get_pkey_algo(X509 *crt, struct buffer *out) ^ src/ssl_utils.c:22:1: note: declare 'static' if the function is not

[PATCH 2/3] CLEANUP: Add missing header to ssl_utils.c

2022-05-14 Thread Tim Duesterhus
Found with -Wmissing-prototypes: src/hlua_fcn.c:53:5: fatal error: no previous prototype for function 'hlua_checkboolean' [-Wmissing-prototypes] int hlua_checkboolean(lua_State *L, int index) ^ src/hlua_fcn.c:53:1: note: declare 'static' if the function is not intended to be

[PATCH] MINOR: Call deinit_and_exit(0) for `haproxy -vv`

2022-04-26 Thread Tim Duesterhus
It appears that it is safe to call perform a clean deinit at this point, so let's do this to exercise the deinit paths some more. Running `valgrind --leak-check=full --show-leak-kinds=all ./haproxy -vv` with this change reports: ==261864== HEAP SUMMARY: ==261864== in use at exit: 344

[PATCH] CLEANUP: Destroy `http_err_chunks` members during deinit

2022-04-26 Thread Tim Duesterhus
To make the deinit function a proper inverse of the init function we need to free the `http_err_chunks`: ==252081== 311,296 bytes in 19 blocks are still reachable in loss record 50 of 50 ==252081==at 0x483B7F3: malloc (in

[PATCH] BUG/MINOR: Fix memory leak in resolvers_deinit()

2022-04-26 Thread Tim Duesterhus
A config like the following: global stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners resolvers unbound nameserver unbound 127.0.0.1:53 will report the following leak when running a configuration check: ==241882== 6,991 (6,952 direct, 39

[PATCH 1/2] CI: Update to actions/checkout@v3

2022-04-09 Thread Tim Duesterhus
No functional change, but we should keep this current. --- .github/workflows/codespell.yml| 2 +- .github/workflows/compliance.yml | 2 +- .github/workflows/contrib.yml | 2 +- .github/workflows/coverity.yml | 2 +- .github/workflows/musl.yml

[PATCH 2/2] CI: Update to actions/cache@v3

2022-04-09 Thread Tim Duesterhus
No functional changes for our use case, but we should keep this current. --- .github/workflows/vtest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/vtest.yml b/.github/workflows/vtest.yml index e413b20f5..7a1c1ef62 100644 ---

[PATCH 2/4] CLEANUP: Reapply ist.cocci with `--include-headers-for-types --recursive-includes`

2022-03-15 Thread Tim Duesterhus
Previous uses of `ist.cocci` did not add `--include-headers-for-types` and `--recursive-includes` preventing Coccinelle seeing `struct ist` members of other structs. Reapply the patch with proper flags to further clean up the use of the ist API. The command used was: spatch -sp_file

[PATCH 0/4] Using Coccinelle the right way

2022-03-15 Thread Tim Duesterhus
're seeing. I've fixed a bug in the ist.cocci, reapplied it on the whole tree and then turned the bugfix into another rule and applied that one. Best regards Tim Duesterhus (4): DEV: coccinelle: Fix incorrect replacement in ist.cocci CLEANUP: Reapply ist.cocci with `--include-headers

[PATCH 3/4] DEV: coccinelle: Add a new pattern to ist.cocci

2022-03-15 Thread Tim Duesterhus
This was previously ignored in "DEV: coccinelle: Fix incorrect replacement in ist.cocci", but is now properly replaced by a simple `ist()` call. --- dev/coccinelle/ist.cocci | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dev/coccinelle/ist.cocci

[PATCH 4/4] CLEANUP: Reapply ist.cocci

2022-03-15 Thread Tim Duesterhus
This makes use of the newly added: - i.ptr = p; - i.len = strlen(i.ptr); + i = ist(p); patch. --- src/http_act.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/http_act.c b/src/http_act.c index b7ec31241..133a30c6a 100644 ---

[PATCH 1/4] DEV: coccinelle: Fix incorrect replacement in ist.cocci

2022-03-15 Thread Tim Duesterhus
We must not use `ist2()` if the value of `i.len` is derived from the value of `i.ptr`: i.ptr = "foo"; i.len = strlen(i.ptr); --- dev/coccinelle/ist.cocci | 5 + 1 file changed, 5 insertions(+) diff --git a/dev/coccinelle/ist.cocci b/dev/coccinelle/ist.cocci index

[PATCH] REGTESTS: Do not use REQUIRE_VERSION for HAProxy 2.5+

2022-03-11 Thread Tim Duesterhus
Introduced in: 0657b9338 MINOR: stream: add "last_rule_file" and "last_rule_line" samples --- reg-tests/log/last_rule.vtc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reg-tests/log/last_rule.vtc b/reg-tests/log/last_rule.vtc index b57251912..e69516654 100644 ---

[PATCH 6/6] CLEANUP: fcgi: Use `istadv()` in `fcgi_strm_send_params`

2022-03-04 Thread Tim Duesterhus
Found manually, while creating the previous commits to turn `struct proxy` members into ists. There is an existing Coccinelle rule to replace this pattern by `istadv()` in `ist.cocci`: @@ struct ist i; expression e; @@ - i.ptr += e; - i.len -= e; + i = istadv(i, e);

[PATCH 5/6] CLEANUP: fcgi: Replace memcpy() on ist by istcat()

2022-03-04 Thread Tim Duesterhus
This is a little cleaner, because the length of the resulting string does not need to be calculated manually. --- src/mux_fcgi.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c index a22bc9391..0a8679019 100644 --- a/src/mux_fcgi.c +++

[PATCH 0/6] 'ist'ify members of struct proxy

2022-03-04 Thread Tim Duesterhus
, but I didn't specifically test FCGI (and there are no exiting reg-tests for that). So please carefully check the patches for dumb mistakes. Best regards Tim Duesterhus (6): MINOR: proxy: Store monitor_uri as a `struct ist` MINOR: proxy: Store fwdfor_hdr_name as a `struct ist` MINOR: proxy

[PATCH 1/6] MINOR: proxy: Store monitor_uri as a `struct ist`

2022-03-04 Thread Tim Duesterhus
The monitor_uri is already processed as an ist in `http_wait_for_request`, lets also just store it as such. see 0643b0e7e ("MINOR: proxy: Make `header_unique_id` a `struct ist`") for a very similar past commit. --- include/haproxy/proxy-t.h | 3 +-- src/cfgparse-listen.c | 9 +++--

[PATCH 4/6] MEDIUM: proxy: Store server_id_hdr_name as a `struct ist`

2022-03-04 Thread Tim Duesterhus
The server_id_hdr_name is already processed as an ist in various locations lets also just store it as such. see 0643b0e7e ("MINOR: proxy: Make `header_unique_id` a `struct ist`") for a very similar past commit. --- include/haproxy/proxy-t.h | 3 +-- src/cfgparse-listen.c | 9 -

[PATCH 3/6] MINOR: proxy: Store orgto_hdr_name as a `struct ist`

2022-03-04 Thread Tim Duesterhus
The orgto_hdr_name is already processed as an ist in `http_process_request`, lets also just store it as such. see 0643b0e7e ("MINOR: proxy: Make `header_unique_id` a `struct ist`") for a very similar past commit. --- include/haproxy/proxy-t.h | 3 +-- src/cfgparse-listen.c | 14

[PATCH 2/6] MINOR: proxy: Store fwdfor_hdr_name as a `struct ist`

2022-03-04 Thread Tim Duesterhus
The fwdfor_hdr_name is already processed as an ist in `http_process_request`, lets also just store it as such. see 0643b0e7e ("MINOR: proxy: Make `header_unique_id` a `struct ist`") for a very similar past commit. --- include/haproxy/proxy-t.h | 3 +-- src/cfgparse-listen.c | 14

[PATCH] MINOR: queue: Replace if() + abort() with BUG_ON()

2022-02-28 Thread Tim Duesterhus
see 5cd4bbd7a ("BUG/MAJOR: threads/queue: Fix thread-safety issues on the queues management") --- src/queue.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/queue.c b/src/queue.c index b1be766b9..002b94b85 100644 --- a/src/queue.c +++ b/src/queue.c @@

[PATCH 2/2] MINOR: connection: Transform safety check in PROXYv2 parsing into BUG_ON()

2022-02-25 Thread Tim Duesterhus
With BUG_ON() being enabled by default it is more useful to use a BUG_ON() instead of an effectively never-taken if, as any incorrect assumptions will become much more visible. see 488ee7fb6e4a388bb68153341826a6391da794e9 --- src/connection.c | 9 - 1 file changed, 4 insertions(+), 5

[PATCH 1/2] CLEANUP: connection: Indicate unreachability to the compiler in conn_recv_proxy

2022-02-25 Thread Tim Duesterhus
Transform the unreachability comment into a call to `my_unreachable()` to allow the compiler from benefitting from it. see d1b15b6e9b4d4d378a6169929a86f25b95eafc57 see 615f81eb5ad3e8c691901db8ce3e6a4a6b6efa49 --- src/connection.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-)

[PATCH] CI: Consistently use actions/checkout@v2

2022-01-28 Thread Tim Duesterhus
v2 is the current version of the checkout action and faster than v1. --- .github/workflows/compliance.yml | 2 +- .github/workflows/musl.yml | 2 +- .github/workflows/openssl-nodeprecated.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git

[PATCH] REGTESTS: Remove REQUIRE_VERSION=1.8 from all tests

2022-01-28 Thread Tim Duesterhus
HAProxy 1.8 is the lowest supported version, thus this always matches. see 1b095cac9468d0c3eeb157e9b1a2947487bd3c83 --- reg-tests/checks/agent-check.vtc | 1 - reg-tests/seamless-reload/abns_socket.vtc | 1 - reg-tests/server/cli_set_fdqn.vtc | 1 - 3 files changed, 3

[PATCH] BUG/MEDIUM: sample: Fix memory leak in sample_conv_jwt_member_query

2021-12-01 Thread Tim Duesterhus
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+.

[PATCH] CLEANUP: Wrap `accept4_broken = 1` into additional parenthesis

2021-11-20 Thread Tim Duesterhus
This makes it clear to static analysis tools that this assignment is intentional and not a mistyped comparison. --- src/sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sock.c b/src/sock.c index e3d4a6e4c..f11c5b0c4 100644 --- a/src/sock.c +++ b/src/sock.c @@ -74,7

[PATCH 5/6] CLEANUP: Apply ist.cocci

2021-11-08 Thread Tim Duesterhus
This is to make use of `chunk_istcat()`. --- src/cache.c | 2 +- src/http_fetch.c | 2 +- src/http_htx.c | 4 ++-- src/mux_fcgi.c | 10 +- src/tcpcheck.c | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/cache.c b/src/cache.c index

[PATCH 6/6] CLEANUP: chunk: Remove duplicated chunk_Xcat implementation

2021-11-08 Thread Tim Duesterhus
Delegate chunk_istcat, chunk_cat and chunk_strncat to the most generic chunk_memcat. --- include/haproxy/chunk.h | 41 + 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/include/haproxy/chunk.h b/include/haproxy/chunk.h index

[PATCH 0/6] Probably final Coccinelle Cleanup

2021-11-08 Thread Tim Duesterhus
Hi Willy, find my (probably :-) ) final CLEANUP series for 2.5. Regarding the final patch: 'chunk_strncat()' appears to be completely redundant, it simply passes through the arguments and even takes an int instead of a size_t. Should it be removed? Best regards Tim Düsterhus Tim Duesterhus (6

[PATCH 1/6] DEV: coccinelle: Add rule to use `isttrim()` where possible

2021-11-08 Thread Tim Duesterhus
This replaces `if (i.len > e) i.len = e;` by `isttrim(i, e)`. --- dev/coccinelle/ist.cocci | 8 1 file changed, 8 insertions(+) diff --git a/dev/coccinelle/ist.cocci b/dev/coccinelle/ist.cocci index 5b6aa6b2c..7e9a6ac05 100644 --- a/dev/coccinelle/ist.cocci +++

[PATCH 3/6] DEV: coccinelle: Add rule to use `chunk_istcat()` instead of `chunk_memcat()`

2021-11-08 Thread Tim Duesterhus
This replaces `chunk_memcat()` with `chunk_istcat()` if the parameters are the ist's `.ptr` and `.len`. --- dev/coccinelle/ist.cocci | 8 1 file changed, 8 insertions(+) diff --git a/dev/coccinelle/ist.cocci b/dev/coccinelle/ist.cocci index 7e9a6ac05..4945141b2 100644 ---

[PATCH 2/6] CLEANUP: Apply ist.cocci

2021-11-08 Thread Tim Duesterhus
Make use of the new rules to use `isttrim()`. --- src/cache.c | 3 +-- src/flt_trace.c | 3 +-- src/hlua.c | 6 ++ src/http_ana.c | 3 +-- src/log.c | 6 ++ 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/cache.c b/src/cache.c index ba2b63c49..e871a7b30

[PATCH 4/6] DEV: coccinelle: Add rule to use `chunk_istcat()` instead of `chunk_strncat()`

2021-11-08 Thread Tim Duesterhus
This replaces `chunk_strncat()` with `chunk_istcat()` if the parameters are the ist's `.ptr` and `.len`. --- dev/coccinelle/ist.cocci | 8 1 file changed, 8 insertions(+) diff --git a/dev/coccinelle/ist.cocci b/dev/coccinelle/ist.cocci index 4945141b2..680afbade 100644 ---

[PATCH 4/4] CLEANUP: Re-apply xalloc_size.cocci

2021-11-06 Thread Tim Duesterhus
Use a consistent size as the parameter for the *alloc family. --- src/ev_evports.c | 2 +- src/hlua.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ev_evports.c b/src/ev_evports.c index 710d51236..73e97517c 100644 --- a/src/ev_evports.c +++ b/src/ev_evports.c @@

[PATCH 1/4] DEV: coccinelle: Remove unused `expression e`

2021-11-06 Thread Tim Duesterhus
Introduced in ef00c533e1ed37b414aab912f492be794ab589cc. --- dev/coccinelle/ist.cocci | 1 - 1 file changed, 1 deletion(-) diff --git a/dev/coccinelle/ist.cocci b/dev/coccinelle/ist.cocci index 97ce0a2ad..598ffa3e2 100644 --- a/dev/coccinelle/ist.cocci +++ b/dev/coccinelle/ist.cocci @@ -31,7

[PATCH 3/4] CLEANUP: Apply ist.cocci

2021-11-06 Thread Tim Duesterhus
Make use of the new rules to use `istend()`. --- src/h1.c | 4 ++-- src/h2.c | 2 +- src/hlua.c | 2 +- src/http_htx.c | 11 ++- src/htx.c | 11 +++ src/tcpcheck.c | 3 ++- 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/h1.c

[PATCH 2/4] DEV: coccinelle: Add rule to use `istend()` where possible

2021-11-06 Thread Tim Duesterhus
This replaces `i.ptr + i.len` by `istend()`. --- dev/coccinelle/ist.cocci | 7 +++ 1 file changed, 7 insertions(+) diff --git a/dev/coccinelle/ist.cocci b/dev/coccinelle/ist.cocci index 598ffa3e2..5b6aa6b2c 100644 --- a/dev/coccinelle/ist.cocci +++ b/dev/coccinelle/ist.cocci @@ -41,6 +41,13

[PATCH 2/2] CLEANUP: Apply ist.cocci

2021-11-04 Thread Tim Duesterhus
Make use of the new rules to use `istnext()`. --- src/cache.c| 24 src/http_htx.c | 12 src/mqtt.c | 2 +- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/cache.c b/src/cache.c index feab63f07..ba2b63c49 100644 --- a/src/cache.c

[PATCH 1/2] DEV: coccinelle: Add rule to use `istnext()` where possible

2021-11-04 Thread Tim Duesterhus
This matches both `istadv(..., 1)` as well as raw `.ptr++` uses. --- dev/coccinelle/ist.cocci | 16 1 file changed, 16 insertions(+) diff --git a/dev/coccinelle/ist.cocci b/dev/coccinelle/ist.cocci index c3243302f..97ce0a2ad 100644 --- a/dev/coccinelle/ist.cocci +++

[PATCH] REGTESTS: Use `feature cmd` for 2.5+ tests (2)

2021-11-04 Thread Tim Duesterhus
This patch effectively is identical to 7ba98480cc5b2ede0fd4cca162959f66beb82c82. --- reg-tests/connection/cli_src_dst.vtc| 3 +-- reg-tests/http-messaging/http_transfer_encoding.vtc | 4 ++-- reg-tests/http-messaging/srv_ws.vtc | 5 ++---

[PATCH] CLEANUP: halog: Remove dead stores

2021-11-04 Thread Tim Duesterhus
Found using clang's scan-build. --- admin/halog/halog.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/admin/halog/halog.c b/admin/halog/halog.c index 900cf5d46..f368c1c6f 100644 --- a/admin/halog/halog.c +++ b/admin/halog/halog.c @@ -551,7 +551,8 @@ int

[PATCH 2/2] CLEANUP: Apply ha_free.cocci

2021-11-04 Thread Tim Duesterhus
Use `ha_free()` where possible. --- src/action.c | 3 +-- src/server.c | 3 +-- src/ssl_ckch.c | 6 ++ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/action.c b/src/action.c index ba465a253..1de97692e 100644 --- a/src/action.c +++ b/src/action.c @@ -39,8 +39,7 @@ int

[PATCH 1/2] DEV: coccinelle: Add ha_free.cocci

2021-11-04 Thread Tim Duesterhus
Taken from 61cfdf4fd8a93dc6fd9922d5b309a71bdc7d2853. --- dev/coccinelle/ha_free.cocci | 6 ++ 1 file changed, 6 insertions(+) create mode 100644 dev/coccinelle/ha_free.cocci diff --git a/dev/coccinelle/ha_free.cocci b/dev/coccinelle/ha_free.cocci new file mode 100644 index

[PATCH 1/2] MINOR: jwt: Make invalid static JWT algorithms an error in `jwt_verify` converter

2021-10-29 Thread Tim Duesterhus
It is not useful to start a configuration where an invalid static string is provided as the JWT algorithm. Better make the administrator aware of the suspected typo by failing to start. --- src/sample.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sample.c

[PATCH 2/2] BUG/MINOR: jwt: Fix jwt_parse_alg incorrectly returning JWS_ALG_NONE

2021-10-29 Thread Tim Duesterhus
Hi Remi, Willy, Is the length check at the start of `jwt_parse_alg()` actually useful? I would expect that the vast majority of strings passed are valid algorithms that are *not* `none`. Thus I expect this `if()` to almost never be `true`. Should the `if()` be removed and a new `case 'n'` be

[PATCH] CLEANUP: hlua: Remove obsolete branch in `hlua_alloc()`

2021-10-23 Thread Tim Duesterhus
This branch is no longer required, because the `!nsize` case is handled for any value of `ptr` now. see 22586524e32f14c44239063088a38ccea8abc9b7 see a5efdff93c36f75345a2a18f18bffee9b602bc7b --- src/hlua.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/hlua.c b/src/hlua.c index

[PATCH] DEV: coccinelle: Add realloc_leak.cocci

2021-10-23 Thread Tim Duesterhus
This coccinelle patch finds locations where the return value of `realloc()` is assigned to the pointer passed to `realloc()`. This calls will leak memory if `realloc()` returns `NULL`. --- dev/coccinelle/realloc_leak.cocci | 6 ++ 1 file changed, 6 insertions(+) create mode 100644

[PATCH 2/2] CLEANUP: jwt: Remove the use of a trash buffer in jwt_jwsverify_rsa_ecdsa()

2021-10-18 Thread Tim Duesterhus
`trash` was completely unused within this function. --- src/jwt.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/jwt.c b/src/jwt.c index d075bcfd4..94bfa5adb 100644 --- a/src/jwt.c +++ b/src/jwt.c @@ -214,14 +214,9 @@ jwt_jwsverify_rsa_ecdsa(const struct jwt_ctx

[PATCH 1/2] CLEANUP: jwt: Remove the use of a trash buffer in jwt_jwsverify_hmac()

2021-10-18 Thread Tim Duesterhus
The OpenSSL documentation (https://www.openssl.org/docs/man1.1.0/man3/HMAC.html) specifies: > It places the result in md (which must have space for the output of the hash > function, which is no more than EVP_MAX_MD_SIZE bytes). If md is NULL, the > digest is placed in a static array. The size of

[PATCH] CLEANUP: Consistently `unsigned int` for bitfields

2021-10-16 Thread Tim Duesterhus
see 6a0dd733906611dea958cf74b9f51bb16028ae20 Found using GitHub's CodeQL scan. --- include/haproxy/stick_table-t.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/haproxy/stick_table-t.h b/include/haproxy/stick_table-t.h index 3b1f2b3ef..133f992b5 100644 ---

[PATCH 1/2] CI: Add `permissions` to GitHub Actions

2021-10-16 Thread Tim Duesterhus
This change locks down the permissions of the access token in GitHub Actions to only allow reading the repository contents and nothing else. see https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token --- .github/workflows/codespell.yml

[PATCH 2/2] CI: Clean up formatting in GitHub Action definitions

2021-10-16 Thread Tim Duesterhus
This patch cleans up the formatting within the .yml definition files for GitHub Actions to ensure a consistent look across all actions. --- .github/workflows/codespell.yml| 15 +++--- .github/workflows/compliance.yml | 2 +- .github/workflows/contrib.yml | 2 -

  1   2   3   4   5   >