BUG/MAJOR: log-forward: Fix log-forward proxies not fully initialized

Some initialisation for log forward proxies was missing such
as ssl configuration on 'log-forward's 'bind' lines.

After the loop on the proxy initialization code for proxies present
in the main proxies list, this patch force to loop again on this code
for proxies present in the log forward proxies list.

Those two lists should be merged. This will be part of a global
re-work of proxy initialization including peers proxies and resolver
proxies.

This patch was made in first attempt to fix the bug and to facilitate
the backport on older branches waiting for a cleaner re-work on proxies
initialization on the dev branch.

This patch should be backported as far as 2.3.
This commit is contained in:
Emeric Brun 2022-08-18 15:53:21 +02:00 committed by Willy Tarreau
parent a846a17fde
commit 3b68b60261

View File

@ -2453,6 +2453,7 @@ int check_config_validity()
{
int cfgerr = 0;
struct proxy *curproxy = NULL;
struct proxy *init_proxies_list = NULL;
struct stktable *t;
struct server *newsrv = NULL;
int err_code = 0;
@ -2532,7 +2533,11 @@ int check_config_validity()
proxies_list = next;
}
for (curproxy = proxies_list; curproxy; curproxy = curproxy->next) {
/* starting to initialize the main proxies list */
init_proxies_list = proxies_list;
init_proxies_list_stage1:
for (curproxy = init_proxies_list; curproxy; curproxy = curproxy->next) {
struct switching_rule *rule;
struct server_rule *srule;
struct sticking_rule *mrule;
@ -2728,11 +2733,16 @@ int check_config_validity()
case PR_MODE_CLI:
cfgerr += proxy_cfg_ensure_no_http(curproxy);
break;
case PR_MODE_SYSLOG:
/* this mode is initialized as the classic tcp proxy */
cfgerr += proxy_cfg_ensure_no_http(curproxy);
break;
case PR_MODE_PEERS:
case PR_MODES:
/* should not happen, bug gcc warn missing switch statement */
ha_alert("%s '%s' cannot use peers or syslog mode for this proxy. NOTE: PLEASE REPORT THIS TO DEVELOPERS AS YOU'RE NOT SUPPOSED TO BE ABLE TO CREATE A CONFIGURATION TRIGGERING THIS!\n",
ha_alert("%s '%s' cannot initialize this proxy mode (peers) in this way. NOTE: PLEASE REPORT THIS TO DEVELOPERS AS YOU'RE NOT SUPPOSED TO BE ABLE TO CREATE A CONFIGURATION TRIGGERING THIS!\n",
proxy_type_str(curproxy), curproxy->id);
cfgerr++;
break;
@ -3890,6 +3900,15 @@ out_uri_auth_compat:
}
}
/*
* We have just initialized the main proxies list
* we must also configure the log-forward proxies list
*/
if (init_proxies_list == proxies_list) {
init_proxies_list = cfg_log_forward;
goto init_proxies_list_stage1;
}
/***********************************************************/
/* At this point, target names have already been resolved. */
/***********************************************************/
@ -3943,7 +3962,11 @@ out_uri_auth_compat:
/* perform the final checks before creating tasks */
for (curproxy = proxies_list; curproxy; curproxy = curproxy->next) {
/* starting to initialize the main proxies list */
init_proxies_list = proxies_list;
init_proxies_list_stage2:
for (curproxy = init_proxies_list; curproxy; curproxy = curproxy->next) {
struct listener *listener;
unsigned int next_id;
@ -4029,6 +4052,15 @@ out_uri_auth_compat:
}
}
/*
* We have just initialized the main proxies list
* we must also configure the log-forward proxies list
*/
if (init_proxies_list == proxies_list) {
init_proxies_list = cfg_log_forward;
goto init_proxies_list_stage2;
}
if (diag_no_cluster_secret)
ha_diag_warning("No cluster secret was set. The stateless reset and Retry"
" features are disabled for all QUIC bindings.\n");