Commit Graph

14775 Commits

Author SHA1 Message Date
Willy Tarreau
388fc25915 IMPORT: slz: use inttypes.h instead of stdint.h
stdint.h is not as portable as inttypes.h. It doesn't exist at least
on AIX 5.1 and Solaris 7, while inttypes.h is present there and does
include stdint.h on platforms supporting it.

This is equivalent to libslz upstream commit e36710a ("slz: use
inttypes.h instead of stdint.h")
2021-05-14 08:44:52 +02:00
Willy Tarreau
c5aa060643 DOC: update min requirements in INSTALL
gcc 11 was tested, and the build dir now needs more like 60 MB than 15 MB.
2021-05-14 08:36:16 +02:00
Willy Tarreau
6bfc10c392 BUILD: config: avoid a build warning on numa_detect_topology() without threads
The function is defined when using linux+cpu affinity but is only used
if threads are enabled, so let's add this condition to avoid aa build
warning about an unused function when building with thread disabled.
This came in 2.4-dev17 with commit b56a7c89a ("MEDIUM: cfgparse: detect
numa and set affinity if needed") so no backport is needed.
2021-05-14 08:30:46 +02:00
Willy Tarreau
26f42a0779 BUG/MAJOR: config: properly initialize cpu_map.thread[] up to MAX_THREADS
A mistake was introduced in 2.4-dev17 by commit 982fb5339 ("MEDIUM:
config: use platform independent type hap_cpuset for cpu-map"), it
initializes cpu_map.thread[] from 0 to MAX_PROCS-1 instead of
MAX_THREADS-1 resulting in crashes when the two differ, e.g. when
building with USE_THREAD= but still with USE_CPU_AFFINITY=1.

No backport is needed.
2021-05-14 08:26:38 +02:00
Daniel Corbett
cc9d9b0906 DOC: config: Fix configuration example for mqtt
This patch fixes the example for mqtt_is_valid(), it was missing
curly braces within the ACL.
2021-05-13 18:10:35 +02:00
Willy Tarreau
89f6dedf48 BUG/MINOR: lua/vars: prevent get_var() from allocating a new name
Variable names are stored into a unified list that helps compare them
just based on a pointer instead of duplicating their name with every
variable. This is convenient for those declared in the configuration
but this started to cause issues with Lua when random names would be
created upon each access, eating lots of memory and CPU for lookups,
hence the work in 2.2 with commit 4e172c93f ("MEDIUM: lua: Add
`ifexist` parameter to `set_var`") to address this.

But there remains a corner case with get_var(), which also allocates
a new variables. After a bit of thinking and discussion, it never
makes sense to allocate a new variable name on get_var():
  - if the name exists, it will be returned ;
  - if it does not exist, then the only way for it to appear will
    be that some code calls set_var() on it
  - a call to get_var() after a careful set_var(ifexist) ruins the
    effort on set_var().

For this reason, this patch addresses this issue by making sure that
get_var() will never cause a variable to be allocated. This is done
by modifying vars_get_by_name() to always call register_name() with
alloc=0, since vars_get_by_name() is exclusively used by Lua and the
new CLI's "get/set var" which also benefit from this protection.

It probably makes sense to backport this as far as 2.2 after some
observation period and feedback from users.

For more context and discussions about the issues this was causing,
see https://www.mail-archive.com/haproxy@formilux.org/msg40451.html
and in issue #664.
2021-05-13 13:44:32 +02:00
Willy Tarreau
832e242b1f DEBUG: ssl: export ssl_sock_close() to see its symbol resolved in profiling
This function is one of the few high-profile, unresolved ones in the memory
profile output, let's have it resolve to ease matching of SSL allocations,
which are not easy to follow.
2021-05-13 10:11:03 +02:00
Willy Tarreau
f1c8a3846c MINOR: activity/cli: optionally support sorting by address on "show profiling"
"show profiling" by default sorts by usage/counts, which is suitable for
occasional use. But when called from scripts to monitor/search variations,
this is not very convenient. Let's add a new "byaddr" option to support
sorting the output by address. It also eases matching alloc/free calls
from within a same library, or reading grouped tasks costs by library.
2021-05-13 10:00:17 +02:00
Tim Duesterhus
b38b5c3d0d Revert "CI: Build VTest with clang"
The issue with VTest not building properly in gcc is fixed since commit
vtest/VTest@0730540c43. Revert the patch to keep
the CI configuration simple.

This reverts commit e61f53eb44a390f9a8c8c4f34077c365942e0729.
2021-05-12 21:28:08 +02:00
varnav
5a3fe9fcbf DOC: management: Correct example reload command in the document
Current example is:

  `echo "reload" | socat /var/run/haproxy-master.sock`

it will cause socat error:

  `exactly 2 addresses required (there are 1); use option "-h" for help`

Correct working command is:

  `echo "reload" | socat /var/run/haproxy-master.sock stdin`
2021-05-12 20:35:41 +02:00
Willy Tarreau
89da7cf5d5 EXAMPLES: add a trivial config for quick testing
This config was taken from the example provided in the dpbench project.
It uses minimalistic keywords and is trivial to setup and adapt on any
test machine for a quick test. It can be convenient when comparing
different server platforms to pick the one delivering the best
performance in various dimensions (conn rate, req rate, ssl rate,
bit rate). It uses a single listener (optionally a second one with
SSL), a single server, power-of-two-choices (random(2)) algorithm,
and no privileged directive.
2021-05-12 17:54:56 +02:00
Willy Tarreau
71c5f6d477 EXAMPLES: add a "basic-config-edge" example config
This config uses TLS, HSTS, redirects, cache, compression, stats,
log to stderr, and simple load balancing in a simple and commented
config which could be used as a starter for many other ones,
especially in containers.
2021-05-12 17:50:16 +02:00
Willy Tarreau
973a937c5f BUG/MINOR: stats: fix lastchk metric that got accidently lost
Commit d3a9a4992 ("MEDIUM: stats: allow to select one field in
`stats_fill_sv_stats`") left one occurrence of a direct assignment
of stats[] instead of placing it into the <metric> variable, and it
was on ST_F_CHECK_STATUS. This resulted in the field being overwritten
with an empty one immediately after being set in stats_fill_sv_stats()
and the field to appear empty on the stats page.

No backport is needed as this was only for 2.4.
2021-05-12 17:50:16 +02:00
Willy Tarreau
4263f68b65 CLEANUP: stick-table: remove a leftover of an old keyword declaration
There was a leftover of an antique declaration commented out that has
now been superseded by new ones, let's remove it.
2021-05-12 17:50:16 +02:00
Amaury Denoyelle
94fd1339e7 REGTESTS: stick-table: add src_conn_rate test
Add a simple test which uses src_conn_rate stick table fetch. Limit the
connection rate to 3. The 4th connection should return a 403.
2021-05-12 15:30:03 +02:00
Amaury Denoyelle
c460c70ab7 BUG/MEDIUM: stick_table: fix crash when using tcp smp_fetch_src
Since the introduction of bc_src, smp_fetch_src from tcp_sample inspect
the kw argument to choose between the frontend or the backend source
address. However, for the stick tables, the argument is left to NULL.
This causes a segfault.

Fix the crash by explicitely set the kw argument to "src" to retrieve
the source address of the frontend side.

This bug was introduced by the following commit :
  7d081f02a4
  MINOR: tcp_samples: Add samples to get src/dst info of the backend connection

It does not need a backport as it is integrated in the current 2.4-dev
branch.

To reproduce the crash, I used the following config :

frontend fe
	bind :20080
	http-request track-sc0 src table foo
	http-request reject if { src_conn_rate(foo) gt 10 }
	use_backend h1

backend foo
	stick-table type ip size 200k expire 30s store conn_rate(60s)

backend h1
	server nginx 127.0.0.1:30080 check

This should fix the github issue #1247.
2021-05-12 15:30:03 +02:00
Willy Tarreau
40a871f09d BUILD: makefile: add a few popular ARMv8 CPU targets
This adds the following CPUs to the makefile:
  - armv81    : modern ARM cores (Cortex A55/A75/A76/A78/X1, Neoverse, Graviton2)
  - a72       : ARM Cortex-A72 or A73 (e.g. RPi4, Odroid N2, VIM3, AWS Graviton)
  - a53       : ARM Cortex-A53 or any of its successors in 64-bit mode (e.g. RPi3)
  - armv8-auto: both older and newer ARMv8 cores, with a minor runtime penalty

The reasons for these ones are:
  - a53 is the common denominator of all of its successors, and does
    support CRC32 which is used by the gzip compression, that the generic
    armv8-a does not ;

  - a72 supports the same features but is an out-of-order one that deserves
    better optimizations; it's found in a number of high-performance
    multi-core CPUs mainly oriented towards I/O and network processing
    (Armada 8040, NXP LX2160A, AWS Graviton), and more recently the
    Raspberry Pi 4. The A73 found in VIM3 and Odroid-N2 can use the same
    optimizations ;

  - armv81 is for generic ARMv8.1-A and above, automatically enables LSE
    atomics which are way more scalable, and CRC32. This one covers modern
    ARMv8 cores such as Cortex A55/A75/A76/A77/A78/X1 and the Neoverse
    family such as found in AWS's Graviton2. The LSE instructions are
    essential for large numbers of cores (8 and above).

  - armv8-auto dynamically enables support for LSE extensions when
    detected while still being compatible with older cores. There is a
    small performance penalty in doing this (~3%) but a same executable
    will perform optimally on a wider range of hardware. This should be
    the best option for distros. It requires gcc-10 or gcc-9.4 and above.

When no CPU is specified, GCC version 10.2 and above will automatically
implement the wrapper used to detect the LSE extensions.
2021-05-12 14:23:22 +02:00
Miroslav Zagorac
d2acd0b3a7 BUILD/MINOR: opentracing: fixed compilation with filter enabled
The inclusion of header files proxy.h and tools.h was added to the
addons/ot/include/include.h file.  Without this HAProxy cannot be
compiled if the OpenTracing filter is to be used.
2021-05-12 09:45:16 +02:00
Willy Tarreau
9e274280a4 IMPORT: slz: do not produce the crc32_fast table when CRC is natively supported
On ARM with native CRC support, no need to inflate the executable with
a 4kB CRC table, let's just drop it.

This is slz upstream commit d8715db20b2968d1f3012a734021c0978758f911.
2021-05-12 09:29:33 +02:00
Willy Tarreau
027fdcb168 IMPORT: slz: use the generic function for the last bytes of the crc32
This is the only place where we conditionally use the crc32_fast table,
better call the crc32_char inline function for this. This should also
reduce by ~1kB the L1 cache footprint of the compression when dealing
with small blocks, and at least shows a consistent 0.5% perf improvement.

This is slz upstream commit 075351b6c2513b548bac37d6582e46855bc7b36f.
2021-05-12 09:29:29 +02:00
Tim Duesterhus
dec1c36b3a MINOR: uri_normalizer: Add fragment-encode normalizer
This normalizer encodes '#' as '%23'.

See GitHub Issue #714.
2021-05-11 17:24:32 +02:00
Tim Duesterhus
c9e05ab2de MINOR: uri_normalizer: Add fragment-strip normalizer
This normalizer strips the URI's fragment component which should never be sent
to the server.

See GitHub Issue #714.
2021-05-11 17:23:46 +02:00
Tim Duesterhus
2f413136e9 BUG/MINOR: http_act: Fix normalizer names in error messages
These places were forgotten when the normalizers were renamed.

Bug introduced in 5be6ab269e, which is 2.4.
No backport needed.
2021-05-11 17:21:53 +02:00
Willy Tarreau
da7f11bfb5 CLEANUP: pattern: remove the unused and dangerous pat_ref_reload()
This function was not used anymore after the atomic updates were
implemented in 2.3, and it must not be used given that it does not
yield and can easily make the process hang for tens of seconds on
large acls/maps. Let's remove it before someone uses it as an
example to implement something else!
2021-05-11 16:49:55 +02:00
Willy Tarreau
f5fb858bb7 MINOR: memprof: also report the totals and delta alloc-free
Already had to perform too many additions by external scripts, it's
time to add the totals and delay alloc-free as a last line in the
output of the "show memory profiling".
2021-05-11 14:21:18 +02:00
Willy Tarreau
616491b7f7 MINOR: memprof: also report the method used by each call
This was planned but missing in the previous attempt, we really need to
see what is used at each place, especially due to realloc(). Now we
print the function used in front of the caller's address, as well as
the average alloc/free size per call.
2021-05-11 14:14:30 +02:00
Willy Tarreau
79acefa749 BUG/MINOR: memprof: properly account for differences for realloc()
The realloc() function checks if the size grew or reduced in order to
count an allocation or a free, but it does so with the absolute (new
or old) value instead of the difference, resulting in realloc() often
being credited for allocating too much.

No backport is needed.
2021-05-11 09:12:56 +02:00
Ilya Shipitsin
3df5989960 CLEANUP: assorted typo fixes in the code and comments
This is 23rd iteration of typo fixes
2021-05-10 23:05:08 +02:00
Ilya Shipitsin
9c0fcea898 CI: extend spellchecker whitelist, add "ists" as well
codespell does not handle plurals, we already whitelusted "ist", let us
whitelist "ists" as well
2021-05-10 23:04:55 +02:00
Tim Duesterhus
e61f53eb44 CI: Build VTest with clang
Current VTest master fails to build using gcc, see vtest/VTest#27.

This patch is to be reverted once VTest is fixed.
2021-05-10 23:00:59 +02:00
Daniel Corbett
67b3cefea3 CLEANUP: cli/activity: Remove double spacing in set profiling command
It was found that when viewing the help output from the CLI that
"set profiling" had 2 spaces in it, which was pushing it out from
the rest of similar commands.

i.e. it looked like this:
  prepare acl <acl>
  prepare map <acl>
  set  profiling  <what>  {auto|on|off}
  set dynamic-cookie-key backend <bk> <k>
  set map <map> [<key>|#<ref>] <value>
  set maxconn frontend <frontend> <value>

This patch removes all of the double spaces within the command and
unifies them to single spacing, which is what is observed within the
rest of the commands.
2021-05-10 22:29:12 +02:00
Amaury Denoyelle
c89d5337ee BUG/MINOR: http_fetch: fix possible uninit sockaddr in fetch_url_ip/port
Check the return value of url2sa in smp_fetch_url_ip/port. If negative,
the address result is uninitialized and the sample fetch is aborted.
Also, the sockaddr is prelimiary zero'ed before calling url2sa to ensure
that it is not used by upper functions even if the sample returns 0.

Without the check, the value returned by the url_ip/url_port fetches is
unspecified. This can be triggered with the following curl :
$ curl -iv --request-target "xxx://127.0.0.1:20080/" http://127.0.0.1:20080/

This should be backported to all stable branches. However, note that
between the 1.8 and 2.0, the targetted functions have been extracted
from proto_http.c to http_fetch.c.

This should fix in part coverity report from the github issue #1244.
2021-05-10 14:48:55 +02:00
Willy Tarreau
46b93afdb3 [RELEASE] Released version 2.4-dev19
Released version 2.4-dev19 with the following main changes :
    - BUG/MINOR: hlua: Don't rely on top of the stack when using Lua buffers
    - BUG/MEDIUM: cli: prevent memory leak on write errors
    - BUG/MINOR: ssl/cli: fix a lock leak when no memory available
    - MINOR: debug: add a new "debug dev sym" command in expert mode
    - MINOR: pools/debug: slightly relax DEBUG_DONT_SHARE_POOLS
    - CI: Github Actions: switch to LibreSSL-3.3.3
    - MINOR: srv: close all idle connections on shutdown
    - MINOR: connection: move session_list member in a union
    - MEDIUM: mux_h1: release idling frontend conns on soft-stop
    - MEDIUM: connection: close front idling connection on soft-stop
    - MINOR: tools: add functions to retrieve the address of a symbol
    - CLEANUP: activity: mark the profiling and task_profiling_mask __read_mostly
    - MINOR: activity: add a "memory" entry to "profiling"
    - MINOR: activity: declare the storage for memory usage statistics
    - MEDIUM: activity: collect memory allocator statistics with USE_MEMORY_PROFILING
    - MINOR: activity: clean up the show profiling io_handler a little bit
    - MINOR: activity: make "show profiling" support a few arguments
    - MINOR: activity: make "show profiling" also dump the memoery usage
    - MINOR: activity: add the profiling.memory global setting
    - BUILD: makefile: add new option USE_MEMORY_PROFILING
    - MINOR: channel: Rely on HTX version if appropriate in channel_may_recv()
    - BUG/MINOR: stream-int: Don't block reads in si_update_rx() if chn may receive
    - MINOR: conn-stream: Force mux to wait for read events if abortonclose is set
    - MEDIUM: mux-h1: Don't block reads when waiting for the other side
    - BUG/MEDIUM: mux-h1: Properly report client close if abortonclose option is set
    - REGTESTS: Add script to test abortonclose option
    - MINOR: mux-h1: clean up conditions to enabled and disabled splicing
    - MINOR: mux-h1: Subscribe for sends if output buffer is not empty in h1_snd_pipe
    - MINOR: mux-h1: Always subscribe for reads when splicing is disabled
    - MEDIUM: mux-h1: Wake H1 stream when both sides a synchronized
    - CLEANUP: mux-h1: rename WAIT_INPUT/WAIT_OUTPUT flags
    - MINOR: mux-h1: Manage processing blocking flags on the H1 stream
    - BUG/MINOR: stream: Decrement server current session counter on L7 retry
    - BUG/MINOR: config: fix uninitialized initial state in ".if" block evaluator
    - BUG/MINOR: config: add a missing "ELIF_TAKE" test for ".elif" condition evaluator
    - BUG/MINOR: config: .if/.elif should also accept negative integers
    - MINOR: config: centralize the ".if"/".elif" condition parser and evaluator
    - MINOR: config: keep up-to-date current file/line/section in the global struct
    - MINOR: config: support some pseudo-variables for file/line/section
    - BUILD: activity: do not include malloc.h
    - MINOR: arg: improve the error message on missing closing parenthesis
    - MINOR: global: export the build features string list
    - MINOR: global: add version comparison functions
    - MINOR: config: improve .if condition error reporting
    - MINOR: config: make cfg_eval_condition() support predicates with arguments
    - MINOR: config: add predicate "defined()" to conditional expression blocks
    - MINOR: config: add predicates "streq()" and "strneq()" to conditional expressions
    - MINOR: config: add predicate "feature" to detect certain built-in features
    - MINOR: config: add predicates "version_atleast" and "version_before" to cond blocks
    - BUG/MINOR: activity: use the new pointer to calculate the new size in realloc()
    - BUG/MINOR: stream: properly clear the previous error mask on L7 retries
    - MEDIUM: log: slightly refine the output format of alerts/warnings/etc
    - MINOR: config: add a new message directive: .diag
    - CLEANUP: cli/tree-wide: properly re-align the CLI commands' help messages
    - BUG/MINOR: stream: Reset stream final state and si error type on L7 retry
    - BUG/MINOR: checks: Handle synchronous connect when a tcpcheck is started
    - BUG/MINOR: checks: Reschedule check on observe mode only if fastinter is set
    - MINOR: global: define tainted flag
    - MINOR: cfgparse: add a new field flags in cfg_keyword
    - MINOR: cfgparse: implement experimental config keywords
    - MINOR: action: replace match_pfx by a keyword flags field
    - MINOR: action: implement experimental actions
    - MINOR: cli: set tainted when using CLI expert/experimental mode
    - MINOR: stats: report tainted on show info
    - MINOR: http_act: mark normalize-uri as experimental
    - BUILD: fix usage of ha_alert without format string
    - MINOR: proxy: define PR_CAP_LB
    - BUG/MINOR: server: do not report diag for peer servers with null weight
    - DOC: ssl: Extra files loading now works for backends too
    - ADDONS: make addons/ discoverable by git via .gitignore
    - DOC: ssl: Add information about crl-file option
    - MINOR: sample: improve error reporting on missing arg to strcmp() converter
    - DOC: management: mention that some fields may be emitted as floats
    - MINOR: tools: implement trimming of floating point numbers
    - MINOR: tools: add a float-to-ascii conversion function
    - MINOR: freq_ctr: add new functions to report float measurements
    - MINOR: stats: avoid excessive padding of float values with trailing zeroes
    - MINOR: stats: add the HTML conversion for float types
    - MINOR: stats: pass the appctx flags to stats_fill_info()
    - MINOR: stats: support an optional "float" option to "show info"
    - MINOR: stats: use tv_remain() to precisely compute the uptime
    - MINOR: stats: report uptime and start time as floats with subsecond resolution
    - MINOR: stats: make "show info" able to report rates as floats when asked
    - MINOR: config: mark tune.fd.edge-triggered as experimental
    - REORG: vars: move the "proc" scope variables out of the global struct
    - REORG: threads: move all_thread_mask() to thread.h
    - BUILD: wdt: include signal-t.h
    - BUILD: auth: include missing list.h
    - REORG: mworker: move proc_self from global to mworker
    - BUILD: ssl: ssl_utils requires chunk.h
    - BUILD: config: cfgparse-ssl.c needs tools.h
    - BUILD: wurfl: wurfl.c needs tools.h
    - BUILD: spoe: flt_spoe.c needs tools.h
    - BUILD: promex: service-prometheus.c needs tools.h
    - BUILD: resolvers: include tools.h
    - BUILD: config: include tools.h in cfgparse-listen.c
    - BUILD: htx: include tools.h in http_htx.c
    - BUILD: proxy: include tools.h in proxy.c
    - BUILD: session: include tools.h in session.c
    - BUILD: cache: include tools.h in cache.c
    - BUILD: sink: include tools.h in sink.c
    - BUILD: connection: include tools.h in connection.c
    - BUILD: server-state: include tools.h from server_state.c
    - BUILD: dns: include tools.h in dns.c
    - BUILD: payload: include tools.h in payload.c
    - BUILD: vars: include tools.h in vars.c
    - BUILD: compression: include tools.h in compression.c
    - BUILD: mworker: include tools.h from mworker.c
    - BUILD: queue: include tools.h from queue.c
    - BUILD: udp: include tools.h from proto_udp.c
    - BUILD: stick-table: include freq_ctr.h from stick_table.h
    - BUILD: server: include tools.h from server.c
    - BUILD: server: include missing proxy.h in server.c
    - BUILD: sink: include proxy.h in sink.c
    - BUILD: mworker: include proxy.h in mworker.c
    - BUILD: filters: include proxy.h in filters.c
    - BUILD: fcgi-app: include proxy.h in fcgi-app.c
    - BUILD: connection: move list_mux_proto() to connection.c
    - REORG: stick-table: uninline stktable_alloc_data_type()
    - REORG: stick-table: move composite address functions to stick_table.h
    - REORG: config: uninline warnifnotcap() and failifnotcap()
    - BUILD: task: remove unused includes from task.c
    - MINOR: task: stop including stream.h from task.c
    - BUILD: connection: stop including listener-t.h
    - BUILD: hlua: include proxy.h from hlua.c
    - BUILD: mux-h1: include proxy.h from mux-h1.c
    - BUILD: mux-fcgi: include proxy.h from mux-fcgi.c
    - BUILD: listener: include proxy.h from listener.c
    - BUILD: http-rules: include proxy.h from http_rules.c
    - BUILD: thread: include log.h from thread.c
    - BUILD: comp: include proxy.h from flt_http_comp.c
    - BUILD: fd: include log.h from fd.c
    - BUILD: config: do not include proxy.h nor errors.h anymore in cfgparse.h
    - BUILD: makefile: reorder object files by build time
    - DOC: Fix a few grammar/spelling issues and casing of HAProxy
    - REGTESTS: run-regtests: match both "HAProxy" and "HA-Proxy" in the version
    - MINOR: version: report "HAProxy" not "HA-Proxy" in the version output
    - DOC: remove last occurrences of "HA-Proxy" syntax
    - DOC: peers: fix the protocol tag name in the doc
    - ADMIN: netsnmp: report "HAProxy" and not "Haproxy" in output descriptions
    - MEDIUM: mailers: use "HAProxy" nor "HAproxy" in the subject of messages
    - DOC: fix a few remainig cases of "Haproxy" and "HAproxy" in doc and comments
    - MINOR: tools/rnd: compute the result outside of the CAS loop
    - BUILD: http_fetch: address a few aliasing warnings with older compilers
    - BUILD: ssl: define HAVE_CRYPTO_memcmp() based on the library version
    - BUILD: errors: include stdarg in errors.h
    - REGTESTS: disable inter-thread idle connection sharing on sensitive tests
    - MINOR: cli: make "help" support a command in argument
    - MINOR: cli: sort the output of the "help" keywords
    - CLEANUP: cli/mworker: properly align the help messages
    - BUILD: memprof: make the old caller pointer a const in get_prof_bin()
    - BUILD: compat: include malloc_np.h for USE_MEMORY_PROFILING on FreeBSD
    - CI: Github Actions: enable USE_QUIC=1 for BoringSSL builds
    - BUG/MEDIUM: quic: fix null deref on error path in qc_conn_init()
    - BUILD: cli: appease a null-deref warning in cli_gen_usage_msg()
2021-05-10 07:50:26 +02:00
Willy Tarreau
5db446d7e1 BUILD: cli: appease a null-deref warning in cli_gen_usage_msg()
The compiler sees the possibility of null-deref for which a path is
possible but which doesn't exist as we didn't pass a null args outside
of the help request. The test was introduced by the simplified test on
ishelp variable, so let's add it to shut the warning.
2021-05-10 07:47:05 +02:00
Willy Tarreau
7deb28ce65 BUG/MEDIUM: quic: fix null deref on error path in qc_conn_init()
When ctx is NULL, we go to the "err" label, which could dereference it.
No backport is needed.
2021-05-10 07:40:27 +02:00
Ilya Shipitsin
714f28ceef CI: Github Actions: enable USE_QUIC=1 for BoringSSL builds
if haproxy is built against BoringSSL, let us add USE_QUIC=1 dynamically
2021-05-10 07:24:55 +02:00
Willy Tarreau
9bc457f0ea BUILD: compat: include malloc_np.h for USE_MEMORY_PROFILING on FreeBSD
This include is needed for malloc_usable_size(). It's also important to
think about disabling global pools.
2021-05-09 23:46:45 +02:00
Willy Tarreau
4a75328485 BUILD: memprof: make the old caller pointer a const in get_prof_bin()
It's a const void* in the target, we can't use a void* in the caller,
this causes a build warning with clang.
2021-05-09 23:18:50 +02:00
Willy Tarreau
23c740ea51 CLEANUP: cli/mworker: properly align the help messages
CLI help commands were re-aligned by commit b205bfdab but the
master-worker ones were not done, let's do it now.
2021-05-09 22:49:44 +02:00
Willy Tarreau
92fbbcc4c6 MINOR: cli: sort the output of the "help" keywords
It's still very difficult to find all commands starting with a given
keyword like "set", "show" etc. Let's sort the lines by usage message,
this is much more convenient.
2021-05-09 22:39:07 +02:00
Willy Tarreau
0b1b830e88 MINOR: cli: make "help" support a command in argument
With ~100 commands on the CLI, it's particularly difficult to find a
specific one in the "help" output. The function used to display the
help already supports filtering on certain commands, so in the end it's
just needed to pass the argument of the help command to enable the
automatic filtering. That's what this patch does so that "help clear"
only lists commands starting with "clear" and that "help map" lists
commands containing "map" in them.
2021-05-09 20:59:23 +02:00
Willy Tarreau
e1465c1e46 REGTESTS: disable inter-thread idle connection sharing on sensitive tests
Some regtests involve multiple requests from multiple clients, which can
be dispatched as multiple requests to a server. It turns out that the
idle connection sharing works so well that very quickly few connections
are used, and regularly some of the remaining idle server connections
time out at the moment they were going to be reused, causing those random
"HTTP header incomplete" traces in the logs that make them fail often. In
the end this is only an artefact of the test environment.

And indeed, some tests like normalize-uri which perform a lot of reuse
fail very often, about 20-30% of the times in the CI, and 100% of the
time in local when running 1000 tests in a row. Others like ubase64,
sample_fetches or vary_* fail less often but still a lot in tests.

This patch addresses this by adding "tune.idle-pool.shared off" to all
tests which have at least twice as many requests as clients. It proves
very effective as no single error happens on normalize-uri anymore after
10000 tests. Also 100 full runs of all tests yield no error anymore.

One test is tricky, http_abortonclose, it used to fail ~10 times per
1000 runs and with this workaround still fails once every 1000 runs.
But the test is complex and there's a warning in it mentioning a
possible issue when run in parallel due to a port reuse.
2021-05-09 14:41:41 +02:00
Willy Tarreau
6b86d9e485 BUILD: errors: include stdarg in errors.h
It's needed for va_list as defined in ha_vdiag_warning().
2021-05-09 12:11:41 +02:00
Willy Tarreau
2a8a2f0223 BUILD: ssl: define HAVE_CRYPTO_memcmp() based on the library version
The build fails on versions older than 1.0.1d which is the first one
introducing CRYPTO_memcmp(), so let's have a define for this instead
of enabling it whenever USE_OPENSSL is set. One could also wonder why
we're relying on openssl for such a trivial thing, and a simple local
implementation could also allow to restore lexicographic ordering.
2021-05-09 12:10:36 +02:00
Willy Tarreau
48584645fb BUILD: http_fetch: address a few aliasing warnings with older compilers
gcc-4.4 complains about aliasing in smp_fetch_url_port() and
smp_fetch_url_ip() because the local addr variable is casted to sturct
sockaddr_in before being checked. The family should be checked on the
sockaddr_storage and we have a function to retrieve the port.
The compiler still sees some warnings but these ones are OK now.
2021-05-09 10:32:54 +02:00
Willy Tarreau
b2475a139e MINOR: tools/rnd: compute the result outside of the CAS loop
ha_random64() uses a DWCAS loop to produce the random, but it computes
the resulting value inside the loop while it doesn't change upon success,
so this is a needless overhead inside the critcal path that participates
to making threads fail the race and try again. Let's take the value out
of the loop.
2021-05-09 10:26:14 +02:00
Willy Tarreau
714f34580e DOC: fix a few remainig cases of "Haproxy" and "HAproxy" in doc and comments
Some of the Lua doc and a few places still used "Haproxy" or "HAproxy".
There was even one "HA proxy". A few of them were in an example of VTest
output, indicating that VTest ought to be fixed as well. No big deal but
better address all the remaining ones so that these inconsistencies stop
spreading around.
2021-05-09 06:50:46 +02:00
Willy Tarreau
64975cf2a4 MEDIUM: mailers: use "HAProxy" nor "HAproxy" in the subject of messages
It seems to be the last visible casing inconsistency, but better address
it for completeness otherwise we'll always have to deal with some
exceptions.
2021-05-09 06:45:16 +02:00
Willy Tarreau
6613a3df8c ADMIN: netsnmp: report "HAProxy" and not "Haproxy" in output descriptions
In the SNMP fields descriptions, "Haproxy" was mentioned, let's make it
consistent with the rest.
2021-05-09 06:41:37 +02:00
Willy Tarreau
84c4e7451e DOC: peers: fix the protocol tag name in the doc
The peers protocol has been using "HAProxyS" as a binary tag sent on the
wire since day one in 1.5-dev3 with commit 2b920a1af ("[MAJOR] Add new
files src/peer.c, include/proto/peers.h and include/types/peers.h for
sync stick table management"), regardless, the doc says the protocol
identifier is "HaproxyS". It is likely this got fixed in the code before
merging and not in the doc.

This should be backported to any release as the doc is wrong.
2021-05-09 06:38:07 +02:00