]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: sample: introduce c_pseudo() conv function
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 6 Jun 2023 17:03:45 +0000 (19:03 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 3 Jul 2023 14:32:01 +0000 (16:32 +0200)
commit30cd137d3f19076640523164a6c11058795eb47d
tree2665937a3f157cfdcb19e71035c09404e21f8af8
parent58bbe41cb808705c4fca44f2cc7c03a32a2691d9
MINOR: sample: introduce c_pseudo() conv function

This function is used for ANY=>!ANY conversions in the compatibility
matrix to help differentiate between real NOOP (c_none) and pseudo
conversions that are theorically supported at config parse time but can
never occur at runtime,. That is, to explicit the fact that actual related
runtime operations (e.g.: ANY->IPV4) are not NOOP since they might require
some conversion to be performed depending on the input type.

When checking the conf we don't know the effective out types so
cast[pseudo type][pseudo type] is allowed in the compatibility matrix,
but at runtime we only expect cast[real type][(real type || pseudo type)]
because fetches and converters may not emit pseudo types, thus using
c_none() everywhere was too ambiguous.

The process will crash if c_pseudo() is invoked to help catch bugs:
crashing here means that a pseudo type has been encountered on a
converter's input at runtime (because it was emitted earlier in the
chain), which is not supported and results from a broken sample fetch
or converter implementation. (pseudo types may only be used as out_type
in sample definitions for compatibility checks at parsing time)
include/haproxy/sample-t.h
include/haproxy/sample.h
src/sample.c