From: Amaury Denoyelle Date: Fri, 4 Jun 2021 16:22:08 +0000 (+0200) Subject: MINOR: errors: specify prefix "config" for parsing output X-Git-Tag: v2.5-dev1~193 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=111243003e6787cf60e02dd2ebbd3890b8aca61e;p=thirdparty%2Fhaproxy.git MINOR: errors: specify prefix "config" for parsing output Set "config :" as a prefix for the user messages context before starting the configuration parsing. All following stderr output will be prefixed by it. As a consequence, remove extraneous prefix "config" already specified in various ha_alert/warning/notice calls. --- diff --git a/src/action.c b/src/action.c index ed6cee5c8c..e44ac5317e 100644 --- a/src/action.c +++ b/src/action.c @@ -94,7 +94,7 @@ int check_trk_action(struct act_rule *rule, struct proxy *px, char **err) if (rule->from == ACT_F_TCP_REQ_CNT && (px->cap & PR_CAP_FE)) { if (!px->tcp_req.inspect_delay && !(rule->arg.trk_ctr.expr->fetch->val & SMP_VAL_FE_SES_ACC)) { - ha_warning("config : %s '%s' : a 'tcp-request content track-sc*' rule explicitly depending on request" + ha_warning("%s '%s' : a 'tcp-request content track-sc*' rule explicitly depending on request" " contents without any 'tcp-request inspect-delay' setting." " This means that this rule will randomly find its contents. This can be fixed by" " setting the tcp-request inspect-delay.\n", @@ -111,7 +111,7 @@ int check_trk_action(struct act_rule *rule, struct proxy *px, char **err) if (px->mode == PR_MODE_HTTP && !(rule->arg.trk_ctr.expr->fetch->use & (SMP_USE_L6REQ|SMP_USE_HRQHV|SMP_USE_HRQHP|SMP_USE_HRQBO)) && (!rule->cond || !(rule->cond->use & (SMP_USE_L6REQ|SMP_USE_HRQHV|SMP_USE_HRQHP|SMP_USE_HRQBO)))) { - ha_warning("config : %s '%s' : a 'tcp-request content track-sc*' rule not depending on request" + ha_warning("%s '%s' : a 'tcp-request content track-sc*' rule not depending on request" " contents for an HTTP frontend should be executed at the session level, using a" " 'tcp-request session' rule (mandatory to track invalid HTTP requests).\n", proxy_type_str(px), px->id); @@ -131,7 +131,7 @@ int check_capture(struct act_rule *rule, struct proxy *px, char **err) { if (rule->from == ACT_F_TCP_REQ_CNT && (px->cap & PR_CAP_FE) && !px->tcp_req.inspect_delay && !(rule->arg.trk_ctr.expr->fetch->val & SMP_VAL_FE_SES_ACC)) { - ha_warning("config : %s '%s' : a 'tcp-request capture' rule explicitly depending on request" + ha_warning("%s '%s' : a 'tcp-request capture' rule explicitly depending on request" " contents without any 'tcp-request inspect-delay' setting." " This means that this rule will randomly find its contents. This can be fixed by" " setting the tcp-request inspect-delay.\n", diff --git a/src/cfgparse.c b/src/cfgparse.c index 286289ad75..4b03b63834 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -2660,7 +2660,7 @@ int check_config_validity() } if (global.nbproc > 1 && global.nbthread > 1) { - ha_alert("config : cannot enable multiple processes if multiple threads are configured. Please use either nbproc or nbthread but not both.\n"); + ha_alert("cannot enable multiple processes if multiple threads are configured. Please use either nbproc or nbthread but not both.\n"); err_code |= ERR_ALERT | ERR_FATAL; goto out; } @@ -2749,7 +2749,7 @@ int check_config_validity() #ifdef OPENSSL_NPN_NEGOTIATED /* check NPN */ if (bind_conf->ssl_conf.npn_str && strstr(bind_conf->ssl_conf.npn_str, "\002h2")) { - ha_alert("config : HTTP frontend '%s' enables HTTP/2 via NPN at [%s:%d], so global.tune.bufsize must be at least 16384 bytes (%d now).\n", + ha_alert("HTTP frontend '%s' enables HTTP/2 via NPN at [%s:%d], so global.tune.bufsize must be at least 16384 bytes (%d now).\n", curproxy->id, bind_conf->file, bind_conf->line, global.tune.bufsize); cfgerr++; } @@ -2757,7 +2757,7 @@ int check_config_validity() #ifdef TLSEXT_TYPE_application_layer_protocol_negotiation /* check ALPN */ if (bind_conf->ssl_conf.alpn_str && strstr(bind_conf->ssl_conf.alpn_str, "\002h2")) { - ha_alert("config : HTTP frontend '%s' enables HTTP/2 via ALPN at [%s:%d], so global.tune.bufsize must be at least 16384 bytes (%d now).\n", + ha_alert("HTTP frontend '%s' enables HTTP/2 via ALPN at [%s:%d], so global.tune.bufsize must be at least 16384 bytes (%d now).\n", curproxy->id, bind_conf->file, bind_conf->line, global.tune.bufsize); cfgerr++; } @@ -2816,14 +2816,14 @@ int check_config_validity() case PR_MODE_PEERS: case PR_MODES: /* should not happen, bug gcc warn missing switch statement */ - ha_alert("config : %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 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", proxy_type_str(curproxy), curproxy->id); cfgerr++; break; } if (curproxy != global.cli_fe && (curproxy->cap & PR_CAP_FE) && LIST_ISEMPTY(&curproxy->conf.listeners)) { - ha_warning("config : %s '%s' has no 'bind' directive. Please declare it as a backend if this was intended.\n", + ha_warning("%s '%s' has no 'bind' directive. Please declare it as a backend if this was intended.\n", proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; } @@ -2831,19 +2831,19 @@ int check_config_validity() if (curproxy->cap & PR_CAP_BE) { if (curproxy->lbprm.algo & BE_LB_KIND) { if (curproxy->options & PR_O_TRANSP) { - ha_alert("config : %s '%s' cannot use both transparent and balance mode.\n", + ha_alert("%s '%s' cannot use both transparent and balance mode.\n", proxy_type_str(curproxy), curproxy->id); cfgerr++; } #ifdef WE_DONT_SUPPORT_SERVERLESS_LISTENERS else if (curproxy->srv == NULL) { - ha_alert("config : %s '%s' needs at least 1 server in balance mode.\n", + ha_alert("%s '%s' needs at least 1 server in balance mode.\n", proxy_type_str(curproxy), curproxy->id); cfgerr++; } #endif else if (curproxy->options & PR_O_DISPATCH) { - ha_warning("config : dispatch address of %s '%s' will be ignored in balance mode.\n", + ha_warning("dispatch address of %s '%s' will be ignored in balance mode.\n", proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; } @@ -2866,7 +2866,7 @@ int check_config_validity() curproxy->options &= ~(PR_O_DISPATCH | PR_O_HTTP_PROXY); if ((curproxy->tcpcheck_rules.flags & TCPCHK_RULES_UNUSED_HTTP_RS)) { - ha_warning("config : %s '%s' uses http-check rules without 'option httpchk', so the rules are ignored.\n", + ha_warning("%s '%s' uses http-check rules without 'option httpchk', so the rules are ignored.\n", proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; } @@ -2874,13 +2874,13 @@ int check_config_validity() if ((curproxy->options2 & PR_O2_CHK_ANY) == PR_O2_TCPCHK_CHK && (curproxy->tcpcheck_rules.flags & TCPCHK_RULES_PROTO_CHK) != TCPCHK_RULES_HTTP_CHK) { if (curproxy->options & PR_O_DISABLE404) { - ha_warning("config : '%s' will be ignored for %s '%s' (requires 'option httpchk').\n", + ha_warning("'%s' will be ignored for %s '%s' (requires 'option httpchk').\n", "disable-on-404", proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; curproxy->options &= ~PR_O_DISABLE404; } if (curproxy->options2 & PR_O2_CHK_SNDST) { - ha_warning("config : '%s' will be ignored for %s '%s' (requires 'option httpchk').\n", + ha_warning("'%s' will be ignored for %s '%s' (requires 'option httpchk').\n", "send-state", proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; curproxy->options &= ~PR_O2_CHK_SNDST; @@ -2907,7 +2907,7 @@ int check_config_validity() if (curproxy->email_alert.set) { if (!(curproxy->email_alert.mailers.name && curproxy->email_alert.from && curproxy->email_alert.to)) { - ha_warning("config : 'email-alert' will be ignored for %s '%s' (the presence any of " + ha_warning("'email-alert' will be ignored for %s '%s' (the presence any of " "'email-alert from', 'email-alert level' 'email-alert mailers', " "'email-alert myhostname', or 'email-alert to' " "requires each of 'email-alert from', 'email-alert mailers' and 'email-alert to' " @@ -2923,7 +2923,7 @@ int check_config_validity() if (curproxy->check_command) { int clear = 0; if ((curproxy->options2 & PR_O2_CHK_ANY) != PR_O2_EXT_CHK) { - ha_warning("config : '%s' will be ignored for %s '%s' (requires 'option external-check').\n", + ha_warning("'%s' will be ignored for %s '%s' (requires 'option external-check').\n", "external-check command", proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; clear = 1; @@ -2940,7 +2940,7 @@ int check_config_validity() if (curproxy->check_path) { if ((curproxy->options2 & PR_O2_CHK_ANY) != PR_O2_EXT_CHK) { - ha_warning("config : '%s' will be ignored for %s '%s' (requires 'option external-check').\n", + ha_warning("'%s' will be ignored for %s '%s' (requires 'option external-check').\n", "external-check path", proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; ha_free(&curproxy->check_path); @@ -3092,7 +3092,7 @@ int check_config_validity() err_code |= warnif_tcp_http_cond(curproxy, srule->cond); if (!target) { - ha_alert("config : %s '%s' : unable to find server '%s' referenced in a 'use-server' rule.\n", + ha_alert("%s '%s' : unable to find server '%s' referenced in a 'use-server' rule.\n", proxy_type_str(curproxy), curproxy->id, srule->srv.name); cfgerr++; continue; @@ -3400,7 +3400,7 @@ out_uri_auth_compat: ((curproxy->cap & PR_CAP_BE) && (curproxy->srv) && (!curproxy->timeout.connect || (!curproxy->timeout.server && (curproxy->mode == PR_MODE_HTTP || !curproxy->timeout.tunnel)))))) { - ha_warning("config : missing timeouts for %s '%s'.\n" + ha_warning("missing timeouts for %s '%s'.\n" " | While not properly invalid, you will certainly encounter various problems\n" " | with such a configuration. To fix this, please ensure that all following\n" " | timeouts are set to a non-zero value: 'client', 'connect', 'server'.\n", @@ -3418,14 +3418,14 @@ out_uri_auth_compat: curproxy->timeout.queue = curproxy->timeout.connect; if ((curproxy->tcpcheck_rules.flags & TCPCHK_RULES_UNUSED_TCP_RS)) { - ha_warning("config : %s '%s' uses tcp-check rules without 'option tcp-check', so the rules are ignored.\n", + ha_warning("%s '%s' uses tcp-check rules without 'option tcp-check', so the rules are ignored.\n", proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; } /* ensure that cookie capture length is not too large */ if (curproxy->capture_len >= global.tune.cookie_len) { - ha_warning("config : truncating capture length to %d bytes for %s '%s'.\n", + ha_warning("truncating capture length to %d bytes for %s '%s'.\n", global.tune.cookie_len - 1, proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; curproxy->capture_len = global.tune.cookie_len - 1; @@ -3450,7 +3450,7 @@ out_uri_auth_compat: break; case PR_SRV_STATE_FILE_GLOBAL: if (!global.server_state_file) { - ha_warning("config : backend '%s' configured to load server state file from global section 'server-state-file' directive. Unfortunately, 'server-state-file' is not set!\n", + ha_warning("backend '%s' configured to load server state file from global section 'server-state-file' directive. Unfortunately, 'server-state-file' is not set!\n", curproxy->id); err_code |= ERR_WARN; } @@ -3697,7 +3697,7 @@ out_uri_auth_compat: if ((curproxy->mode == PR_MODE_TCP || curproxy->mode == PR_MODE_HTTP) && (curproxy->cap & PR_CAP_FE) && LIST_ISEMPTY(&curproxy->logsrvs) && (!LIST_ISEMPTY(&curproxy->logformat) || !LIST_ISEMPTY(&curproxy->logformat_sd))) { - ha_warning("config : log format ignored for %s '%s' since it has no log address.\n", + ha_warning("log format ignored for %s '%s' since it has no log address.\n", proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; } @@ -3706,51 +3706,51 @@ out_uri_auth_compat: int optnum; if (curproxy->uri_auth) { - ha_warning("config : 'stats' statement ignored for %s '%s' as it requires HTTP mode.\n", + ha_warning("'stats' statement ignored for %s '%s' as it requires HTTP mode.\n", proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; curproxy->uri_auth = NULL; } if (curproxy->capture_name) { - ha_warning("config : 'capture' statement ignored for %s '%s' as it requires HTTP mode.\n", + ha_warning("'capture' statement ignored for %s '%s' as it requires HTTP mode.\n", proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; } if (!LIST_ISEMPTY(&curproxy->http_req_rules)) { - ha_warning("config : 'http-request' rules ignored for %s '%s' as they require HTTP mode.\n", + ha_warning("'http-request' rules ignored for %s '%s' as they require HTTP mode.\n", proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; } if (!LIST_ISEMPTY(&curproxy->http_res_rules)) { - ha_warning("config : 'http-response' rules ignored for %s '%s' as they require HTTP mode.\n", + ha_warning("'http-response' rules ignored for %s '%s' as they require HTTP mode.\n", proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; } if (!LIST_ISEMPTY(&curproxy->http_after_res_rules)) { - ha_warning("config : 'http-after-response' rules ignored for %s '%s' as they require HTTP mode.\n", + ha_warning("'http-after-response' rules ignored for %s '%s' as they require HTTP mode.\n", proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; } if (!LIST_ISEMPTY(&curproxy->redirect_rules)) { - ha_warning("config : 'redirect' rules ignored for %s '%s' as they require HTTP mode.\n", + ha_warning("'redirect' rules ignored for %s '%s' as they require HTTP mode.\n", proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; } if (curproxy->options & (PR_O_FWDFOR | PR_O_FF_ALWAYS)) { - ha_warning("config : 'option %s' ignored for %s '%s' as it requires HTTP mode.\n", + ha_warning("'option %s' ignored for %s '%s' as it requires HTTP mode.\n", "forwardfor", proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; curproxy->options &= ~(PR_O_FWDFOR | PR_O_FF_ALWAYS); } if (curproxy->options & PR_O_ORGTO) { - ha_warning("config : 'option %s' ignored for %s '%s' as it requires HTTP mode.\n", + ha_warning("'option %s' ignored for %s '%s' as it requires HTTP mode.\n", "originalto", proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; curproxy->options &= ~PR_O_ORGTO; @@ -3760,7 +3760,7 @@ out_uri_auth_compat: if (cfg_opts[optnum].mode == PR_MODE_HTTP && (curproxy->cap & cfg_opts[optnum].cap) && (curproxy->options & cfg_opts[optnum].val)) { - ha_warning("config : 'option %s' ignored for %s '%s' as it requires HTTP mode.\n", + ha_warning("'option %s' ignored for %s '%s' as it requires HTTP mode.\n", cfg_opts[optnum].name, proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; curproxy->options &= ~cfg_opts[optnum].val; @@ -3771,7 +3771,7 @@ out_uri_auth_compat: if (cfg_opts2[optnum].mode == PR_MODE_HTTP && (curproxy->cap & cfg_opts2[optnum].cap) && (curproxy->options2 & cfg_opts2[optnum].val)) { - ha_warning("config : 'option %s' ignored for %s '%s' as it requires HTTP mode.\n", + ha_warning("'option %s' ignored for %s '%s' as it requires HTTP mode.\n", cfg_opts2[optnum].name, proxy_type_str(curproxy), curproxy->id); err_code |= ERR_WARN; curproxy->options2 &= ~cfg_opts2[optnum].val; @@ -3781,7 +3781,7 @@ out_uri_auth_compat: #if defined(CONFIG_HAP_TRANSPARENT) if (curproxy->conn_src.bind_hdr_occ) { curproxy->conn_src.bind_hdr_occ = 0; - ha_warning("config : %s '%s' : ignoring use of header %s as source IP in non-HTTP mode.\n", + ha_warning("%s '%s' : ignoring use of header %s as source IP in non-HTTP mode.\n", proxy_type_str(curproxy), curproxy->id, curproxy->conn_src.bind_hdr_name); err_code |= ERR_WARN; } @@ -3794,19 +3794,19 @@ out_uri_auth_compat: newsrv = curproxy->srv; while (newsrv != NULL) { if ((curproxy->mode != PR_MODE_HTTP) && newsrv->rdr_len) { - ha_alert("config : %s '%s' : server cannot have cookie or redirect prefix in non-HTTP mode.\n", + ha_alert("%s '%s' : server cannot have cookie or redirect prefix in non-HTTP mode.\n", proxy_type_str(curproxy), curproxy->id); cfgerr++; } if ((curproxy->mode != PR_MODE_HTTP) && newsrv->cklen) { - ha_warning("config : %s '%s' : ignoring cookie for server '%s' as HTTP mode is disabled.\n", + ha_warning("%s '%s' : ignoring cookie for server '%s' as HTTP mode is disabled.\n", proxy_type_str(curproxy), curproxy->id, newsrv->id); err_code |= ERR_WARN; } if ((newsrv->flags & SRV_F_MAPPORTS) && (curproxy->options2 & PR_O2_RDPC_PRST)) { - ha_warning("config : %s '%s' : RDP cookie persistence will not work for server '%s' because it lacks an explicit port number.\n", + ha_warning("%s '%s' : RDP cookie persistence will not work for server '%s' because it lacks an explicit port number.\n", proxy_type_str(curproxy), curproxy->id, newsrv->id); err_code |= ERR_WARN; } @@ -3814,7 +3814,7 @@ out_uri_auth_compat: #if defined(CONFIG_HAP_TRANSPARENT) if (curproxy->mode != PR_MODE_HTTP && newsrv->conn_src.bind_hdr_occ) { newsrv->conn_src.bind_hdr_occ = 0; - ha_warning("config : %s '%s' : server %s cannot use header %s as source IP in non-HTTP mode.\n", + ha_warning("%s '%s' : server %s cannot use header %s as source IP in non-HTTP mode.\n", proxy_type_str(curproxy), curproxy->id, newsrv->id, newsrv->conn_src.bind_hdr_name); err_code |= ERR_WARN; } @@ -3899,7 +3899,7 @@ out_uri_auth_compat: mux_ent = conn_get_best_mux_entry(bind_conf->mux_proto->token, PROTO_SIDE_FE, mode); if (!mux_ent || !isteq(mux_ent->token, bind_conf->mux_proto->token)) { - ha_alert("config : %s '%s' : MUX protocol '%.*s' is not usable for 'bind %s' at [%s:%d].\n", + ha_alert("%s '%s' : MUX protocol '%.*s' is not usable for 'bind %s' at [%s:%d].\n", proxy_type_str(curproxy), curproxy->id, (int)bind_conf->mux_proto->token.len, bind_conf->mux_proto->token.ptr, @@ -3924,7 +3924,7 @@ out_uri_auth_compat: mux_ent = conn_get_best_mux_entry(newsrv->mux_proto->token, PROTO_SIDE_BE, mode); if (!mux_ent || !isteq(mux_ent->token, newsrv->mux_proto->token)) { - ha_alert("config : %s '%s' : MUX protocol '%.*s' is not usable for server '%s' at [%s:%d].\n", + ha_alert("%s '%s' : MUX protocol '%.*s' is not usable for server '%s' at [%s:%d].\n", proxy_type_str(curproxy), curproxy->id, (int)newsrv->mux_proto->token.len, newsrv->mux_proto->token.ptr, @@ -4391,7 +4391,7 @@ out_uri_auth_compat: list_for_each_entry(curr_resolvers, &sec_resolvers, list) { if (LIST_ISEMPTY(&curr_resolvers->nameservers)) { - ha_warning("config : resolvers '%s' [%s:%d] has no nameservers configured!\n", + ha_warning("resolvers '%s' [%s:%d] has no nameservers configured!\n", curr_resolvers->id, curr_resolvers->conf.file, curr_resolvers->conf.line); err_code |= ERR_WARN; diff --git a/src/check.c b/src/check.c index 3403962607..cb8545bf73 100644 --- a/src/check.c +++ b/src/check.c @@ -1696,7 +1696,7 @@ static int init_srv_agent_check(struct server *srv) if (!chk || chk->action != TCPCHK_ACT_CONNECT) { chk = calloc(1, sizeof(*chk)); if (!chk) { - ha_alert("config : %s '%s': unable to add implicit tcp-check connect rule" + ha_alert("%s '%s': unable to add implicit tcp-check connect rule" " to agent-check for server '%s' (out of memory).\n", proxy_type_str(srv->proxy), srv->proxy->id, srv->id); ret |= ERR_ALERT | ERR_FATAL; diff --git a/src/fcgi-app.c b/src/fcgi-app.c index f33650fc0e..8bbfd1043c 100644 --- a/src/fcgi-app.c +++ b/src/fcgi-app.c @@ -227,7 +227,7 @@ static int fcgi_flt_check(struct proxy *px, struct flt_conf *fconf) fcgi_conf->app = fcgi_app_find_by_name(fcgi_conf->name); if (!fcgi_conf->app) { - ha_alert("config : proxy '%s' : fcgi-app '%s' not found.\n", + ha_alert("proxy '%s' : fcgi-app '%s' not found.\n", px->id, fcgi_conf->name); goto err; } @@ -236,7 +236,7 @@ static int fcgi_flt_check(struct proxy *px, struct flt_conf *fconf) if (f->id == http_comp_flt_id || f->id == cache_store_flt_id) continue; else if ((f->id == fconf->id) && f->conf != fcgi_conf) { - ha_alert("config : proxy '%s' : only one fcgi-app supported per backend.\n", + ha_alert("proxy '%s' : only one fcgi-app supported per backend.\n", px->id); goto err; } @@ -253,7 +253,7 @@ static int fcgi_flt_check(struct proxy *px, struct flt_conf *fconf) list_for_each_entry_safe(crule, back, &fcgi_conf->app->conf.rules, list) { rule = calloc(1, sizeof(*rule)); if (!rule) { - ha_alert("config : proxy '%s' : out of memory.\n", px->id); + ha_alert("proxy '%s' : out of memory.\n", px->id); goto err; } rule->type = crule->type; @@ -264,7 +264,7 @@ static int fcgi_flt_check(struct proxy *px, struct flt_conf *fconf) if (crule->value) { if (!parse_logformat_string(crule->value, px, &rule->value, LOG_OPT_HTTP, SMP_VAL_BE_HRQ_HDR, &errmsg)) { - ha_alert("config : proxy '%s' : %s.\n", px->id, errmsg); + ha_alert("proxy '%s' : %s.\n", px->id, errmsg); goto err; } } @@ -655,7 +655,7 @@ static int cfg_fcgi_apps_postparser() int nb_fcgi_srv = 0; if (px->mode == PR_MODE_TCP && fcgi_conf) { - ha_alert("config : proxy '%s': FCGI application cannot be used in non-HTTP mode.\n", + ha_alert("proxy '%s': FCGI application cannot be used in non-HTTP mode.\n", px->id); err_code |= ERR_ALERT | ERR_FATAL; goto end; @@ -666,14 +666,14 @@ static int cfg_fcgi_apps_postparser() nb_fcgi_srv++; if (fcgi_conf) continue; - ha_alert("config : proxy '%s': FCGI server '%s' has no FCGI app configured.\n", + ha_alert("proxy '%s': FCGI server '%s' has no FCGI app configured.\n", px->id, srv->id); err_code |= ERR_ALERT | ERR_FATAL; goto end; } } if (fcgi_conf && !nb_fcgi_srv) { - ha_alert("config : proxy '%s': FCGI app configured but no FCGI server found.\n", + ha_alert("proxy '%s': FCGI app configured but no FCGI server found.\n", px->id); err_code |= ERR_ALERT | ERR_FATAL; goto end; @@ -682,14 +682,14 @@ static int cfg_fcgi_apps_postparser() for (curapp = fcgi_apps; curapp != NULL; curapp = curapp->next) { if (!istlen(curapp->docroot)) { - ha_alert("config : fcgi-app '%s': no docroot configured.\n", + ha_alert("fcgi-app '%s': no docroot configured.\n", curapp->name); err_code |= ERR_ALERT | ERR_FATAL; goto end; } if (!(curapp->flags & (FCGI_APP_FL_MPXS_CONNS|FCGI_APP_FL_GET_VALUES))) { if (curapp->maxreqs > 1) { - ha_warning("config : fcgi-app '%s': multiplexing not supported, " + ha_warning("fcgi-app '%s': multiplexing not supported, " "ignore the option 'max-reqs'.\n", curapp->name); err_code |= ERR_WARN; @@ -702,7 +702,7 @@ static int cfg_fcgi_apps_postparser() struct sink *sink = sink_find(logsrv->ring_name); if (!sink || sink->type != SINK_TYPE_BUFFER) { - ha_alert("config : fcgi-app '%s' : log server uses unknown ring named '%s'.\n", + ha_alert("fcgi-app '%s' : log server uses unknown ring named '%s'.\n", curapp->name, logsrv->ring_name); err_code |= ERR_ALERT | ERR_FATAL; } diff --git a/src/haproxy.c b/src/haproxy.c index f4c24ee7e7..3ac6ed9cf0 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -1785,6 +1785,8 @@ static void init(int argc, char **argv) } #endif + usermsgs_clr("config"); + /* in wait mode, we don't try to read the configuration files */ if (!(global.mode & MODE_MWORKER_WAIT)) { char *env_cfgfiles = NULL; @@ -2264,6 +2266,8 @@ static void init(int argc, char **argv) if (global.tune.maxrewrite >= global.tune.bufsize / 2) global.tune.maxrewrite = global.tune.bufsize / 2; + usermsgs_clr(NULL); + if (arg_mode & (MODE_DEBUG | MODE_FOREGROUND)) { /* command line debug mode inhibits configuration mode */ global.mode &= ~(MODE_DAEMON | MODE_QUIET); diff --git a/src/http_htx.c b/src/http_htx.c index 67e4298880..f8a72f5046 100644 --- a/src/http_htx.c +++ b/src/http_htx.c @@ -2016,7 +2016,7 @@ static int proxy_check_errors(struct proxy *px) /* unknown http-errors section */ if (&http_errs->list == &http_errors_list) { - ha_alert("config : proxy '%s': unknown http-errors section '%s' (at %s:%d).\n", + ha_alert("proxy '%s': unknown http-errors section '%s' (at %s:%d).\n", px->id, conf_err->info.errorfiles.name, conf_err->file, conf_err->line); err |= ERR_ALERT | ERR_FATAL; free(conf_err->info.errorfiles.name); diff --git a/src/mux_h1.c b/src/mux_h1.c index dd654602c1..c06cec9797 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -3696,7 +3696,7 @@ static int cfg_h1_headers_case_adjust_postparser() file = fopen(hdrs_map.name, "r"); if (!file) { - ha_alert("config : h1-outgoing-headers-case-adjust-file '%s': failed to open file.\n", + ha_alert("h1-outgoing-headers-case-adjust-file '%s': failed to open file.\n", hdrs_map.name); err_code |= ERR_ALERT | ERR_FATAL; goto end; @@ -3745,14 +3745,14 @@ static int cfg_h1_headers_case_adjust_postparser() err = NULL; rc = add_hdr_case_adjust(key_beg, value_beg, &err); if (rc < 0) { - ha_alert("config : h1-outgoing-headers-case-adjust-file '%s' : %s at line %d.\n", + ha_alert("h1-outgoing-headers-case-adjust-file '%s' : %s at line %d.\n", hdrs_map.name, err, line); err_code |= ERR_ALERT | ERR_FATAL; free(err); goto end; } if (rc > 0) { - ha_warning("config : h1-outgoing-headers-case-adjust-file '%s' : %s at line %d.\n", + ha_warning("h1-outgoing-headers-case-adjust-file '%s' : %s at line %d.\n", hdrs_map.name, err, line); err_code |= ERR_WARN; free(err); diff --git a/src/proxy.c b/src/proxy.c index 0e96571c02..014436be87 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -1254,17 +1254,17 @@ struct server *findserver(const struct proxy *px, const char *name) { int proxy_cfg_ensure_no_http(struct proxy *curproxy) { if (curproxy->cookie_name != NULL) { - ha_warning("config : cookie will be ignored for %s '%s' (needs 'mode http').\n", + ha_warning("cookie will be ignored for %s '%s' (needs 'mode http').\n", proxy_type_str(curproxy), curproxy->id); } if (curproxy->monitor_uri != NULL) { - ha_warning("config : monitor-uri will be ignored for %s '%s' (needs 'mode http').\n", + ha_warning("monitor-uri will be ignored for %s '%s' (needs 'mode http').\n", proxy_type_str(curproxy), curproxy->id); } if (curproxy->lbprm.algo & BE_LB_NEED_HTTP) { curproxy->lbprm.algo &= ~BE_LB_ALGO; curproxy->lbprm.algo |= BE_LB_ALGO_RR; - ha_warning("config : Layer 7 hash not possible for %s '%s' (needs 'mode http'). Falling back to round robin.\n", + ha_warning("Layer 7 hash not possible for %s '%s' (needs 'mode http'). Falling back to round robin.\n", proxy_type_str(curproxy), curproxy->id); } if (curproxy->to_log & (LW_REQ | LW_RESP)) { diff --git a/src/resolvers.c b/src/resolvers.c index 1a05ed3134..9e08b64a07 100644 --- a/src/resolvers.c +++ b/src/resolvers.c @@ -191,13 +191,13 @@ struct resolv_srvrq *new_resolv_srvrq(struct server *srv, char *fqdn) hostname_dn_len = resolv_str_to_dn_label(fqdn, fqdn_len + 1, trash.area, trash.size); if (hostname_dn_len == -1) { - ha_alert("config : %s '%s', server '%s': failed to parse FQDN '%s'\n", + ha_alert("%s '%s', server '%s': failed to parse FQDN '%s'\n", proxy_type_str(px), px->id, srv->id, fqdn); goto err; } if ((srvrq = calloc(1, sizeof(*srvrq))) == NULL) { - ha_alert("config : %s '%s', server '%s': out of memory\n", + ha_alert("%s '%s', server '%s': out of memory\n", proxy_type_str(px), px->id, srv->id); goto err; } @@ -207,7 +207,7 @@ struct resolv_srvrq *new_resolv_srvrq(struct server *srv, char *fqdn) srvrq->hostname_dn = strdup(trash.area); srvrq->hostname_dn_len = hostname_dn_len; if (!srvrq->name || !srvrq->hostname_dn) { - ha_alert("config : %s '%s', server '%s': out of memory\n", + ha_alert("%s '%s', server '%s': out of memory\n", proxy_type_str(px), px->id, srv->id); goto err; } @@ -2244,13 +2244,13 @@ static int resolvers_finalize_config(void) if (ns->dgram) { /* Check nameserver info */ if ((fd = socket(ns->dgram->conn.addr.to.ss_family, SOCK_DGRAM, IPPROTO_UDP)) == -1) { - ha_alert("config : resolvers '%s': can't create socket for nameserver '%s'.\n", + ha_alert("resolvers '%s': can't create socket for nameserver '%s'.\n", resolvers->id, ns->id); err_code |= (ERR_ALERT|ERR_ABORT); continue; } if (connect(fd, (struct sockaddr*)&ns->dgram->conn.addr.to, get_addr_len(&ns->dgram->conn.addr.to)) == -1) { - ha_alert("config : resolvers '%s': can't connect socket for nameserver '%s'.\n", + ha_alert("resolvers '%s': can't connect socket for nameserver '%s'.\n", resolvers->id, ns->id); close(fd); err_code |= (ERR_ALERT|ERR_ABORT); @@ -2262,7 +2262,7 @@ static int resolvers_finalize_config(void) /* Create the task associated to the resolvers section */ if ((t = task_new(MAX_THREADS_MASK)) == NULL) { - ha_alert("config : resolvers '%s' : out of memory.\n", resolvers->id); + ha_alert("resolvers '%s' : out of memory.\n", resolvers->id); err_code |= (ERR_ALERT|ERR_ABORT); goto err; } @@ -2284,7 +2284,7 @@ static int resolvers_finalize_config(void) continue; if ((resolvers = find_resolvers_by_id(srv->resolvers_id)) == NULL) { - ha_alert("config : %s '%s', server '%s': unable to find required resolvers '%s'\n", + ha_alert("%s '%s', server '%s': unable to find required resolvers '%s'\n", proxy_type_str(px), px->id, srv->id, srv->resolvers_id); err_code |= (ERR_ALERT|ERR_ABORT); continue; @@ -2294,14 +2294,14 @@ static int resolvers_finalize_config(void) if (srv->srvrq && !srv->srvrq->resolvers) { srv->srvrq->resolvers = srv->resolvers; if (resolv_link_resolution(srv->srvrq, OBJ_TYPE_SRVRQ, 0) == -1) { - ha_alert("config : %s '%s' : unable to set DNS resolution for server '%s'.\n", + ha_alert("%s '%s' : unable to set DNS resolution for server '%s'.\n", proxy_type_str(px), px->id, srv->id); err_code |= (ERR_ALERT|ERR_ABORT); continue; } } if (!srv->srvrq && resolv_link_resolution(srv, OBJ_TYPE_SERVER, 0) == -1) { - ha_alert("config : %s '%s', unable to set DNS resolution for server '%s'.\n", + ha_alert("%s '%s', unable to set DNS resolution for server '%s'.\n", proxy_type_str(px), px->id, srv->id); err_code |= (ERR_ALERT|ERR_ABORT); continue; diff --git a/src/ssl_sock.c b/src/ssl_sock.c index 27a4c3531e..993772f1a0 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -4707,7 +4707,7 @@ static int ssl_sock_prepare_srv_ssl_ctx(const struct server *srv, SSL_CTX *ctx) if (methodVersions[i].option && !(flags & methodVersions[i].flag)) { if (min) { if (hole) { - ha_warning("config : %s '%s': SSL/TLS versions range not contiguous for server '%s'. " + ha_warning("%s '%s': SSL/TLS versions range not contiguous for server '%s'. " "Hole find for %s. Use only 'ssl-min-ver' and 'ssl-max-ver' to fix.\n", proxy_type_str(curproxy), curproxy->id, srv->id, methodVersions[hole].name); @@ -4724,7 +4724,7 @@ static int ssl_sock_prepare_srv_ssl_ctx(const struct server *srv, SSL_CTX *ctx) hole = i; } if (!min) { - ha_alert("config : %s '%s': all SSL/TLS versions are disabled for server '%s'.\n", + ha_alert("%s '%s': all SSL/TLS versions are disabled for server '%s'.\n", proxy_type_str(curproxy), curproxy->id, srv->id); cfgerr += 1; } diff --git a/src/tcpcheck.c b/src/tcpcheck.c index d1f9a155da..dd0a650e1a 100644 --- a/src/tcpcheck.c +++ b/src/tcpcheck.c @@ -3615,7 +3615,7 @@ static int check_proxy_tcpcheck(struct proxy *px) ha_free(&px->check_path); if (!px->tcpcheck_rules.list) { - ha_alert("config : proxy '%s' : tcp-check configured but no ruleset defined.\n", px->id); + ha_alert("proxy '%s' : tcp-check configured but no ruleset defined.\n", px->id); ret |= ERR_ALERT | ERR_FATAL; goto out; } @@ -3648,7 +3648,7 @@ static int check_proxy_tcpcheck(struct proxy *px) 1, px, px->tcpcheck_rules.list, TCPCHK_RULES_HTTP_CHK, px->conf.file, px->conf.line, &errmsg); if (!next) { - ha_alert("config : proxy '%s': unable to add implicit http-check expect rule " + ha_alert("proxy '%s': unable to add implicit http-check expect rule " "(%s).\n", px->id, errmsg); free(errmsg); ret |= ERR_ALERT | ERR_FATAL; @@ -3668,7 +3668,7 @@ static int check_proxy_tcpcheck(struct proxy *px) if (!chk || chk->action != TCPCHK_ACT_CONNECT) { chk = calloc(1, sizeof(*chk)); if (!chk) { - ha_alert("config : proxy '%s': unable to add implicit tcp-check connect rule " + ha_alert("proxy '%s': unable to add implicit tcp-check connect rule " "(out of memory).\n", px->id); ret |= ERR_ALERT | ERR_FATAL; goto out;