mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-18 12:06:36 +02:00
MINOR: cfgparse: implement experimental config keywords
Add a new flag to mark a keyword as experimental. An experimental keyword cannot be used if the global 'expose-experimental-directives' is not present first. Only keywords parsed through a standard cfg_keywords lists in global/proxies section will be automatically detected if declared experimental. To support a keyword outside of these lists, check_kw_experimental must be called manually during its parsing. If an experimental keyword is present in the config, the tainted flag is updated. For the moment, no keyword is marked as experimental.
This commit is contained in:
@@ -262,6 +262,23 @@ unsigned int warned = 0;
|
||||
/* set if experimental features have been used for the current process */
|
||||
static unsigned int tainted = 0;
|
||||
|
||||
unsigned int experimental_directives_allowed = 0;
|
||||
|
||||
int check_kw_experimental(struct cfg_keyword *kw, const char *file, int linenum,
|
||||
char **errmsg)
|
||||
{
|
||||
if (kw->flags & KWF_EXPERIMENTAL) {
|
||||
if (!experimental_directives_allowed) {
|
||||
memprintf(errmsg, "parsing [%s:%d] : '%s' directive is experimental, must be allowed via a global 'expose-experimental-directives'\n",
|
||||
file, linenum, kw->kw);
|
||||
return 1;
|
||||
}
|
||||
mark_tainted(TAINTED_CONFIG_EXP_KW_DECLARED);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* master CLI configuration (-S flag) */
|
||||
struct list mworker_cli_conf = LIST_HEAD_INIT(mworker_cli_conf);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user