MINOR: log/backend: prevent stick table and stick rules with LOG mode

Report a warning and prevent errors if user tries to declare a stick table
or use stick rules within a log backend.
This commit is contained in:
Aurelien DARRAGON 2023-11-16 11:29:58 +01:00 committed by Willy Tarreau
parent 5335618967
commit 4b2616f784
3 changed files with 19 additions and 1 deletions

View File

@ -86,6 +86,7 @@ void proxy_adjust_all_maxconn(void);
struct proxy *cli_find_frontend(struct appctx *appctx, const char *arg); struct proxy *cli_find_frontend(struct appctx *appctx, const char *arg);
struct proxy *cli_find_frontend(struct appctx *appctx, const char *arg); struct proxy *cli_find_frontend(struct appctx *appctx, const char *arg);
int resolve_stick_rule(struct proxy *curproxy, struct sticking_rule *mrule); int resolve_stick_rule(struct proxy *curproxy, struct sticking_rule *mrule);
void free_stick_rules(struct list *rules);
/* /*
* This function returns a string containing the type of the proxy in a format * This function returns a string containing the type of the proxy in a format

View File

@ -898,6 +898,23 @@ static int _postcheck_log_backend_compat(struct proxy *be)
err_code |= ERR_WARN; err_code |= ERR_WARN;
free_act_rules(&be->tcp_rep.inspect_rules); free_act_rules(&be->tcp_rep.inspect_rules);
} }
if (be->table) {
ha_warning("Cannot use stick table with 'mode log' in %s '%s'. It will be ignored.\n",
proxy_type_str(be), be->id);
err_code |= ERR_WARN;
stktable_deinit(be->table);
ha_free(&be->table);
}
if (!LIST_ISEMPTY(&be->storersp_rules) ||
!LIST_ISEMPTY(&be->sticking_rules)) {
ha_warning("Cannot use sticking rules with 'mode log' in %s '%s'. They will be ignored.\n",
proxy_type_str(be), be->id);
err_code |= ERR_WARN;
free_stick_rules(&be->storersp_rules);
free_stick_rules(&be->sticking_rules);
}
return err_code; return err_code;
} }

View File

@ -165,7 +165,7 @@ int resolve_stick_rule(struct proxy *curproxy, struct sticking_rule *mrule)
return 1; return 1;
} }
static void free_stick_rules(struct list *rules) void free_stick_rules(struct list *rules)
{ {
struct sticking_rule *rule, *ruleb; struct sticking_rule *rule, *ruleb;