From: Willy Tarreau Date: Fri, 26 Mar 2021 10:56:11 +0000 (+0100) Subject: MINOR: sample: add a new SMP_SRC_CONST sample capability X-Git-Tag: v2.4-dev14~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be2159b946a1b16f3ebff8f612947d066fb937e1;p=thirdparty%2Fhaproxy.git MINOR: sample: add a new SMP_SRC_CONST sample capability This level indicates that everything it constant in the expression during the whole process' life and that it may safely be used at config parsing time. --- diff --git a/include/haproxy/sample-t.h b/include/haproxy/sample-t.h index d11c411dde..76b365ab1a 100644 --- a/include/haproxy/sample-t.h +++ b/include/haproxy/sample-t.h @@ -45,6 +45,7 @@ enum { * use and are not meant to be known outside the sample management code. */ enum { + SMP_SRC_CONST, /* constat elements known at configuration time */ SMP_SRC_INTRN, /* internal context-less information */ SMP_SRC_LISTN, /* listener which accepted the connection */ SMP_SRC_FTEND, /* frontend which accepted the connection */ @@ -105,6 +106,7 @@ enum { * stored in smp->use. */ enum { + SMP_USE_CONST = 1 << SMP_SRC_CONST, /* constant values known at config time */ SMP_USE_INTRN = 1 << SMP_SRC_INTRN, /* internal context-less information */ SMP_USE_LISTN = 1 << SMP_SRC_LISTN, /* listener which accepted the connection */ SMP_USE_FTEND = 1 << SMP_SRC_FTEND, /* frontend which accepted the connection */ diff --git a/src/sample.c b/src/sample.c index b05259bbb7..32255cb21a 100644 --- a/src/sample.c +++ b/src/sample.c @@ -70,6 +70,14 @@ static struct sample_conv_kw_list sample_convs = { }; const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { + [SMP_SRC_CONST] = (SMP_VAL_FE_CON_ACC | SMP_VAL_FE_SES_ACC | SMP_VAL_FE_REQ_CNT | + SMP_VAL_FE_HRQ_HDR | SMP_VAL_FE_HRQ_BDY | SMP_VAL_FE_SET_BCK | + SMP_VAL_BE_REQ_CNT | SMP_VAL_BE_HRQ_HDR | SMP_VAL_BE_HRQ_BDY | + SMP_VAL_BE_SET_SRV | SMP_VAL_BE_SRV_CON | SMP_VAL_BE_RES_CNT | + SMP_VAL_BE_HRS_HDR | SMP_VAL_BE_HRS_BDY | SMP_VAL_BE_STO_RUL | + SMP_VAL_FE_RES_CNT | SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | + SMP_VAL_FE_LOG_END | SMP_VAL_BE_CHK_RUL), + [SMP_SRC_INTRN] = (SMP_VAL_FE_CON_ACC | SMP_VAL_FE_SES_ACC | SMP_VAL_FE_REQ_CNT | SMP_VAL_FE_HRQ_HDR | SMP_VAL_FE_HRQ_BDY | SMP_VAL_FE_SET_BCK | SMP_VAL_BE_REQ_CNT | SMP_VAL_BE_HRQ_HDR | SMP_VAL_BE_HRQ_BDY |