Commit Graph

14698 Commits

Author SHA1 Message Date
Willy Tarreau
5703a38a06 BUILD: stick-table: include freq_ctr.h from stick_table.h
It's needed for update_freq_ctr_period() which is used there.
2021-05-08 19:37:41 +02:00
Willy Tarreau
ce65cbec38 BUILD: udp: include tools.h from proto_udp.c
A few functions are used from there for address conversion but the
file wasn't included.
2021-05-08 13:59:56 +02:00
Willy Tarreau
c1a689f2eb BUILD: queue: include tools.h from queue.c
It uses memprintf() without including the file because it inherited
it from other ones.
2021-05-08 13:59:05 +02:00
Willy Tarreau
745e98ce79 BUILD: mworker: include tools.h from mworker.c
It needs it for memprintf() but didn't include the file.
2021-05-08 13:58:19 +02:00
Willy Tarreau
c624da06c6 BUILD: compression: include tools.h in compression.c
It needs it for memprintf() but it wasn't included.
2021-05-08 13:57:19 +02:00
Willy Tarreau
67046bfc50 BUILD: vars: include tools.h in vars.c
A number of functions from tools.h are used there but the file was not
included.
2021-05-08 13:56:31 +02:00
Willy Tarreau
485261beab BUILD: payload: include tools.h in payload.c
It needs it for memprintf() but used to inherit it via other include files.
2021-05-08 13:55:40 +02:00
Willy Tarreau
9f9e9fc20c BUILD: dns: include tools.h in dns.c
It is used for get_addr_len() without being included. It could be worth
splitting address manipulation functions to a different set of files.
2021-05-08 13:09:46 +02:00
Willy Tarreau
bf1ae1a4b1 BUILD: server-state: include tools.h from server_state.c
Many functions from tools.h are called there without the file being
included.
2021-05-08 13:08:34 +02:00
Willy Tarreau
908908ef2a BUILD: connection: include tools.h in connection.c
Several functions from tools.h are called there without the file being
included.
2021-05-08 13:07:31 +02:00
Willy Tarreau
4bad5e2080 BUILD: sink: include tools.h in sink.c
Several functions from tools.h are used in sink.c without tools.h being
included.
2021-05-08 13:05:30 +02:00
Willy Tarreau
ce6700aec5 BUILD: cache: include tools.h in cache.c
cache.c uses a lot of functions from tools.h without including it.
2021-05-08 13:03:55 +02:00
Willy Tarreau
523ca9d102 BUILD: session: include tools.h in session.c
The file session.c calls plenty of functions from tools.h but did not
include it.
2021-05-08 13:03:04 +02:00
Willy Tarreau
e684483ec5 BUILD: proxy: include tools.h in proxy.c
Many functions are used from tools.h but the file wasn't included and
was inherited through others.
2021-05-08 13:02:07 +02:00
Willy Tarreau
4cbf62d48a BUILD: htx: include tools.h in http_htx.c
Several functions from tools.h are called there and it used to be
inherited through others.
2021-05-08 13:01:23 +02:00
Willy Tarreau
e9dcb3cd8a BUILD: config: include tools.h in cfgparse-listen.c
Many functions defined in tools.h were called there but the file used
to be inherited via others.
2021-05-08 13:00:23 +02:00
Willy Tarreau
ca14dd5537 BUILD: resolvers: include tools.h
Many functions from tools.h are called there but it was inherited via others.
2021-05-08 12:59:47 +02:00
Willy Tarreau
0fd04fd620 BUILD: promex: service-prometheus.c needs tools.h
It calls url_decode() and memprintf() but used to inherit them through
others.
2021-05-08 12:58:12 +02:00
Willy Tarreau
e16ada16d9 BUILD: spoe: flt_spoe.c needs tools.h
It uses many functions declared there but used to inherit it through others.
2021-05-08 12:57:17 +02:00
Willy Tarreau
2bd86284e6 BUILD: wurfl: wurfl.c needs tools.h
It calls memprintf() which is defined there but used to inherit it
through others.
2021-05-08 12:56:20 +02:00
Willy Tarreau
cc81ecac44 BUILD: config: cfgparse-ssl.c needs tools.h
It calls parse_time_err() which is defined there but used to inherit it
through others.
2021-05-08 12:54:42 +02:00
Willy Tarreau
cb72b7e028 BUILD: ssl: ssl_utils requires chunk.h
It uses chunk_printf() so it needs it. Currently it gets it through
others.
2021-05-08 12:52:56 +02:00
Willy Tarreau
15f9ac3c59 REORG: mworker: move proc_self from global to mworker
Only mworker uses proc_self, and it was declared in global.h, forcing
users of global.h to include mworker and its dependencies.

Moving it to mworker reduces the preprocessed size of version.c from
170 to 125kB by shrinking the number of local includes from 30 to 16
and the number of system includes from 147 to 132.
2021-05-08 12:34:44 +02:00
Willy Tarreau
e8ceea1345 BUILD: auth: include missing list.h
list_for_each_entry() requires list.h but used to inherit it by accident
through global.h and mworker-t.h. Let's explicitly add it.
2021-05-08 12:29:51 +02:00
Willy Tarreau
7f673c2cde BUILD: wdt: include signal-t.h
WDT_SIG is used there, thus signal-t.h is required. Currently it's
retrieved by accident through global.h.
2021-05-08 12:29:01 +02:00
Willy Tarreau
29c460bc07 REORG: threads: move all_thread_mask() to thread.h
It was declared in global.h, forcing plenty of source files to include
it only for this while it's only based on definitions from thread.h.
2021-05-08 12:26:10 +02:00
Willy Tarreau
cfc4f24d80 REORG: vars: move the "proc" scope variables out of the global struct
The presence of this field causes a long dependency chain because almost
everyone includes global-t.h, and vars include sample_data which include
some system includes as well as HTTP parts.

There is absolutely no reason for having the process-wide variables in
the global struct, let's just move them into vars.c and vars.h. This
reduces from ~190k to ~170k the preprocessed output of version.c.
2021-05-08 12:11:29 +02:00
Willy Tarreau
9eec7e206e MINOR: config: mark tune.fd.edge-triggered as experimental
This one is stated as experimental in the doc but could still be used
by accidental copy-paste. Let's mark it with KWF_EXPERIMENTAL so that
users have to opt-in to use it.
2021-05-08 11:06:32 +02:00
Willy Tarreau
c5977728b3 MINOR: stats: make "show info" able to report rates as floats when asked
Now "show info float" will also report SSL rates, connection rates and
key reuse ratios as floats. This can be convenient at very low rates.

Note that the SSL reuse ratio which used to commonly oscillate between
0 and 1 under load is now more often above zero with small values. It
indicates that for better stability we shouldn't be comparing a key rate
with a connection rate but instead we should measure the reuse rate at
its source.
2021-05-08 10:52:12 +02:00
Willy Tarreau
e8abc3293f MINOR: stats: report uptime and start time as floats with subsecond resolution
When "show info float" is used, the uptime and start time will be reported
with subsecond resolution (microsecond actually since timeval is used).
2021-05-08 10:52:12 +02:00
Willy Tarreau
d37e26eaa6 MINOR: stats: use tv_remain() to precisely compute the uptime
We'll have to support reporting sub-second uptimes, so let's use the
appropriate function which will automatically adjust the tv_usec field.
In addition to this, it will also report a more accurate uptime thanks
to considering the sub-second part in the result.
2021-05-08 10:52:12 +02:00
Willy Tarreau
2745620240 MINOR: stats: support an optional "float" option to "show info"
This will allow some fields to be produced with a higher accuracy when
the requester indicates being able to parse floats. Rates and times are
among the elements which can make sense.
2021-05-08 10:52:12 +02:00
Willy Tarreau
0b26b3866c MINOR: stats: pass the appctx flags to stats_fill_info()
Currently the stats filling function knows nothing about the caller's
needs, so let's pass the STAT_* flags so that it can adapt to the
requester's constraints.
2021-05-08 10:52:12 +02:00
Willy Tarreau
6004fb7681 MINOR: stats: add the HTML conversion for float types
For the prometheus exporter, a new float type was added for the fields
and its conversion was added everywhere except for the HTML output.
Now that we have F2H() we can implement it for consistency.
2021-05-08 10:48:17 +02:00
Willy Tarreau
065ba3186e MINOR: stats: avoid excessive padding of float values with trailing zeroes
When emitting stats, we don't need to have 6 zeroes after the decimal point
for each value, so let's trim floating point numbers to the longest needed
only.
2021-05-08 10:48:17 +02:00
Willy Tarreau
aa33f20e27 MINOR: freq_ctr: add new functions to report float measurements
For stats reporting it can be convenient to report floats at low rates
instead of discrete integers. We do have quite some precision since we
currently divide counters by number of milliseconds, so we can usually
add 3 digits after the decimal point.
2021-05-08 10:48:17 +02:00
Willy Tarreau
ae03d26eea MINOR: tools: add a float-to-ascii conversion function
We already had ultoa_r() and friends but nothing to emit inline floats.
This is now done with ftoa_r() and F2A/F2H. Note that the latter both use
the itoa_str[] as temporary storage and that the HTML format currently is
the exact same as the ASCII one. The trailing zeroes are always timmed so
these outputs are usable in user-visible output.
2021-05-08 10:48:17 +02:00
Willy Tarreau
56d1d8dab0 MINOR: tools: implement trimming of floating point numbers
When using "%f" to print a float, it automatically gets 6 digits after
the decimal point and there's no way to automatically adjust to the
required ones by dropping trailing zeroes. This function does exactly
this and automatically drops the decimal point if all digits after it
were zeroes. This will make numbers more friendly in stats and makes
outputs shorter (e.g. JSON where everything is just a "number").

The function is designed to be easy to use with snprint() and chunks:

  snprintf:
    flt_trim(buf, 0, snprintf(buf, sizeof(buf), "%f", x));

  chunk_printf:
    out->data = flt_trim(out->area, 0, chunk_printf(out, "%f", x));

  chunk_appendf:
    size_t prev_data = out->data;
    out->data = flt_trim(out->area, prev_data, chunk_appendf(out, "%f", x));
2021-05-08 10:42:11 +02:00
Willy Tarreau
589722ed2c DOC: management: mention that some fields may be emitted as floats
Floats in stats output are currently not emitted but are technically
possible, so let's mention that.
2021-05-08 07:48:07 +02:00
Willy Tarreau
a1169b6231 MINOR: sample: improve error reporting on missing arg to strcmp() converter
Calling the strcmp() converter with no argument yields this strange error:

  [ALERT]    (31439) : parsing [test.cfg:3] : error detected in frontend 'f' while parsing 'http-request redirect' rule : failed to parse sample expression <src,strcmp]> : invalid args in converter 'strcmp' : failed to register variable name ''.

This is because the vars name check tries to see if it can create such a
variable having an empty name. Let's at least make a special case of the
missing argument. Now we can read a more explicit:

  [ALERT]    (31655) : parsing [test.cfg:3] : error detected in frontend 'f' while parsing 'http-request redirect' rule : failed to parse sample expression <src,strcmp]> : invalid args in converter 'strcmp' : missing variable name.

This was done for secure_strcmp() as well.
2021-05-08 06:55:25 +02:00
Remi Tricot-Le Breton
02bd68431b DOC: ssl: Add information about crl-file option
When using the crl-file option with multiple Certificate Authority
levels in the CA chain, there must be one CRL per CA or the verify
function on the backend side will raise an "unagle to get certificate
CRL" error (error code 3).

This was required by GitHub issue #1201.
2021-05-07 18:31:11 +02:00
Willy Tarreau
90f2c7f41a ADDONS: make addons/ discoverable by git via .gitignore
When the contrib/ parts were moved to addons/, no rule was added in
.gitignore to make addons/ searchable for new files, let's fix it.
2021-05-07 16:48:14 +02:00
Remi Tricot-Le Breton
7c980dffad DOC: ssl: Extra files loading now works for backends too
When implementing the server side certificate hot update, the ckch
mechanism was used on the backend side in order to mimic the frontend
certificate management and to enable server line certificate update via
the CLI (see GitHub issue #427). As an unexpected side effect, we now
also look for ssl extra files (cert.pem.key, cert.pem.ocsp ...) for the
backend side.
This patch updates the documentation accordingly.

This answers to GitHub issue #845.
2021-05-07 15:37:12 +02:00
Amaury Denoyelle
24abb0cdc1 BUG/MINOR: server: do not report diag for peer servers with null weight
Only check servers attached to a proxy with PR_CAP_LB.

This does not need to be backported as the diag message was added in the
current 2.4-dev branch.
2021-05-07 15:20:54 +02:00
Amaury Denoyelle
b979f59871 MINOR: proxy: define PR_CAP_LB
Add a new proxy capability for proxy with load-balancing capabilities.
This help to differentiate listen/frontend/backend with special proxies
such as peer proxies.
2021-05-07 15:12:20 +02:00
Amaury Denoyelle
86c1d0fddb BUILD: fix usage of ha_alert without format string
The compilation is failing due to no format string used in ha_alert.
This does not need to be backported.
2021-05-07 15:07:21 +02:00
Amaury Denoyelle
a9e639afe2 MINOR: http_act: mark normalize-uri as experimental
normalize-uri http rule is marked as experimental, so it cannot be
activated without the global 'expose-experimental-directives'. The
associated vtc is updated to be able to use it.
2021-05-07 14:35:02 +02:00
Amaury Denoyelle
5dfdf3e5b0 MINOR: stats: report tainted on show info
Add a new info field ST_F_TAINTED to dump tainted status at the end of
the 'show info' output.
2021-05-07 14:35:02 +02:00
Amaury Denoyelle
f492992065 MINOR: cli: set tainted when using CLI expert/experimental mode
Mark the process as tainted as soon as a command command only accessible
in expert or experimental mode is executed.
2021-05-07 14:35:02 +02:00
Amaury Denoyelle
0351773534 MINOR: action: implement experimental actions
Support experimental actions. It is mandatory to use
'expose-experimental-directives' before to be able to use them.

If such action is present in the config file, the tainted status of the
process is updated. Another tainted status is set when an experimental
action is executed.
2021-05-07 14:35:02 +02:00