]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
4 years agoBUILD: Makefile: exclude broken tests by default
William Dauchy [Thu, 7 Jan 2021 16:10:51 +0000 (17:10 +0100)] 
BUILD: Makefile: exclude broken tests by default

it could be sometimes a bit confusing to have tests which are known to
be broken executed in the default `make reg-tests` command, especially
for not frequent contributors which are not necessarily aware of all our
quirks.

without this patch, this test is failing on my side:
  #    top  TEST reg-tests/seamless-reload/abns_socket.vtc FAILED (2.228) exit=2
  1 tests failed, 0 tests skipped, 107 tests passed

Signed-off-by: William Dauchy <wdauchy@gmail.com>
4 years agoBUILD: ssl: guard openssl specific with SSL_READ_EARLY_DATA_SUCCESS
Ilya Shipitsin [Thu, 7 Jan 2021 06:59:58 +0000 (11:59 +0500)] 
BUILD: ssl: guard openssl specific with SSL_READ_EARLY_DATA_SUCCESS

let us switch to SSL_READ_EARLY_DATA_SUCCESS instead of openssl versions

4 years agoBUILD: ssl: guard EVP_PKEY_get_default_digest_nid with ASN1_PKEY_CTRL_DEFAULT_MD_NID
Ilya Shipitsin [Thu, 7 Jan 2021 06:57:42 +0000 (11:57 +0500)] 
BUILD: ssl: guard EVP_PKEY_get_default_digest_nid with ASN1_PKEY_CTRL_DEFAULT_MD_NID

let us switch to openssl specific macro instead of versions

4 years agoBUILD: SSL: guard TLS13 ciphersuites with HAVE_SSL_CTX_SET_CIPHERSUITES
Ilya Shipitsin [Thu, 7 Jan 2021 06:55:45 +0000 (11:55 +0500)] 
BUILD: SSL: guard TLS13 ciphersuites with HAVE_SSL_CTX_SET_CIPHERSUITES

accidently src/server.c still used earlier guarding

4 years agoMINOR: converter: adding support for url_enc
William Dauchy [Wed, 6 Jan 2021 22:39:50 +0000 (23:39 +0100)] 
MINOR: converter: adding support for url_enc

add base support for url encode following RFC3986, supporting `query`
type only.

- add test checking url_enc/url_dec/url_enc
- update documentation
- leave the door open for future changes

this should resolve github issue #941

Signed-off-by: William Dauchy <wdauchy@gmail.com>
4 years ago[RELEASE] Released version 2.4-dev5 v2.4-dev5
Willy Tarreau [Wed, 6 Jan 2021 16:41:32 +0000 (17:41 +0100)] 
[RELEASE] Released version 2.4-dev5

Released version 2.4-dev5 with the following main changes :
    - BUG/MEDIUM: mux_h2: Add missing braces in h2_snd_buf()around trace+wakeup
    - BUILD: hpack: hpack-tbl-t.h uses VAR_ARRAY but does not include compiler.h
    - MINOR: time: increase the minimum wakeup interval to 60s
    - MINOR: check: do not ignore a connection header for http-check send
    - REGTESTS: complete http-check test
    - CI: travis-ci: drop coverity scan builds
    - MINOR: atomic: don't use ; to separate instruction on aarch64.
    - IMPORT: xxhash: update to v0.8.0 that introduces stable XXH3 variant
    - MEDIUM: xxhash: use the XXH3 functions to generate 64-bit hashes
    - MEDIUM: xxhash: use the XXH_INLINE_ALL macro to inline all functions
    - CLEANUP: xxhash: remove the unused src/xxhash.c
    - MINOR: sample: add the xxh3 converter
    - REGTESTS: add tests for the xxh3 converter
    - MINOR: protocol: Create proto_quic QUIC protocol layer.
    - MINOR: connection: Attach a "quic_conn" struct to "connection" struct.
    - MINOR: quic: Redefine control layer callbacks which are QUIC specific.
    - MINOR: ssl_sock: Initialize BIO and SSL objects outside of ssl_sock_init()
    - MINOR: connection: Add a new xprt to connection.
    - MINOR: ssl: Export definitions required by QUIC.
    - MINOR: cfgparse: Do not modify the QUIC xprt when parsing "ssl".
    - MINOR: tools: Add support for QUIC addresses parsing.
    - MINOR: quic: Add definitions for QUIC protocol.
    - MINOR: quic: Import C source code files for QUIC protocol.
    - MINOR: listener: Add QUIC info to listeners and receivers.
    - MINOR: server: Add QUIC definitions to servers.
    - MINOR: ssl: SSL CTX initialization modifications for QUIC.
    - MINOR: ssl: QUIC transport parameters parsing.
    - MINOR: quic: QUIC socket management finalization.
    - MINOR: cfgparse: QUIC default server transport parameters init.
    - MINOR: quic: Enable the compilation of QUIC modules.
    - MAJOR: quic: Make usage of ebtrees to store QUIC ACK ranges.
    - MINOR: quic: Attempt to make trace more readable
    - MINOR: quic: Make usage of the congestion control window.
    - MINOR: quic: Flag RX packet as ack-eliciting from the generic parser.
    - MINOR: quic: Code reordering to help in reviewing/modifying.
    - MINOR: quic: Add traces to congestion avoidance NewReno callback.
    - MINOR: quic: Display the SSL alert in ->ssl_send_alert() callback.
    - MINOR: quic: Update the initial salt to that of draft-29.
    - MINOR: quic: Add traces for in flght ack-eliciting packet counter.
    - MINOR: quic: make a packet build fails when qc_build_frm() fails.
    - MINOR: quic: Add traces for quic_packet_encrypt().
    - MINOR: cache: Refactoring of secondary_key building functions
    - MINOR: cache: Avoid storing responses whose secondary key was not correctly calculated
    - BUG/MINOR: cache: Manage multiple headers in accept-encoding normalization
    - MINOR: cache: Add specific secondary key comparison mechanism
    - MINOR: http: Add helper functions to trim spaces and tabs
    - MEDIUM: cache: Manage a subset of encodings in accept-encoding normalizer
    - REGTESTS: cache: Simplify vary.vtc file
    - REGTESTS: cache: Add a specific test for the accept-encoding normalizer
    - MINOR: cache: Remove redundant test in http_action_req_cache_use
    - MINOR: cache: Replace the "process-vary" option's expected values
    - CI: GitHub Actions: enable daily Coverity scan
    - BUG/MEDIUM: cache: Fix hash collision in `accept-encoding` handling for `Vary`
    - MEDIUM: stick-tables: Add srvkey option to stick-table
    - REGTESTS: add test for stickiness using "srvkey addr"
    - BUILD: Makefile: disable -Warray-bounds until it's fixed in gcc 11
    - BUG/MINOR: sink: Return an allocation failure in __sink_new if strdup() fails
    - BUG/MINOR: lua: Fix memory leak error cases in hlua_config_prepend_path
    - MINOR: lua: Use consistent error message 'memory allocation failed'
    - CLEANUP: Compare the return value of `XXXcmp()` functions with zero
    - CLEANUP: Apply the coccinelle patch for `XXXcmp()` on include/
    - CLEANUP: Apply the coccinelle patch for `XXXcmp()` on contrib/
    - MINOR: qpack: Add static header table definitions for QPACK.
    - CLEANUP: qpack: Wrong comment about the draft for QPACK static header table.
    - CLEANUP: quic: Remove useless QUIC event trace definitions.
    - BUG/MINOR: quic: Possible CRYPTO frame building errors.
    - MINOR: quic: Pass quic_conn struct to frame parsers.
    - BUG/MINOR: quic: Wrong STREAM frames parsing.
    - MINOR: quic: Drop packets with STREAM frames with wrong direction.
    - CLEANUP: ssl: Remove useless loop in tlskeys_list_get_next()
    - CLEANUP: ssl: Remove useless local variable in tlskeys_list_get_next()
    - MINOR: ssl: make tlskeys_list_get_next() take a list element
    - Revert "BUILD: Makefile: disable -Warray-bounds until it's fixed in gcc 11"
    - BUG/MINOR: cfgparse: Fail if the strdup() for `rule->be.name` for `use_backend` fails
    - CLEANUP: mworker: remove duplicate pointer tests in cfg_parse_program()
    - CLEANUP: Reduce scope of `header_name` in http_action_store_cache()
    - CLEANUP: Reduce scope of `hdr_age` in http_action_store_cache()
    - CLEANUP: spoe: fix typo on `var_check_arg` comment
    - BUG/MINOR: tcpcheck: Report a L7OK if the last evaluated rule is a send rule
    - CI: github actions: build several popular "contrib" tools
    - DOC: Improve the message printed when running `make` w/o `TARGET`
    - BUG/MEDIUM: server: srv_set_addr_desc() crashes when a server has no address
    - REGTESTS: add unresolvable servers to srvkey-addr
    - BUG/MINOR: stats: Make stat_l variable used to dump a stat line thread local
    - BUG/MINOR: quic: NULL pointer dereferences when building post handshake frames.
    - SCRIPTS: improve announce-release to support different tag and versions
    - SCRIPTS: make announce release support preparing announces before tag exists
    - CLEANUP: assorted typo fixes in the code and comments
    - BUG/MINOR: srv: do not init address if backend is disabled
    - BUG/MINOR: srv: do not cleanup idle conns if pool max is null
    - CLEANUP: assorted typo fixes in the code and comments
    - CLEANUP: few extra typo and fixes over last one ("ot" -> "to")

4 years agoCLEANUP: few extra typo and fixes over last one ("ot" -> "to")
Willy Tarreau [Wed, 6 Jan 2021 16:35:12 +0000 (17:35 +0100)] 
CLEANUP: few extra typo and fixes over last one ("ot" -> "to")

As noticed by Tim there were a few incorrect fixes in the previous patch
("ot" -> "to" and not "or").

4 years agoCLEANUP: assorted typo fixes in the code and comments
Ilya Shipitsin [Wed, 6 Jan 2021 16:20:16 +0000 (21:20 +0500)] 
CLEANUP: assorted typo fixes in the code and comments

This is 15th iteration of typo fixes

4 years agoBUG/MINOR: srv: do not cleanup idle conns if pool max is null
Amaury Denoyelle [Wed, 6 Jan 2021 13:28:51 +0000 (14:28 +0100)] 
BUG/MINOR: srv: do not cleanup idle conns if pool max is null

If a server is configured to not have any idle conns, returns immediatly
from srv_cleanup_connections. This avoids a segfault when a server is
configured with pool-max-conn to 0.

This should be backported up to 2.2.

4 years agoBUG/MINOR: srv: do not init address if backend is disabled
Amaury Denoyelle [Wed, 6 Jan 2021 13:28:50 +0000 (14:28 +0100)] 
BUG/MINOR: srv: do not init address if backend is disabled

Do not proceed on init_addr if the backend of the server is marked as
disabled. When marked as disabled, the server is not fully initialized
and some operation must be avoided to prevent segfault. It is correct
because there is no way to activate a disabled backend.

This fixes the github issue #1031.
This should be backported to 2.2.

4 years agoCLEANUP: assorted typo fixes in the code and comments
Ilya Shipitsin [Tue, 5 Jan 2021 17:10:46 +0000 (22:10 +0500)] 
CLEANUP: assorted typo fixes in the code and comments

This is 14th iteration of typo fixes

4 years agoSCRIPTS: make announce release support preparing announces before tag exists
Willy Tarreau [Wed, 6 Jan 2021 14:46:33 +0000 (15:46 +0100)] 
SCRIPTS: make announce release support preparing announces before tag exists

It takes so much time to write an announce message that sometimes it's
annoying not being able to start the work while a fix is being finished.
With the new "-p" argument, announce-release will allow to prepare the
announce message for the current HEAD and with no tag yet. It will
restart from the last tag and automatically increment the version using
the same algorithm as create-release so that everything is accurate. It
should then be easier at the last moment to just include the final entry
by hand when the last fix finally arrives. For convenience, this argument
also allows to create an announce from another branch than master.

4 years agoSCRIPTS: improve announce-release to support different tag and versions
Willy Tarreau [Wed, 6 Jan 2021 14:16:46 +0000 (15:16 +0100)] 
SCRIPTS: improve announce-release to support different tag and versions

By having three variables it will be easier to preset the version and
the tag separately. One contains the announced version, another one the
associated tag and the last one the final commit ID (used as the ending
point before the release). This initially allows to check for the HEAD
matching the tag only when the version was not forced, hence re-announce
already tagged versions after some extra commits were added for example.

4 years agoBUG/MINOR: quic: NULL pointer dereferences when building post handshake frames.
Frédéric Lécaille [Wed, 6 Jan 2021 11:12:39 +0000 (12:12 +0100)] 
BUG/MINOR: quic: NULL pointer dereferences when building post handshake frames.

The second one was detected by cppcheck contrary to the first one.
Fixes issue #1032.
Thank you to Ilya for having reported this.

4 years agoBUG/MINOR: stats: Make stat_l variable used to dump a stat line thread local
Christopher Faulet [Wed, 6 Jan 2021 06:41:56 +0000 (07:41 +0100)] 
BUG/MINOR: stats: Make stat_l variable used to dump a stat line thread local

Since ee63d4bd6 ("MEDIUM: stats: integrate static proxies stats in new
stats"), all dumped stats for a given domain, the default ones and the
modules ones, are merged in a signle array to dump them in a generic way.
For this purpose, the stat_l global variable is allocated at startup to
store a line of stats before the dump, i.e. all stats of an entity
(frontend, backend, listener, server or dns nameserver). But this variable
is not thread safe.  If stats are retrieved concurrently by several clients
on different threads, the same variable is used. This leads to corrupted
stats output.

To fix the bug, the stat_l variable is now thread local.

This patch should probably solve issues #972 and #992. It must be backported
to 2.3.

4 years agoREGTESTS: add unresolvable servers to srvkey-addr
Willy Tarreau [Wed, 6 Jan 2021 08:20:22 +0000 (09:20 +0100)] 
REGTESTS: add unresolvable servers to srvkey-addr

This ensures that the previous fix remains operational, as without it
an unresolvable server causes a crash when it's been indexed.

4 years agoBUG/MEDIUM: server: srv_set_addr_desc() crashes when a server has no address
Thayne McCombs [Wed, 6 Jan 2021 06:10:09 +0000 (23:10 -0700)] 
BUG/MEDIUM: server: srv_set_addr_desc() crashes when a server has no address

GitHub Issue #1026 reported a crash during configuration check for the
following example config:

    backend 0
    server 0 0
    server 0 0

HAProxy crashed in srv_set_addr_desc() due to a NULL pointer dereference
caused by `sa2str` returning NULL for an `AF_UNSPEC` address (`0`).

Check to make sure the address key is non-null before using it for
comparison or inserting it into the tree.

The crash was introduced in commit 92149f9a8 ("MEDIUM: stick-tables: Add
srvkey option to stick-table") which not in any released version so no
backport is needed.

Cc: Tim Duesterhus <tim@bastelstu.be>
4 years agoDOC: Improve the message printed when running `make` w/o `TARGET`
Tim Duesterhus [Tue, 5 Jan 2021 17:10:41 +0000 (18:10 +0100)] 
DOC: Improve the message printed when running `make` w/o `TARGET`

Rephrase the message to no longer talk about something that "is no longer
supported", but about what actually *is* supported.

Adjustments include:

- Removal of rare targets to make it easier to find the proper one.
- Reformatting to be easier to read (more newlines)
- Explanation of common non-default feature flags.

4 years agoCI: github actions: build several popular "contrib" tools
Ilya Shipitsin [Wed, 30 Dec 2020 10:25:25 +0000 (15:25 +0500)] 
CI: github actions: build several popular "contrib" tools

this adds "halog", "flags" and "poll" builds. builds are done in
separate steps for better failure identification

4 years agoBUG/MINOR: tcpcheck: Report a L7OK if the last evaluated rule is a send rule
Christopher Faulet [Tue, 5 Jan 2021 15:56:07 +0000 (16:56 +0100)] 
BUG/MINOR: tcpcheck: Report a L7OK if the last evaluated rule is a send rule

When all rules of a tcpcheck ruleset are successfully evaluated, the right
check status must always be reported. It is true if the last evaluated rule
is an expect or a connect rule. But not if it is a send rule. In this
situation, nothing more is done until the check timeout expiration and a
L7TOUT is reported instead of a L7OK.

Now, by default, when all rules were successfully evaluated, a L7OK is
reported. When the last evaluated rule is an expect or a connect, the
behavior remains unchanged.

This patch should fix the issue #1027. It must be backported as far as 2.2.

4 years agoCLEANUP: spoe: fix typo on `var_check_arg` comment
William Dauchy [Tue, 5 Jan 2021 10:14:58 +0000 (11:14 +0100)] 
CLEANUP: spoe: fix typo on `var_check_arg` comment

there was an extra `s` added to the `var_check_arg` function

Signed-off-by: William Dauchy <wdauchy@gmail.com>
4 years agoCLEANUP: Reduce scope of `hdr_age` in http_action_store_cache()
Tim Duesterhus [Sat, 2 Jan 2021 21:47:17 +0000 (22:47 +0100)] 
CLEANUP: Reduce scope of `hdr_age` in http_action_store_cache()

This is only required to process the `age` header.

4 years agoCLEANUP: Reduce scope of `header_name` in http_action_store_cache()
Tim Duesterhus [Sat, 2 Jan 2021 21:47:16 +0000 (22:47 +0100)] 
CLEANUP: Reduce scope of `header_name` in http_action_store_cache()

This variable is only needed deeply nested in a single location and clang's
static analyzer complains about a dead initialization. Reduce the scope to
satisfy clang and the human that reads the function.

4 years agoCLEANUP: mworker: remove duplicate pointer tests in cfg_parse_program()
Willy Tarreau [Tue, 5 Jan 2021 14:58:37 +0000 (15:58 +0100)] 
CLEANUP: mworker: remove duplicate pointer tests in cfg_parse_program()

As reported in issue #1017, there are two harmless duplicate tests in
cfg_parse_program(), one made of a "if" using the same condition as the
loop it's in, and the other one being a null test before a free. This
just removes them. No backport is needed.

4 years agoBUG/MINOR: cfgparse: Fail if the strdup() for `rule->be.name` for `use_backend` fails
Tim Duesterhus [Sun, 3 Jan 2021 21:54:43 +0000 (22:54 +0100)] 
BUG/MINOR: cfgparse: Fail if the strdup() for `rule->be.name` for `use_backend` fails

This patch fixes GitHub issue #1024.

I could track the `strdup` back to commit
3a1f5fda109fc56ae127d03eaf34ce027c9542e1 which is 1.9-dev8. It's probably not
worth the effort to backport it across this refactoring.

This patch should be backported to 1.9+.

4 years agoRevert "BUILD: Makefile: disable -Warray-bounds until it's fixed in gcc 11"
Willy Tarreau [Tue, 5 Jan 2021 10:11:38 +0000 (11:11 +0100)] 
Revert "BUILD: Makefile: disable -Warray-bounds until it's fixed in gcc 11"

This reverts commit 5e8c35da1b93b64ec4892192aec3d61d73b3bbce.

While the issue is being discussed with gcc folks, a reasonable workaround
could be found for the tls_keys_ref list usage which doesn't significantly
complicate the code. Since it was the only place triggering the warning and
I don't feel very comfortable leaving this one disabled for too long, let's
re-enable it right now. This definitely closes issue #1010.

4 years agoMINOR: ssl: make tlskeys_list_get_next() take a list element
Willy Tarreau [Tue, 5 Jan 2021 09:44:30 +0000 (10:44 +0100)] 
MINOR: ssl: make tlskeys_list_get_next() take a list element

As reported in issue #1010, gcc-11 as of 2021-01-05 is overzealous in
its -Warray-bounds check as it considers that a cast of a global struct
accesses the entire struct even if only one specific element is accessed.
This instantly breaks all lists making use of container_of() to build
their iterators as soon as the starting point is known if the next
element is retrieved from the list head in a way that is visible to the
compiler's optimizer, because it decides that accessing the list's next
element dereferences the list as a larger struct (which it does not).

The temporary workaround consisted in disabling -Warray-bounds, but this
warning is traditionally quite effective at spotting real bugs, and we
actually have is a single occurrence of this issue in the whole code.

By changing the tlskeys_list_get_next() function to take a list element
as the starting point instead of the current element, we can avoid
the starting point issue but this requires to change all call places
to write hideous casts made of &((struct blah*)ref)->list. At the
moment we only have two such call places, the first one being used to
initialize the list (which is the one causing the warning) and which
is thus easy to simplify, and the second one for which we already have
an aliased pointer to the reference that is still valid at the call
place, and given the original pointer also remained unchanged, we can
safely use this alias, and this is safer than leaving a cast there.

Let's make this change now while it's still easy.

The generated code only changed in function cli_io_handler_tlskeys_files()
due to register allocation and the change of variable scope between the
old one and the new one.

4 years agoCLEANUP: ssl: Remove useless local variable in tlskeys_list_get_next()
Tim Duesterhus [Sun, 3 Jan 2021 00:29:56 +0000 (01:29 +0100)] 
CLEANUP: ssl: Remove useless local variable in tlskeys_list_get_next()

`getnext` was only used to fill `ref` at the beginning of the function. Both
have the same type. Replace the parameter name by `ref` to remove the useless
local variable.

4 years agoCLEANUP: ssl: Remove useless loop in tlskeys_list_get_next()
Tim Duesterhus [Sun, 3 Jan 2021 00:29:55 +0000 (01:29 +0100)] 
CLEANUP: ssl: Remove useless loop in tlskeys_list_get_next()

This loop was always exited in the first iteration by `return`.

4 years agoMINOR: quic: Drop packets with STREAM frames with wrong direction.
Frédéric Lécaille [Thu, 31 Dec 2020 11:45:38 +0000 (12:45 +0100)] 
MINOR: quic: Drop packets with STREAM frames with wrong direction.

A server initiates streams with odd-numbered stream IDs.
Also add useful traces when parsing STREAM frames.

4 years agoBUG/MINOR: quic: Wrong STREAM frames parsing.
Frédéric Lécaille [Thu, 31 Dec 2020 09:57:04 +0000 (10:57 +0100)] 
BUG/MINOR: quic: Wrong STREAM frames parsing.

After having re-read the RFC, we noticed there are two bugs in the STREAM
frame parser. When the OFF bit (0x04) in the frame type is not set
we must set the offset to 0 (it was not set at all). When the LEN bit (0x02)
is not set we must extend the length of the data field to the end of the packet
(it was not set at all).

4 years agoMINOR: quic: Pass quic_conn struct to frame parsers.
Frédéric Lécaille [Tue, 29 Dec 2020 10:42:08 +0000 (11:42 +0100)] 
MINOR: quic: Pass quic_conn struct to frame parsers.

This is only for debugging purposes.

4 years agoBUG/MINOR: quic: Possible CRYPTO frame building errors.
Frédéric Lécaille [Thu, 24 Dec 2020 12:01:37 +0000 (13:01 +0100)] 
BUG/MINOR: quic: Possible CRYPTO frame building errors.

This is issue is due to the fact that when we call the function
responsible of building CRYPTO frames to fill a buffer, the Length
field of this packet did not take into an account the trailing 16 bytes for
the AEAD tag. Furthermore, the remaining <room> available in this buffer
was not decremented by the CRYPTO frame length, but only by the CRYPTO data length
of this frame.

4 years agoCLEANUP: quic: Remove useless QUIC event trace definitions.
Frédéric Lécaille [Wed, 23 Dec 2020 16:17:37 +0000 (17:17 +0100)] 
CLEANUP: quic: Remove useless QUIC event trace definitions.

Remove QUIC_EV_CONN_E* event trace macros which were defined for  errors.
Replace QUIC_EV_CONN_ECHPKT by QUIC_EV_CONN_BCFRMS used in qc_build_cfrms()

4 years agoCLEANUP: qpack: Wrong comment about the draft for QPACK static header table.
Frédéric Lécaille [Tue, 22 Dec 2020 15:08:51 +0000 (16:08 +0100)] 
CLEANUP: qpack: Wrong comment about the draft for QPACK static header table.

This came with a "copy and paste" from the definition for HPACK.

4 years agoMINOR: qpack: Add static header table definitions for QPACK.
Frédéric Lécaille [Tue, 22 Dec 2020 15:01:57 +0000 (16:01 +0100)] 
MINOR: qpack: Add static header table definitions for QPACK.

As HPACK, QPACK makes usage of a static header table.

4 years agoCLEANUP: Apply the coccinelle patch for `XXXcmp()` on contrib/
Tim Duesterhus [Sat, 2 Jan 2021 21:31:55 +0000 (22:31 +0100)] 
CLEANUP: Apply the coccinelle patch for `XXXcmp()` on contrib/

Compare the various `cmp()` functions against zero.

4 years agoCLEANUP: Apply the coccinelle patch for `XXXcmp()` on include/
Tim Duesterhus [Sat, 2 Jan 2021 21:31:54 +0000 (22:31 +0100)] 
CLEANUP: Apply the coccinelle patch for `XXXcmp()` on include/

Compare the various `XXXcmp()` functions against zero.

4 years agoCLEANUP: Compare the return value of `XXXcmp()` functions with zero
Tim Duesterhus [Sat, 2 Jan 2021 21:31:53 +0000 (22:31 +0100)] 
CLEANUP: Compare the return value of `XXXcmp()` functions with zero

According to coding-style.txt it is recommended to use:

`strcmp(a, b) == 0` instead of `!strcmp(a, b)`

So let's do this.

The change was performed by running the following (very long) coccinelle patch
on src/:

    @@
    statement S;
    expression E;
    expression F;
    @@

      if (
    (
    dns_hostname_cmp
    |
    eb_memcmp
    |
    memcmp
    |
    strcasecmp
    |
    strcmp
    |
    strncasecmp
    |
    strncmp
    )
    -  (E, F)
    +  (E, F) != 0
      )
    (
      S
    |
      { ... }
    )

    @@
    statement S;
    expression E;
    expression F;
    @@

      if (
    - !
    (
    dns_hostname_cmp
    |
    eb_memcmp
    |
    memcmp
    |
    strcasecmp
    |
    strcmp
    |
    strncasecmp
    |
    strncmp
    )
    -  (E, F)
    +  (E, F) == 0
      )
    (
      S
    |
      { ... }
    )

    @@
    expression E;
    expression F;
    expression G;
    @@

    (
    G &&
    (
    dns_hostname_cmp
    |
    eb_memcmp
    |
    memcmp
    |
    strcasecmp
    |
    strcmp
    |
    strncasecmp
    |
    strncmp
    )
    -  (E, F)
    +  (E, F) != 0
    )

    @@
    expression E;
    expression F;
    expression G;
    @@

    (
    G ||
    (
    dns_hostname_cmp
    |
    eb_memcmp
    |
    memcmp
    |
    strcasecmp
    |
    strcmp
    |
    strncasecmp
    |
    strncmp
    )
    -  (E, F)
    +  (E, F) != 0
    )

    @@
    expression E;
    expression F;
    expression G;
    @@

    (
    (
    dns_hostname_cmp
    |
    eb_memcmp
    |
    memcmp
    |
    strcasecmp
    |
    strcmp
    |
    strncasecmp
    |
    strncmp
    )
    -  (E, F)
    +  (E, F) != 0
    && G
    )

    @@
    expression E;
    expression F;
    expression G;
    @@

    (
    (
    dns_hostname_cmp
    |
    eb_memcmp
    |
    memcmp
    |
    strcasecmp
    |
    strcmp
    |
    strncasecmp
    |
    strncmp
    )
    -  (E, F)
    +  (E, F) != 0
    || G
    )

    @@
    expression E;
    expression F;
    expression G;
    @@

    (
    G &&
    - !
    (
    dns_hostname_cmp
    |
    eb_memcmp
    |
    memcmp
    |
    strcasecmp
    |
    strcmp
    |
    strncasecmp
    |
    strncmp
    )
    -  (E, F)
    +  (E, F) == 0
    )

    @@
    expression E;
    expression F;
    expression G;
    @@

    (
    G ||
    - !
    (
    dns_hostname_cmp
    |
    eb_memcmp
    |
    memcmp
    |
    strcasecmp
    |
    strcmp
    |
    strncasecmp
    |
    strncmp
    )
    -  (E, F)
    +  (E, F) == 0
    )

    @@
    expression E;
    expression F;
    expression G;
    @@

    (
    - !
    (
    dns_hostname_cmp
    |
    eb_memcmp
    |
    memcmp
    |
    strcasecmp
    |
    strcmp
    |
    strncasecmp
    |
    strncmp
    )
    -  (E, F)
    +  (E, F) == 0
    && G
    )

    @@
    expression E;
    expression F;
    expression G;
    @@

    (
    - !
    (
    dns_hostname_cmp
    |
    eb_memcmp
    |
    memcmp
    |
    strcasecmp
    |
    strcmp
    |
    strncasecmp
    |
    strncmp
    )
    -  (E, F)
    +  (E, F) == 0
    || G
    )

    @@
    expression E;
    expression F;
    expression G;
    @@

    (
    - !
    (
    dns_hostname_cmp
    |
    eb_memcmp
    |
    memcmp
    |
    strcasecmp
    |
    strcmp
    |
    strncasecmp
    |
    strncmp
    )
    -  (E, F)
    +  (E, F) == 0
    )

4 years agoMINOR: lua: Use consistent error message 'memory allocation failed'
Tim Duesterhus [Sun, 3 Jan 2021 19:04:37 +0000 (20:04 +0100)] 
MINOR: lua: Use consistent error message 'memory allocation failed'

Other locations in the configuration parser use 'memory allocation failed', so
use this one as well.

4 years agoBUG/MINOR: lua: Fix memory leak error cases in hlua_config_prepend_path
Tim Duesterhus [Sun, 3 Jan 2021 19:04:36 +0000 (20:04 +0100)] 
BUG/MINOR: lua: Fix memory leak error cases in hlua_config_prepend_path

In case of an error `p` is not properly freed.

Minor leak during configuration parsing in out of memory situations, no
backport needed.

4 years agoBUG/MINOR: sink: Return an allocation failure in __sink_new if strdup() fails
Tim Duesterhus [Sun, 3 Jan 2021 18:54:11 +0000 (19:54 +0100)] 
BUG/MINOR: sink: Return an allocation failure in __sink_new if strdup() fails

This patch fixes GitHub issue #1023.

The function was introduced in commit 99c453d ("MEDIUM: ring: new
section ring to declare custom ring buffers."), which first appeared
in 2.2-dev9. The fix should be backported to 2.2+.

4 years agoBUILD: Makefile: disable -Warray-bounds until it's fixed in gcc 11
Willy Tarreau [Sun, 3 Jan 2021 19:27:13 +0000 (20:27 +0100)] 
BUILD: Makefile: disable -Warray-bounds until it's fixed in gcc 11

Ilya reported in issue #1010 that gcc 11 (still in development phase 3)
sees out-of-bounds accesses to tlskeys_reference. After a deep analysis
it turns out that the warning is erroneous and Tim could set up a
reproducer that was further simplified to file a gcc bug report (98503).
In order not to break builds on this version, let's temporarily disable
the warning, since no acceptable workaround could be defined. Once gcc
gets it right, the warning should be re-enabled as it is likely to catch
real errors (it's the first false positive here for us even though
roughly one hundred issues were reported around this one alone).

4 years agoREGTESTS: add test for stickiness using "srvkey addr"
Thayne McCombs [Sat, 19 Dec 2020 07:59:35 +0000 (00:59 -0700)] 
REGTESTS: add test for stickiness using "srvkey addr"

This tests the new "srvkey addr" stick-table statement, which sticks based
on the server's address.

4 years agoMEDIUM: stick-tables: Add srvkey option to stick-table
Thayne McCombs [Fri, 20 Nov 2020 08:28:26 +0000 (01:28 -0700)] 
MEDIUM: stick-tables: Add srvkey option to stick-table

This allows using the address of the server rather than the name of the
server for keeping track of servers in a backend for stickiness.

The peers code was also extended to support feeding the dictionary using
this key instead of the name.

Fixes #814

4 years agoBUG/MEDIUM: cache: Fix hash collision in `accept-encoding` handling for `Vary`
Tim Duesterhus [Tue, 29 Dec 2020 11:43:53 +0000 (12:43 +0100)] 
BUG/MEDIUM: cache: Fix hash collision in `accept-encoding` handling for `Vary`

This patch fixes GitHub Issue #988. Commit ce9e7b25217c46db1ac636b2c885a05bf91ae57e
was not sufficient, because it fell back to a hash comparison if the bitmap
of known encodings was not acceptable instead of directly returning the the
cached response is not compatible.

This patch also extends the reg-test to test the hash collision that was
mentioned in #988.

Vary handling is 2.4, no backport needed.

4 years agoCI: GitHub Actions: enable daily Coverity scan
Ilya Shipitsin [Fri, 25 Dec 2020 18:36:52 +0000 (23:36 +0500)] 
CI: GitHub Actions: enable daily Coverity scan

That scan was previously implemented on Travis. Let us migrate
it to GitHub Actions.

Co-authored-by: Tim Duesterhus <tim@bastelstu.be>
4 years agoMINOR: cache: Replace the "process-vary" option's expected values
Remi Tricot-Le Breton [Wed, 23 Dec 2020 17:13:53 +0000 (18:13 +0100)] 
MINOR: cache: Replace the "process-vary" option's expected values

Replace the <0/1> expected values of the process-vary option by a more
usual <on/off> pair.

4 years agoMINOR: cache: Remove redundant test in http_action_req_cache_use
Remi Tricot-Le Breton [Wed, 23 Dec 2020 17:13:52 +0000 (18:13 +0100)] 
MINOR: cache: Remove redundant test in http_action_req_cache_use

The suppressed check is fully covered by the next one and can then be
removed.

4 years agoREGTESTS: cache: Add a specific test for the accept-encoding normalizer
Remi Tricot-Le Breton [Wed, 23 Dec 2020 17:13:51 +0000 (18:13 +0100)] 
REGTESTS: cache: Add a specific test for the accept-encoding normalizer

Those tests check the explicit support of a subset of encodings added to
the accept-encoding normalizer.

4 years agoREGTESTS: cache: Simplify vary.vtc file
Remi Tricot-Le Breton [Wed, 23 Dec 2020 17:13:50 +0000 (18:13 +0100)] 
REGTESTS: cache: Simplify vary.vtc file

This test used chunked responses but it is not needed. All the chunked
responses are replaced by more simple 'bodylen' directives.

4 years agoMEDIUM: cache: Manage a subset of encodings in accept-encoding normalizer
Remi Tricot-Le Breton [Wed, 23 Dec 2020 17:13:49 +0000 (18:13 +0100)] 
MEDIUM: cache: Manage a subset of encodings in accept-encoding normalizer

The accept-encoding normalizer now explicitely manages a subset of
encodings which will all have their own bit in the encoding bitmap
stored in the cache entry. This way two requests with the same primary
key will be served the same cache entry if they both explicitely accept
the stored response's encoding, even if their respective secondary keys
are not the same and do not match the stored response's one.
The actual hash of the accept-encoding will still be used if the
response's encoding is unmanaged.
The encoding matching and the encoding weight parsing are done for every
subpart of the accept-encoding values, and a bitmap of accepted
encodings is built for every request. It is then tested upon any stored
response that has the same primary key until one with an accepted
encoding is found.
The specific "identity" and "*" accept-encoding values are managed too.
When storing a response in the key, we also parse the content-encoding
header in order to only set the response's corresponding encoding's bit
in its cache_entry encoding bitmap.

This patch fixes GitHub issue #988.
It does not need to be backported.

4 years agoMINOR: http: Add helper functions to trim spaces and tabs
Remi Tricot-Le Breton [Wed, 23 Dec 2020 17:13:48 +0000 (18:13 +0100)] 
MINOR: http: Add helper functions to trim spaces and tabs

Add two helper functions that trim leading or trailing spaces and
horizontal tabs from an ist string.

4 years agoMINOR: cache: Add specific secondary key comparison mechanism
Remi Tricot-Le Breton [Wed, 23 Dec 2020 17:13:47 +0000 (18:13 +0100)] 
MINOR: cache: Add specific secondary key comparison mechanism

Add the possibility to define custom comparison functions for every
sub-part of the secondary key hash instead of using a global memcmp.

4 years agoBUG/MINOR: cache: Manage multiple headers in accept-encoding normalization
Remi Tricot-Le Breton [Wed, 23 Dec 2020 17:13:46 +0000 (18:13 +0100)] 
BUG/MINOR: cache: Manage multiple headers in accept-encoding normalization

The accept-encoding part of the secondary key (vary) was only built out
of the first occurrence of the header. So if a client had two
accept-encoding headers, gzip and br for instance, the key would have
been built out of the gzip string. So another client that only managed
gzip would have been sent the cached resource, even if it was a br resource.
The http_find_header function is now called directly by the normalizers
so that they can manage multiple headers if needed.
A request that has more than 16 encodings will be considered as an
illegitimate request and its response will not be stored.

This fixes GitHub issue #987.

It does not need any backport.

4 years agoMINOR: cache: Avoid storing responses whose secondary key was not correctly calculated
Remi Tricot-Le Breton [Wed, 23 Dec 2020 17:13:45 +0000 (18:13 +0100)] 
MINOR: cache: Avoid storing responses whose secondary key was not correctly calculated

If any of the secondary hash normalizing functions raises an error, the
secondary hash will be unusable. In this case, the response will not be
stored anymore.

4 years agoMINOR: cache: Refactoring of secondary_key building functions
Remi Tricot-Le Breton [Wed, 23 Dec 2020 17:13:44 +0000 (18:13 +0100)] 
MINOR: cache: Refactoring of secondary_key building functions

The two secondary_key building functions (prebuild_full_key
and build_key) have roughly the same content so their code can
be mutualized.

4 years agoMINOR: quic: Add traces for quic_packet_encrypt().
Frédéric Lécaille [Fri, 18 Dec 2020 08:48:20 +0000 (09:48 +0100)] 
MINOR: quic: Add traces for quic_packet_encrypt().

Add traces to have an idea why this function may fail. In fact
in never fails when the passed parameters are correct, especially the
lengths. This is not the case when a packet is not correctly built
before being encrypted.

4 years agoMINOR: quic: make a packet build fails when qc_build_frm() fails.
Frédéric Lécaille [Fri, 18 Dec 2020 08:33:27 +0000 (09:33 +0100)] 
MINOR: quic: make a packet build fails when qc_build_frm() fails.

Even if the size of frames built by qc_build_frm() are computed so that
not to overflow a buffer, do not rely on this and always makes a packet
build fails if we could not build a frame.
Also add traces to have an idea where qc_build_frm() fails.
Fixes a memory leak in qc_build_phdshk_apkt().

4 years agoMINOR: quic: Add traces for in flght ack-eliciting packet counter.
Frédéric Lécaille [Wed, 16 Dec 2020 16:33:11 +0000 (17:33 +0100)] 
MINOR: quic: Add traces for in flght ack-eliciting packet counter.

Add trace for this counter. Also shorten its variable name (->ifae_pkts).

4 years agoMINOR: quic: Update the initial salt to that of draft-29.
Frédéric Lécaille [Wed, 16 Dec 2020 10:28:58 +0000 (11:28 +0100)] 
MINOR: quic: Update the initial salt to that of draft-29.

This salt is ued at leat up to draft-32. At this date ngtcp2 always
uses this salt even if it started the draft-33 development.

Note that when the salt is not correct, we cannot remove the header
protection. In this case the packet number length is wrong.

4 years agoMINOR: quic: Display the SSL alert in ->ssl_send_alert() callback.
Frédéric Lécaille [Thu, 10 Dec 2020 16:03:11 +0000 (17:03 +0100)] 
MINOR: quic: Display the SSL alert in ->ssl_send_alert() callback.

At least displays the SSL alert error code passed to ->ssl_send_alert()
QUIC BIO method and the SSL encryption level. This function is newly called
when using picoquic client with a recent version of BoringSSL (Nov 19 2020).
This is not the case with OpenSSL with 32 as QUIC draft implementation.

4 years agoMINOR: quic: Add traces to congestion avoidance NewReno callback.
Frédéric Lécaille [Thu, 10 Dec 2020 13:41:00 +0000 (14:41 +0100)] 
MINOR: quic: Add traces to congestion avoidance NewReno callback.

These traces are missing and are useful do diagnose issue in the congestion
avoidance callback for NewReno algorithm.

4 years agoMINOR: quic: Code reordering to help in reviewing/modifying.
Frédéric Lécaille [Wed, 9 Dec 2020 14:56:48 +0000 (15:56 +0100)] 
MINOR: quic: Code reordering to help in reviewing/modifying.

Reorder by increasing type the switch/case in qc_parse_pkt_frms()
which is the high level frame parser.
Add new STREAM_X frame types to support some tests with ngtcp2 client.

4 years agoMINOR: quic: Flag RX packet as ack-eliciting from the generic parser.
Frédéric Lécaille [Wed, 9 Dec 2020 13:56:18 +0000 (14:56 +0100)] 
MINOR: quic: Flag RX packet as ack-eliciting from the generic parser.

Add ->flags to the QUIC frame parser as this has been done for the builder so
that to flag RX packets as ack-eliciting at low level. This should also be
helpful to maintain the code if we have to add new flags to RX packets.
Remove the statements which does the same thing as higher level in
qc_parse_pkt_frms().

4 years agoMINOR: quic: Make usage of the congestion control window.
Frédéric Lécaille [Tue, 8 Dec 2020 14:58:39 +0000 (15:58 +0100)] 
MINOR: quic: Make usage of the congestion control window.

Remove ->ifcdata which was there to control the CRYPTO data sent to the
peer so that not to saturate its reception buffer. This was a sort
of flow control.
Add ->prep_in_flight counter to the QUIC path struct to control the
number of bytes prepared to be sent so that not to saturare the
congestion control window. This counter is increased each time a
packet was built. This has nothing to see with ->in_flight which
is the real in flight number of bytes which have really been sent.
We are olbiged to maintain two such counters to know how many bytes
of data we can prepared before sending them.
Modify traces consequently which were useful to diagnose issues about
the congestion control window usage.

4 years agoMINOR: quic: Attempt to make trace more readable
Frédéric Lécaille [Wed, 2 Dec 2020 15:11:40 +0000 (16:11 +0100)] 
MINOR: quic: Attempt to make trace more readable

As there is a lot of information in this protocol, this is not
easy to make the traces readable. We remove here a few of them and
shorten some line shortening the variable names.

4 years agoMAJOR: quic: Make usage of ebtrees to store QUIC ACK ranges.
Frédéric Lécaille [Mon, 30 Nov 2020 15:19:22 +0000 (16:19 +0100)] 
MAJOR: quic: Make usage of ebtrees to store QUIC ACK ranges.

Store QUIC ACK ranges in ebtrees in place of lists with a 0(n) time complexity
for insertion.

4 years agoMINOR: quic: Enable the compilation of QUIC modules.
Frédéric Lécaille [Mon, 23 Nov 2020 14:53:17 +0000 (15:53 +0100)] 
MINOR: quic: Enable the compilation of QUIC modules.

Adds the QUIC C object files to the list to compile to support QUIC protocol.
USE_QUIC compilation option must be used for that.

4 years agoMINOR: cfgparse: QUIC default server transport parameters init.
Frédéric Lécaille [Mon, 23 Nov 2020 14:50:46 +0000 (15:50 +0100)] 
MINOR: cfgparse: QUIC default server transport parameters init.

This patch is there to initialize the default transport parameters for QUIC
as a preparation for one of the QUIC next steps to come: fully support QUIC
protocol for haproxy servers.

4 years agoMINOR: quic: QUIC socket management finalization.
Frédéric Lécaille [Mon, 23 Nov 2020 14:46:36 +0000 (15:46 +0100)] 
MINOR: quic: QUIC socket management finalization.

Implement ->accept_conn() callback for QUIC listener sockets.
Note that this patch also implements quic_session_accept() function
which is similar to session_accept_fd() without calling conn_complete_session()
at this time because we do not have any real QUIC mux.

4 years agoMINOR: ssl: QUIC transport parameters parsing.
Frédéric Lécaille [Mon, 23 Nov 2020 14:37:11 +0000 (15:37 +0100)] 
MINOR: ssl: QUIC transport parameters parsing.

This patch modifies the TLS ClientHello message callback so that to parse the QUIC
client transport parameters.

4 years agoMINOR: ssl: SSL CTX initialization modifications for QUIC.
Frédéric Lécaille [Mon, 23 Nov 2020 13:33:30 +0000 (14:33 +0100)] 
MINOR: ssl: SSL CTX initialization modifications for QUIC.

Makes TLS/TCP and QUIC share the same CTX initializer so that not to modify the
caller which is an XPRT callback used both by the QUIC xprt and the SSL xprt over
TCP.

4 years agoMINOR: server: Add QUIC definitions to servers.
Frédéric Lécaille [Mon, 23 Nov 2020 13:29:28 +0000 (14:29 +0100)] 
MINOR: server: Add QUIC definitions to servers.

This patch adds QUIC structs to server struct so that to make the QUIC code
compile. Also initializes the ebtree to store the connections by connection
IDs.

4 years agoMINOR: listener: Add QUIC info to listeners and receivers.
Frédéric Lécaille [Mon, 23 Nov 2020 13:23:21 +0000 (14:23 +0100)] 
MINOR: listener: Add QUIC info to listeners and receivers.

This patch adds a quic_transport_params struct to bind_conf struct
used for the listeners. This is to store the QUIC transport parameters
for the listeners. Also initializes them when calling str2listener().
Before str2sa_range() it's too early to figure we're going to speak QUIC,
and after it's too late as listeners are already created. So it seems that
doing it in str2listener() when the protocol is discovered is the best
place.

Also adds two ebtrees to the underlying receivers to store the connection
by connections IDs (one for the original connection IDs, and another
one for the definitive connection IDs which really identify the connections.

However it doesn't seem normal that it is stored in the receiver nor the
listener. There should be a private context in the listener so that
protocols can store internal information. This element should in
fact be the listener handle.

Something still feels wrong, and probably we'll have to make QUIC and
SSL co-exist: a proof of this is that there's some explicit code in
bind_parse_ssl() to prevent the "ssl" keyword from replacing the xprt.

4 years agoMINOR: quic: Import C source code files for QUIC protocol.
Frédéric Lécaille [Mon, 23 Nov 2020 13:14:04 +0000 (14:14 +0100)] 
MINOR: quic: Import C source code files for QUIC protocol.

This patch imports all the C files for QUIC protocol implementation with few
modifications from 20200720-quic branch of quic-dev repository found at
https://github.com/haproxytech/quic-dev.

Traces were implemented to help with the development.

4 years agoMINOR: quic: Add definitions for QUIC protocol.
Frédéric Lécaille [Mon, 23 Nov 2020 13:10:37 +0000 (14:10 +0100)] 
MINOR: quic: Add definitions for QUIC protocol.

This patch imports all the definitions for QUIC protocol with few modifications
from 20200720-quic branch of quic-dev repository found at
https://github.com/haproxytech/quic-dev.

4 years agoMINOR: tools: Add support for QUIC addresses parsing.
Frédéric Lécaille [Mon, 23 Nov 2020 10:36:57 +0000 (11:36 +0100)] 
MINOR: tools: Add support for QUIC addresses parsing.

Add "quic4" and "quic6" keywords to str2sa_range() to parse QUIC IPv4
and IPv6 addresses respectively.

4 years agoMINOR: cfgparse: Do not modify the QUIC xprt when parsing "ssl".
Frédéric Lécaille [Mon, 23 Nov 2020 10:33:12 +0000 (11:33 +0100)] 
MINOR: cfgparse: Do not modify the QUIC xprt when parsing "ssl".

When parsing "ssl" keyword for TLS bindings, we must not use the same xprt as the one
for TLS/TCP connections. So, do not modify the QUIC xprt which will be initialized
when parsing QUIC addresses wich "ssl" bindings.

4 years agoMINOR: ssl: Export definitions required by QUIC.
Frédéric Lécaille [Mon, 23 Nov 2020 10:19:04 +0000 (11:19 +0100)] 
MINOR: ssl: Export definitions required by QUIC.

QUIC needs to initialize its BIO and SSL session the same way as for SSL over TCP
connections. It needs also to use the same ClientHello callback.
This patch only exports functions and variables shared between QUIC and SSL/TCP
connections.

4 years agoMINOR: connection: Add a new xprt to connection.
Frédéric Lécaille [Mon, 23 Nov 2020 10:09:48 +0000 (11:09 +0100)] 
MINOR: connection: Add a new xprt to connection.

Simply adds XPRT_QUIC new enum to integrate QUIC transport protocol.

4 years agoMINOR: ssl_sock: Initialize BIO and SSL objects outside of ssl_sock_init()
Frédéric Lécaille [Mon, 9 Nov 2020 14:59:23 +0000 (15:59 +0100)] 
MINOR: ssl_sock: Initialize BIO and SSL objects outside of ssl_sock_init()

This patch extraces the code which initializes the BIO and SSL session
objects so that to reuse it elsewhere later for QUIC conections which
only needs SSL and BIO objects at th TLS layer stack level to work.

4 years agoMINOR: quic: Redefine control layer callbacks which are QUIC specific.
Frédéric Lécaille [Fri, 6 Nov 2020 14:49:49 +0000 (15:49 +0100)] 
MINOR: quic: Redefine control layer callbacks which are QUIC specific.

We add src/quic_sock.c QUIC specific socket management functions as callbacks
for the control layer: ->accept_conn, ->default_iocb and ->rx_listening.
accept_conn() will have to be defined. The default I/O handler only recvfrom()
the datagrams received. Furthermore, ->rx_listening callback always returns 1 at
this time but should returns 0 when reloading the processus.

4 years agoMINOR: connection: Attach a "quic_conn" struct to "connection" struct.
Frédéric Lécaille [Fri, 6 Nov 2020 14:40:16 +0000 (15:40 +0100)] 
MINOR: connection: Attach a "quic_conn" struct to "connection" struct.

This is a simple patch to prepare the integration of QUIC support to come.
quic_conn struct is supposed to embed any QUIC specific information for a QUIC
connection.

4 years agoMINOR: protocol: Create proto_quic QUIC protocol layer.
Frédéric Lécaille [Mon, 2 Nov 2020 13:27:08 +0000 (14:27 +0100)] 
MINOR: protocol: Create proto_quic QUIC protocol layer.

As QUIC is a connection oriented protocol, this file is almost a copy of
proto_tcp without TCP specific features. To suspend/resume a QUIC receiver
we proceed the same way as for proto_udp receivers.

With the recent updates to the listeners, we don't need a specific set of
quic*_add_listener() functions, the default ones are sufficient. The fields
declaration were reordered to make the various layers more visible like in
other protocols.

udp_suspend_receiver/udp_resume_receiver are up-to-date (the check for INHERITED
is present) and the code being UDP-specific, it's normal to use UDP here.
Note that in the future we might more reasily reference stacked layers so that
there's no more need for specifying the pointer here.

4 years agoREGTESTS: add tests for the xxh3 converter
Dragan Dosen [Tue, 22 Dec 2020 21:02:59 +0000 (22:02 +0100)] 
REGTESTS: add tests for the xxh3 converter

4 years agoMINOR: sample: add the xxh3 converter
Dragan Dosen [Tue, 22 Dec 2020 20:44:33 +0000 (21:44 +0100)] 
MINOR: sample: add the xxh3 converter

This patch adds support for the XXH3 variant of hash function that
generates a 64-bit hash.

4 years agoCLEANUP: xxhash: remove the unused src/xxhash.c
Dragan Dosen [Tue, 22 Dec 2020 13:47:48 +0000 (14:47 +0100)] 
CLEANUP: xxhash: remove the unused src/xxhash.c

The source file src/xxhash.c is removed, as we use XXH_INLINE_ALL.

4 years agoMEDIUM: xxhash: use the XXH_INLINE_ALL macro to inline all functions
Dragan Dosen [Tue, 22 Dec 2020 13:46:47 +0000 (14:46 +0100)] 
MEDIUM: xxhash: use the XXH_INLINE_ALL macro to inline all functions

This way we make all xxhash functions inline, with implementations being
directly included within xxhash.h.

Makefile is updated as well, since we don't need to compile and link
xxhash.o anymore.

Inlining should improve performance on small data inputs.

4 years agoMEDIUM: xxhash: use the XXH3 functions to generate 64-bit hashes
Dragan Dosen [Tue, 22 Dec 2020 12:22:34 +0000 (13:22 +0100)] 
MEDIUM: xxhash: use the XXH3 functions to generate 64-bit hashes

Replace the XXH64() function calls with the XXH3 variant function
XXH3_64bits_withSeed() where possible.

4 years agoIMPORT: xxhash: update to v0.8.0 that introduces stable XXH3 variant
Dragan Dosen [Tue, 22 Dec 2020 11:00:37 +0000 (12:00 +0100)] 
IMPORT: xxhash: update to v0.8.0 that introduces stable XXH3 variant

A new XXH3 variant of hash functions shows a noticeable improvement in
performance (especially on small data), and also brings 128-bit support,
better inlining and streaming capabilities.

Performance comparison is available here:

  https://github.com/Cyan4973/xxHash/wiki/Performance-comparison

4 years agoMINOR: atomic: don't use ; to separate instruction on aarch64.
Olivier Houchard [Wed, 23 Dec 2020 00:23:41 +0000 (01:23 +0100)] 
MINOR: atomic: don't use ; to separate instruction on aarch64.

The assembler on MacOS aarch64 interprets ; as the beginning of comments,
so it is not suitable for separating instructions in inline asm. Use \n
instead.

This should be backported to 2.3, 2.2, 2.1, 2.0 and 1.9.

4 years agoCI: travis-ci: drop coverity scan builds
Ilya Shipitsin [Tue, 22 Dec 2020 17:51:52 +0000 (22:51 +0500)] 
CI: travis-ci: drop coverity scan builds

we ran out of travis-ci minutes on December 2020. I would keep
exotic architectures like arm64, s390, ppc64le on travis and move
Coverity scan to Github Actions.

so, let us drop coverity scan from travis-ci.

4 years agoREGTESTS: complete http-check test
Amaury Denoyelle [Tue, 22 Dec 2020 13:08:53 +0000 (14:08 +0100)] 
REGTESTS: complete http-check test

Add a new check for a pseudo-websocket handshake, specifying the
Connection header to verify if it is properly handled by http-check send
directive. Also check that default http/1.1 checks have the header
Connection: close.

4 years agoMINOR: check: do not ignore a connection header for http-check send
Amaury Denoyelle [Tue, 22 Dec 2020 13:08:52 +0000 (14:08 +0100)] 
MINOR: check: do not ignore a connection header for http-check send

Allow the user to specify a custom Connection header for http-check
send. This is useful for example to implement a websocket upgrade check.

If no connection header has been set, a 'Connection: close' header is
automatically appended to allow the server to close the connection
immediately after the request/response.

Update the documentation related to http-check send.

This fixes the github issue #1009.

4 years agoMINOR: time: increase the minimum wakeup interval to 60s
Willy Tarreau [Tue, 22 Dec 2020 09:35:43 +0000 (10:35 +0100)] 
MINOR: time: increase the minimum wakeup interval to 60s

The MAX_DELAY_MS which is set an upper limit to the poll wait time and
force a wakeup this often used to be set to 1 second in order to easily
spot and correct time drifts. This was added 12 years ago at an era
where virtual machines were starting to become common in server
environments while not working particularly well. Nowadays, such issues
are not as common anymore, however forcing 64 threads to wake up every
single second starts to make the process visible on otherwise idle
systems. Let's increase this wakeup interval to one minute. In the worst
case it will make idle threads wake every second, which remains low.

If this is not sufficient anymore on some systems, another approach
would consist in implementing a deep-sleep mode which only triggers
after a while and which is always disabled if any time drift is
observed.

4 years agoBUILD: hpack: hpack-tbl-t.h uses VAR_ARRAY but does not include compiler.h
Christian Ruppert [Mon, 9 Nov 2020 08:15:21 +0000 (09:15 +0100)] 
BUILD: hpack: hpack-tbl-t.h uses VAR_ARRAY but does not include compiler.h

This fixes building hpack from contrib, which failed because of the
undeclared VAR_ARRAY:

make -C contrib/hpack
...
cc -O2 -Wall -g -I../../include -fwrapv -fno-strict-aliasing   -c -o gen-enc.o gen-enc.c
In file included from gen-enc.c:18:
../../include/haproxy/hpack-tbl-t.h:105:23: error: 'VAR_ARRAY' undeclared here (not in a function)
  105 |  struct hpack_dte dte[VAR_ARRAY]; /* dynamic table entries */
...

As discussed in the thread below, let's redefine VAR_ARRAY in this file
so that it remains self-sustaining:

   https://www.mail-archive.com/haproxy@formilux.org/msg39212.html

4 years agoBUG/MEDIUM: mux_h2: Add missing braces in h2_snd_buf()around trace+wakeup
Tim Duesterhus [Mon, 21 Dec 2020 18:40:16 +0000 (19:40 +0100)] 
BUG/MEDIUM: mux_h2: Add missing braces in h2_snd_buf()around trace+wakeup

This is a regression in 7838a79ba ("MEDIUM: mux-h2/trace: add lots of traces
all over the code"). The issue was found using -Wmisleading-indentation.
This patch fixes GitHub issue #1015.

The impact of this bug is that it could in theory cause occasional delays
on some long responses for connections having otherwise no traffic.

This patch should be backported to 2.1+, the commit was first tagged in
v2.1-dev2.

4 years ago[RELEASE] Released version 2.4-dev4 v2.4-dev4
Willy Tarreau [Mon, 21 Dec 2020 10:54:56 +0000 (11:54 +0100)] 
[RELEASE] Released version 2.4-dev4

Released version 2.4-dev4 with the following main changes :
    - BUG/MEDIUM: lb-leastconn: Reposition a server using the right eweight
    - BUG/MEDIUM: mux-h1: Fix a deadlock when a 408 error is pending for a client
    - BUG/MEDIUM: ssl/crt-list: bad behavior with "commit ssl cert"
    - BUG/MAJOR: cache: Crash because of disabled entry not removed from the tree
    - BUILD: SSL: fine guard for SSL_CTX_add_server_custom_ext call
    - MEDIUM: cache: Add a secondary entry counter and insertion limitation
    - MEDIUM: cache: Avoid going over duplicates lists too often
    - MINOR: cache: Add a max-secondary-entries cache option
    - CI: cirrus: drop CentOS 6 builds
    - BUILD: Makefile: have "make clean" destroy .o/.a/.s in contrib subdirs as well
    - MINOR: vars: replace static functions with global ones
    - MINOR: opentracing: add ARGC_OT enum
    - CONTRIB: opentracing: add the OpenTracing filter
    - DOC: opentracing: add the OpenTracing filter section
    - REGTESTS: make use of HAPROXY_ARGS and pass -dM by default
    - BUG/MINOR: http: Establish a tunnel for all 2xx responses to a CONNECT
    - BUG/MINOR: mux-h1: Don't set CS_FL_EOI too early for protocol upgrade requests
    - BUG/MEDIUM: http-ana: Never for sending data in TUNNEL mode
    - CLEANUP: mux-h2: Rename h2s_frt_make_resp_data() to be generic
    - CLEANUP: mux-h2: Rename h2c_frt_handle_data() to be generic
    - BUG/MEDIUM: mux-h1: Handle h1_process() failures on a pipelined request
    - CLEANUP: debug: mark the RNG's seed as unsigned
    - CONTRIB: halog: fix build issue caused by %L printf format
    - CONTRIB: halog: mark the has_zero* functions unused
    - CONTRIB: halog: fix signed/unsigned build warnings on counts and timestamps
    - CONTRIB: debug: address "poll" utility build on non-linux platforms
    - BUILD: plock: remove dead code that causes a warning in gcc 11
    - BUILD: ssl: fine guard for SSL_CTX_get0_privatekey call
    - BUG/MINOR: dns: SRV records ignores duplicated AR records
    - DOC: fix "smp_size" vs "sample_size" in "log" directive arguments
    - CLEANUP: assorted typo fixes in the code and comments
    - DOC: assorted typo fixes in the documentation
    - CI: codespell: whitelist "te" and "nd" words

4 years agoCI: codespell: whitelist "te" and "nd" words
Ilya Shipitsin [Sun, 20 Dec 2020 20:03:12 +0000 (01:03 +0500)] 
CI: codespell: whitelist "te" and "nd" words

te is widely used abbrevation for "transfer encoding"
nd is variable name "name description"

we need to teach codespell those are legitimate