BUG/MINOR: vars: improve accuracy of the rules used to check expression validity
authorWilly Tarreau <w@1wt.eu>
Thu, 2 Sep 2021 17:03:07 +0000 (19:03 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 3 Nov 2021 15:21:32 +0000 (16:21 +0100)
commit10354a4faa74053ac7229fec2f823191bd02132f
tree4d4a96547e8c661eed49ef0f13cc73c0a0bb04ed
parentae761da14671cf6063c04f803e5c66da3512f80f
BUG/MINOR: vars: improve accuracy of the rules used to check expression validity

The set-var() expression naturally checks whether expressions are valid
in the context of the rule, but it fails to differentiate frontends from
backends. As such for tcp-content and http-request rules, it will only
accept frontend-compatible sample-fetches, excluding those declared with
SMP_UES_BKEND (a few such as be_id, be_name). For the response it accepts
the backend-compatible expressions only, though it seems that there are
no sample-fetch function that are valid only in the frontend's content,
so that should not cause any problem.

Note that while allowing valid configs to be used, the fix might also
uncover some incorrect configurations where some expressions currently
return nothing (e.g. something depending on frontend declared in a
backend), and which could be rejected, but there does not seem to be
any such keyword. Thus while it should be backported, better not backport
it too far (2.4 and possibly 2.3 only).

(cherry picked from commit 843096d72a4fa2b5b857dde92be9f02258ab2655)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit ba4e2b8769218d0faee865d754e0b83455d95da6)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/vars.c