CLEANUP: log: Rename Alert/Warning in ha_alert/ha_warning

This commit is contained in:
Christopher Faulet 2017-11-24 16:50:31 +01:00 committed by Willy Tarreau
parent 56803b1c98
commit 767a84bcc0
32 changed files with 1826 additions and 1826 deletions

View File

@ -106,8 +106,8 @@ static inline int warnifnotcap(struct proxy *proxy, int cap, const char *file, i
} }
if (!(proxy->cap & cap)) { if (!(proxy->cap & cap)) {
Warning("parsing [%s:%d] : '%s' ignored because %s '%s' has %s capability.%s\n", ha_warning("parsing [%s:%d] : '%s' ignored because %s '%s' has %s capability.%s\n",
file, line, arg, proxy_type_str(proxy), proxy->id, msg, hint ? hint : ""); file, line, arg, proxy_type_str(proxy), proxy->id, msg, hint ? hint : "");
return 1; return 1;
} }
return 0; return 0;

View File

@ -86,13 +86,13 @@ int parse_logformat_string(const char *str, struct proxy *curproxy, struct list
* Displays the message on stderr with the date and pid. Overrides the quiet * Displays the message on stderr with the date and pid. Overrides the quiet
* mode during startup. * mode during startup.
*/ */
void Alert(const char *fmt, ...) void ha_alert(const char *fmt, ...)
__attribute__ ((format(printf, 1, 2))); __attribute__ ((format(printf, 1, 2)));
/* /*
* Displays the message on stderr with the date and pid. * Displays the message on stderr with the date and pid.
*/ */
void Warning(const char *fmt, ...) void ha_warning(const char *fmt, ...)
__attribute__ ((format(printf, 1, 2))); __attribute__ ((format(printf, 1, 2)));
/* /*

View File

@ -548,7 +548,7 @@ static int init_51degrees(void)
return 0; return 0;
if (global.nbthread > 1) { if (global.nbthread > 1) {
Alert("51Degrees: multithreading is not supported for now.\n"); ha_alert("51Degrees: multithreading is not supported for now.\n");
return (ERR_FATAL | ERR_ALERT); return (ERR_FATAL | ERR_ALERT);
} }
@ -616,9 +616,9 @@ static int init_51degrees(void)
} }
if (_51d_dataset_status != DATA_SET_INIT_STATUS_SUCCESS) { if (_51d_dataset_status != DATA_SET_INIT_STATUS_SUCCESS) {
if (temp->len) if (temp->len)
Alert("51Degrees Setup - Error reading 51Degrees data file. %s\n", temp->str); ha_alert("51Degrees Setup - Error reading 51Degrees data file. %s\n", temp->str);
else else
Alert("51Degrees Setup - Error reading 51Degrees data file.\n"); ha_alert("51Degrees Setup - Error reading 51Degrees data file.\n");
return ERR_ALERT | ERR_FATAL; return ERR_ALERT | ERR_FATAL;
} }
free(_51d_property_list); free(_51d_property_list);

View File

@ -422,13 +422,13 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
/* Additional check to protect against common mistakes */ /* Additional check to protect against common mistakes */
if (expr->pat.parse && cur_type != SMP_T_BOOL && !*args[1]) { if (expr->pat.parse && cur_type != SMP_T_BOOL && !*args[1]) {
Warning("parsing acl keyword '%s' :\n" ha_warning("parsing acl keyword '%s' :\n"
" no pattern to match against were provided, so this ACL will never match.\n" " no pattern to match against were provided, so this ACL will never match.\n"
" If this is what you intended, please add '--' to get rid of this warning.\n" " If this is what you intended, please add '--' to get rid of this warning.\n"
" If you intended to match only for existence, please use '-m found'.\n" " If you intended to match only for existence, please use '-m found'.\n"
" If you wanted to force an int to match as a bool, please use '-m bool'.\n" " If you wanted to force an int to match as a bool, please use '-m bool'.\n"
"\n", "\n",
args[0]); args[0]);
} }
args++; args++;
@ -733,12 +733,12 @@ struct acl *parse_acl(const char **args, struct list *known_acl, char **err, str
* emit a warning, so let's do so. * emit a warning, so let's do so.
*/ */
if (!strchr(args[1], '(') && *args[2] == '(') if (!strchr(args[1], '(') && *args[2] == '(')
Warning("parsing acl '%s' :\n" ha_warning("parsing acl '%s' :\n"
" matching '%s' for pattern '%s' is likely a mistake and probably\n" " matching '%s' for pattern '%s' is likely a mistake and probably\n"
" not what you want. Maybe you need to remove the extraneous space before '('.\n" " not what you want. Maybe you need to remove the extraneous space before '('.\n"
" If you are really sure this is not an error, please insert '--' between the\n" " If you are really sure this is not an error, please insert '--' between the\n"
" match and the pattern to make this warning message disappear.\n", " match and the pattern to make this warning message disappear.\n",
args[0], args[1], args[2]); args[0], args[1], args[2]);
if (*args[0]) if (*args[0])
cur_acl = find_acl_by_name(args[0], known_acl); cur_acl = find_acl_by_name(args[0], known_acl);
@ -1271,15 +1271,15 @@ int acl_find_targets(struct proxy *p)
* by smp_resolve_args(). * by smp_resolve_args().
*/ */
if (expr->smp->arg_p->unresolved) { if (expr->smp->arg_p->unresolved) {
Alert("Internal bug in proxy %s: %sacl %s %s() makes use of unresolved userlist '%s'. Please report this.\n", ha_alert("Internal bug in proxy %s: %sacl %s %s() makes use of unresolved userlist '%s'. Please report this.\n",
p->id, *acl->name ? "" : "anonymous ", acl->name, expr->kw, expr->smp->arg_p->data.str.str); p->id, *acl->name ? "" : "anonymous ", acl->name, expr->kw, expr->smp->arg_p->data.str.str);
cfgerr++; cfgerr++;
continue; continue;
} }
if (LIST_ISEMPTY(&expr->pat.head)) { if (LIST_ISEMPTY(&expr->pat.head)) {
Alert("proxy %s: acl %s %s(): no groups specified.\n", ha_alert("proxy %s: acl %s %s(): no groups specified.\n",
p->id, acl->name, expr->kw); p->id, acl->name, expr->kw);
cfgerr++; cfgerr++;
continue; continue;
} }
@ -1287,8 +1287,8 @@ int acl_find_targets(struct proxy *p)
/* For each pattern, check if the group exists. */ /* For each pattern, check if the group exists. */
list_for_each_entry(pexp, &expr->pat.head, list) { list_for_each_entry(pexp, &expr->pat.head, list) {
if (LIST_ISEMPTY(&pexp->expr->patterns)) { if (LIST_ISEMPTY(&pexp->expr->patterns)) {
Alert("proxy %s: acl %s %s(): no groups specified.\n", ha_alert("proxy %s: acl %s %s(): no groups specified.\n",
p->id, acl->name, expr->kw); p->id, acl->name, expr->kw);
cfgerr++; cfgerr++;
continue; continue;
} }
@ -1296,8 +1296,8 @@ int acl_find_targets(struct proxy *p)
list_for_each_entry(pattern, &pexp->expr->patterns, list) { list_for_each_entry(pattern, &pexp->expr->patterns, list) {
/* this keyword only has one argument */ /* this keyword only has one argument */
if (!check_group(expr->smp->arg_p->data.usr, pattern->pat.ptr.str)) { if (!check_group(expr->smp->arg_p->data.usr, pattern->pat.ptr.str)) {
Alert("proxy %s: acl %s %s(): invalid group '%s'.\n", ha_alert("proxy %s: acl %s %s(): invalid group '%s'.\n",
p->id, acl->name, expr->kw, pattern->pat.ptr.str); p->id, acl->name, expr->kw, pattern->pat.ptr.str);
cfgerr++; cfgerr++;
} }
} }
@ -1328,8 +1328,8 @@ int init_acl()
smp = find_sample_fetch(name, strlen(name)); smp = find_sample_fetch(name, strlen(name));
if (!smp) { if (!smp) {
Alert("Critical internal error: ACL keyword '%s' relies on sample fetch '%s' which was not registered!\n", ha_alert("Critical internal error: ACL keyword '%s' relies on sample fetch '%s' which was not registered!\n",
kwl->kw[index].kw, name); kwl->kw[index].kw, name);
err++; err++;
continue; continue;
} }

View File

@ -133,8 +133,8 @@ int userlist_postinit()
} }
if (!ag) { if (!ag) {
Alert("userlist '%s': no such group '%s' specified in user '%s'\n", ha_alert("userlist '%s': no such group '%s' specified in user '%s'\n",
curuserlist->name, group, curuser->user); curuserlist->name, group, curuser->user);
free(groups); free(groups);
return ERR_ALERT | ERR_FATAL; return ERR_ALERT | ERR_FATAL;
} }
@ -142,8 +142,8 @@ int userlist_postinit()
/* Add this group at the group userlist. */ /* Add this group at the group userlist. */
grl = calloc(1, sizeof(*grl)); grl = calloc(1, sizeof(*grl));
if (!grl) { if (!grl) {
Alert("userlist '%s': no more memory when trying to allocate the user groups.\n", ha_alert("userlist '%s': no more memory when trying to allocate the user groups.\n",
curuserlist->name); curuserlist->name);
free(groups); free(groups);
return ERR_ALERT | ERR_FATAL; return ERR_ALERT | ERR_FATAL;
} }
@ -170,16 +170,16 @@ int userlist_postinit()
} }
if (!curuser) { if (!curuser) {
Alert("userlist '%s': no such user '%s' specified in group '%s'\n", ha_alert("userlist '%s': no such user '%s' specified in group '%s'\n",
curuserlist->name, user, ag->name); curuserlist->name, user, ag->name);
return ERR_ALERT | ERR_FATAL; return ERR_ALERT | ERR_FATAL;
} }
/* Add this group at the group userlist. */ /* Add this group at the group userlist. */
grl = calloc(1, sizeof(*grl)); grl = calloc(1, sizeof(*grl));
if (!grl) { if (!grl) {
Alert("userlist '%s': no more memory when trying to allocate the user groups.\n", ha_alert("userlist '%s': no more memory when trying to allocate the user groups.\n",
curuserlist->name); curuserlist->name);
return ERR_ALERT | ERR_FATAL; return ERR_ALERT | ERR_FATAL;
} }

View File

@ -1359,7 +1359,7 @@ void set_backend_down(struct proxy *be)
HA_ATOMIC_ADD(&be->down_trans, 1); HA_ATOMIC_ADD(&be->down_trans, 1);
if (!(global.mode & MODE_STARTING)) { if (!(global.mode & MODE_STARTING)) {
Alert("%s '%s' has no server available!\n", proxy_type_str(be), be->id); ha_alert("%s '%s' has no server available!\n", proxy_type_str(be), be->id);
send_log(be, LOG_EMERG, "%s %s has no server available!\n", proxy_type_str(be), be->id); send_log(be, LOG_EMERG, "%s %s has no server available!\n", proxy_type_str(be), be->id);
} }
} }

View File

@ -609,15 +609,15 @@ enum act_parse_ret parse_cache_store(const char **args, int *orig_arg, struct pr
rule->arg.act.p[0] = strdup(args[cur_arg]); rule->arg.act.p[0] = strdup(args[cur_arg]);
if (!rule->arg.act.p[0]) { if (!rule->arg.act.p[0]) {
Alert("config: %s '%s': out of memory\n", proxy_type_str(proxy), proxy->id); ha_alert("config: %s '%s': out of memory\n", proxy_type_str(proxy), proxy->id);
err++; err++;
goto err; goto err;
} }
/* register a filter to fill the cache buffer */ /* register a filter to fill the cache buffer */
fconf = calloc(1, sizeof(*fconf)); fconf = calloc(1, sizeof(*fconf));
if (!fconf) { if (!fconf) {
Alert("config: %s '%s': out of memory\n", ha_alert("config: %s '%s': out of memory\n",
proxy_type_str(proxy), proxy->id); proxy_type_str(proxy), proxy->id);
err++; err++;
goto err; goto err;
} }
@ -718,7 +718,7 @@ enum act_parse_ret parse_cache_use(const char **args, int *orig_arg, struct prox
rule->arg.act.p[0] = strdup(args[cur_arg]); rule->arg.act.p[0] = strdup(args[cur_arg]);
if (!rule->arg.act.p[0]) { if (!rule->arg.act.p[0]) {
Alert("config: %s '%s': out of memory\n", proxy_type_str(proxy), proxy->id); ha_alert("config: %s '%s': out of memory\n", proxy_type_str(proxy), proxy->id);
err++; err++;
goto err; goto err;
} }
@ -738,8 +738,8 @@ int cfg_parse_cache(const char *file, int linenum, char **args, int kwm)
if (strcmp(args[0], "cache") == 0) { /* new cache section */ if (strcmp(args[0], "cache") == 0) { /* new cache section */
if (!*args[1]) { if (!*args[1]) {
Alert("parsing [%s:%d] : '%s' expects an <id> argument\n", ha_alert("parsing [%s:%d] : '%s' expects an <id> argument\n",
file, linenum, args[0]); file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
goto out; goto out;
} }
@ -752,15 +752,15 @@ int cfg_parse_cache(const char *file, int linenum, char **args, int kwm)
if (tmp_cache_config == NULL) { if (tmp_cache_config == NULL) {
tmp_cache_config = calloc(1, sizeof(*tmp_cache_config)); tmp_cache_config = calloc(1, sizeof(*tmp_cache_config));
if (!tmp_cache_config) { if (!tmp_cache_config) {
Alert("parsing [%s:%d]: out of memory.\n", file, linenum); ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
goto out; goto out;
} }
strlcpy2(tmp_cache_config->id, args[1], 33); strlcpy2(tmp_cache_config->id, args[1], 33);
if (strlen(args[1]) > 32) { if (strlen(args[1]) > 32) {
Warning("parsing [%s:%d]: cache id is limited to 32 characters, truncate to '%s'.\n", ha_warning("parsing [%s:%d]: cache id is limited to 32 characters, truncate to '%s'.\n",
file, linenum, tmp_cache_config->id); file, linenum, tmp_cache_config->id);
err_code |= ERR_WARN; err_code |= ERR_WARN;
} }
@ -779,7 +779,7 @@ int cfg_parse_cache(const char *file, int linenum, char **args, int kwm)
tmp_cache_config->maxblocks = maxsize; tmp_cache_config->maxblocks = maxsize;
} else if (*args[0] != 0) { } else if (*args[0] != 0) {
Alert("parsing [%s:%d] : unknown keyword '%s' in 'cache' section\n", file, linenum, args[0]); ha_alert("parsing [%s:%d] : unknown keyword '%s' in 'cache' section\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -799,7 +799,7 @@ int cfg_post_parse_section_cache()
struct cache *cache; struct cache *cache;
if (tmp_cache_config->maxblocks <= 0) { if (tmp_cache_config->maxblocks <= 0) {
Alert("Size not specified for cache '%s'\n", tmp_cache_config->id); ha_alert("Size not specified for cache '%s'\n", tmp_cache_config->id);
err_code |= ERR_FATAL | ERR_ALERT; err_code |= ERR_FATAL | ERR_ALERT;
goto out; goto out;
} }
@ -808,9 +808,9 @@ int cfg_post_parse_section_cache()
if (ret_shctx < 0) { if (ret_shctx < 0) {
if (ret_shctx == SHCTX_E_INIT_LOCK) if (ret_shctx == SHCTX_E_INIT_LOCK)
Alert("Unable to initialize the lock for the cache.\n"); ha_alert("Unable to initialize the lock for the cache.\n");
else else
Alert("Unable to allocate cache.\n"); ha_alert("Unable to allocate cache.\n");
err_code |= ERR_FATAL | ERR_ALERT; err_code |= ERR_FATAL | ERR_ALERT;
goto out; goto out;
@ -859,8 +859,8 @@ int cfg_cache_postparser()
} }
if (cache_ptr == hresrule->arg.act.p[0]) { if (cache_ptr == hresrule->arg.act.p[0]) {
Alert("Proxy '%s': unable to find the cache '%s' referenced by http-response cache-store rule.\n", ha_alert("Proxy '%s': unable to find the cache '%s' referenced by http-response cache-store rule.\n",
curproxy->id, (char *)hresrule->arg.act.p[0]); curproxy->id, (char *)hresrule->arg.act.p[0]);
err++; err++;
} }
@ -884,8 +884,8 @@ int cfg_cache_postparser()
} }
if (cache_ptr == hrqrule->arg.act.p[0]) { if (cache_ptr == hrqrule->arg.act.p[0]) {
Alert("Proxy '%s': unable to find the cache '%s' referenced by http-request cache-use rule.\n", ha_alert("Proxy '%s': unable to find the cache '%s' referenced by http-request cache-use rule.\n",
curproxy->id, (char *)hrqrule->arg.act.p[0]); curproxy->id, (char *)hrqrule->arg.act.p[0]);
err++; err++;
} }
@ -910,8 +910,8 @@ int cfg_cache_postparser()
} }
if (cache_ptr == fconf->conf) { if (cache_ptr == fconf->conf) {
Alert("Proxy '%s': unable to find the cache '%s' referenced by the filter 'cache'.\n", ha_alert("Proxy '%s': unable to find the cache '%s' referenced by the filter 'cache'.\n",
curproxy->id, (char *)fconf->conf); curproxy->id, (char *)fconf->conf);
err++; err++;
} }
fconf->conf = cache_ptr; fconf->conf = cache_ptr;

File diff suppressed because it is too large Load Diff

View File

@ -289,7 +289,7 @@ static void set_server_check_status(struct check *check, short status, const cha
(check->health >= check->rise) ? check->fall : check->rise, (check->health >= check->rise) ? check->fall : check->rise,
(check->health >= check->rise) ? (s->uweight ? "UP" : "DRAIN") : "DOWN"); (check->health >= check->rise) ? (s->uweight ? "UP" : "DRAIN") : "DOWN");
Warning("%s.\n", trash.str); ha_warning("%s.\n", trash.str);
send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.str); send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.str);
send_email_alert(s, LOG_INFO, "%s", trash.str); send_email_alert(s, LOG_INFO, "%s", trash.str);
} }
@ -1209,7 +1209,7 @@ static void event_srv_chk_r(struct conn_stream *cs)
* an error message is attached, so we can display it * an error message is attached, so we can display it
*/ */
desc = &check->bi->data[7]; desc = &check->bi->data[7];
//Warning("onlyoneERR: %s\n", desc); //ha_warning("onlyoneERR: %s\n", desc);
set_server_check_status(check, HCHK_STATUS_L7STS, desc); set_server_check_status(check, HCHK_STATUS_L7STS, desc);
} }
} else if (check->bi->i > first_packet_len + 4) { } else if (check->bi->i > first_packet_len + 4) {
@ -1224,7 +1224,7 @@ static void event_srv_chk_r(struct conn_stream *cs)
/* No error packet */ /* No error packet */
/* We set the MySQL Version in description for information purpose */ /* We set the MySQL Version in description for information purpose */
desc = &check->bi->data[5]; desc = &check->bi->data[5];
//Warning("2packetOK: %s\n", desc); //ha_warning("2packetOK: %s\n", desc);
set_server_check_status(check, HCHK_STATUS_L7OKD, desc); set_server_check_status(check, HCHK_STATUS_L7OKD, desc);
} }
else { else {
@ -1232,7 +1232,7 @@ static void event_srv_chk_r(struct conn_stream *cs)
* so we can display it ! :) * so we can display it ! :)
*/ */
desc = &check->bi->data[first_packet_len+11]; desc = &check->bi->data[first_packet_len+11];
//Warning("2packetERR: %s\n", desc); //ha_warning("2packetERR: %s\n", desc);
set_server_check_status(check, HCHK_STATUS_L7STS, desc); set_server_check_status(check, HCHK_STATUS_L7STS, desc);
} }
} }
@ -1245,7 +1245,7 @@ static void event_srv_chk_r(struct conn_stream *cs)
* it must be a protocol error * it must be a protocol error
*/ */
desc = &check->bi->data[5]; desc = &check->bi->data[5];
//Warning("protoerr: %s\n", desc); //ha_warning("protoerr: %s\n", desc);
set_server_check_status(check, HCHK_STATUS_L7RSP, desc); set_server_check_status(check, HCHK_STATUS_L7RSP, desc);
} }
} }
@ -1705,15 +1705,15 @@ static int init_pid_list(void)
return 0; return 0;
if (!signal_register_fct(SIGCHLD, sigchld_handler, SIGCHLD)) { if (!signal_register_fct(SIGCHLD, sigchld_handler, SIGCHLD)) {
Alert("Failed to set signal handler for external health checks: %s. Aborting.\n", ha_alert("Failed to set signal handler for external health checks: %s. Aborting.\n",
strerror(errno)); strerror(errno));
return 1; return 1;
} }
pool2_pid_list = create_pool("pid_list", sizeof(struct pid_list), MEM_F_SHARED); pool2_pid_list = create_pool("pid_list", sizeof(struct pid_list), MEM_F_SHARED);
if (pool2_pid_list == NULL) { if (pool2_pid_list == NULL) {
Alert("Failed to allocate memory pool for external health checks: %s. Aborting.\n", ha_alert("Failed to allocate memory pool for external health checks: %s. Aborting.\n",
strerror(errno)); strerror(errno));
return 1; return 1;
} }
@ -1737,7 +1737,7 @@ static int extchk_setenv(struct check *check, int idx, const char *value)
int vmaxlen; int vmaxlen;
if (idx < 0 || idx >= EXTCHK_SIZE) { if (idx < 0 || idx >= EXTCHK_SIZE) {
Alert("Illegal environment variable index %d. Aborting.\n", idx); ha_alert("Illegal environment variable index %d. Aborting.\n", idx);
return 1; return 1;
} }
@ -1764,16 +1764,16 @@ static int extchk_setenv(struct check *check, int idx, const char *value)
check->envp[idx] = malloc(len + 1); check->envp[idx] = malloc(len + 1);
if (!check->envp[idx]) { if (!check->envp[idx]) {
Alert("Failed to allocate memory for the environment variable '%s'. Aborting.\n", envname); ha_alert("Failed to allocate memory for the environment variable '%s'. Aborting.\n", envname);
return 1; return 1;
} }
ret = snprintf(check->envp[idx], len + 1, "%s=%s", envname, value); ret = snprintf(check->envp[idx], len + 1, "%s=%s", envname, value);
if (ret < 0) { if (ret < 0) {
Alert("Failed to store the environment variable '%s'. Reason : %s. Aborting.\n", envname, strerror(errno)); ha_alert("Failed to store the environment variable '%s'. Reason : %s. Aborting.\n", envname, strerror(errno));
return 1; return 1;
} }
else if (ret > len) { else if (ret > len) {
Alert("Environment variable '%s' was truncated. Aborting.\n", envname); ha_alert("Environment variable '%s' was truncated. Aborting.\n", envname);
return 1; return 1;
} }
return 0; return 0;
@ -1800,13 +1800,13 @@ static int prepare_external_check(struct check *check)
check->curpid = NULL; check->curpid = NULL;
check->envp = calloc((EXTCHK_SIZE + 1), sizeof(char *)); check->envp = calloc((EXTCHK_SIZE + 1), sizeof(char *));
if (!check->envp) { if (!check->envp) {
Alert("Failed to allocate memory for environment variables. Aborting\n"); ha_alert("Failed to allocate memory for environment variables. Aborting\n");
goto err; goto err;
} }
check->argv = calloc(6, sizeof(char *)); check->argv = calloc(6, sizeof(char *));
if (!check->argv) { if (!check->argv) {
Alert("Starting [%s:%s] check: out of memory.\n", px->id, s->id); ha_alert("Starting [%s:%s] check: out of memory.\n", px->id, s->id);
goto err; goto err;
} }
@ -1831,7 +1831,7 @@ static int prepare_external_check(struct check *check)
check->argv[2] = strdup("NOT_USED"); check->argv[2] = strdup("NOT_USED");
} }
else { else {
Alert("Starting [%s:%s] check: unsupported address family.\n", px->id, s->id); ha_alert("Starting [%s:%s] check: unsupported address family.\n", px->id, s->id);
goto err; goto err;
} }
@ -1846,7 +1846,7 @@ static int prepare_external_check(struct check *check)
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
if (!check->argv[i]) { if (!check->argv[i]) {
Alert("Starting [%s:%s] check: out of memory.\n", px->id, s->id); ha_alert("Starting [%s:%s] check: out of memory.\n", px->id, s->id);
goto err; goto err;
} }
} }
@ -1913,8 +1913,8 @@ static int connect_proc_chk(struct task *t)
pid = fork(); pid = fork();
if (pid < 0) { if (pid < 0) {
Alert("Failed to fork process for external health check: %s. Aborting.\n", ha_alert("Failed to fork process for external health check: %s. Aborting.\n",
strerror(errno)); strerror(errno));
set_server_check_status(check, HCHK_STATUS_SOCKERR, strerror(errno)); set_server_check_status(check, HCHK_STATUS_SOCKERR, strerror(errno));
goto out; goto out;
} }
@ -1932,8 +1932,8 @@ static int connect_proc_chk(struct task *t)
environ = check->envp; environ = check->envp;
extchk_setenv(check, EXTCHK_HAPROXY_SERVER_CURCONN, ultoa_r(s->cur_sess, buf, sizeof(buf))); extchk_setenv(check, EXTCHK_HAPROXY_SERVER_CURCONN, ultoa_r(s->cur_sess, buf, sizeof(buf)));
execvp(px->check_command, check->argv); execvp(px->check_command, check->argv);
Alert("Failed to exec process for external health check: %s. Aborting.\n", ha_alert("Failed to exec process for external health check: %s. Aborting.\n",
strerror(errno)); strerror(errno));
exit(-1); exit(-1);
} }
@ -2054,7 +2054,7 @@ static struct task *process_chk_proc(struct task *t)
status = HCHK_STATUS_PROCOK; status = HCHK_STATUS_PROCOK;
} else if (expired) { } else if (expired) {
status = HCHK_STATUS_PROCTOUT; status = HCHK_STATUS_PROCTOUT;
Warning("kill %d\n", (int)elem->pid); ha_warning("kill %d\n", (int)elem->pid);
kill(elem->pid, SIGTERM); kill(elem->pid, SIGTERM);
} }
set_server_check_status(check, status, NULL); set_server_check_status(check, status, NULL);
@ -2290,8 +2290,8 @@ static int start_check_task(struct check *check, int mininter,
struct task *t; struct task *t;
/* task for the check */ /* task for the check */
if ((t = task_new(MAX_THREADS_MASK)) == NULL) { if ((t = task_new(MAX_THREADS_MASK)) == NULL) {
Alert("Starting [%s:%s] check: out of memory.\n", ha_alert("Starting [%s:%s] check: out of memory.\n",
check->server->proxy->id, check->server->id); check->server->proxy->id, check->server->id);
return 0; return 0;
} }
@ -2336,7 +2336,7 @@ static int start_checks()
for (s = px->srv; s; s = s->next) { for (s = px->srv; s; s = s->next) {
if (s->slowstart) { if (s->slowstart) {
if ((t = task_new(MAX_THREADS_MASK)) == NULL) { if ((t = task_new(MAX_THREADS_MASK)) == NULL) {
Alert("Starting [%s:%s] check: out of memory.\n", px->id, s->id); ha_alert("Starting [%s:%s] check: out of memory.\n", px->id, s->id);
return ERR_ALERT | ERR_FATAL; return ERR_ALERT | ERR_FATAL;
} }
/* We need a warmup task that will be called when the server /* We need a warmup task that will be called when the server
@ -2379,7 +2379,7 @@ static int start_checks()
for (px = proxy; px; px = px->next) { for (px = proxy; px; px = px->next) {
if ((px->options2 & PR_O2_CHK_ANY) == PR_O2_EXT_CHK) { if ((px->options2 & PR_O2_CHK_ANY) == PR_O2_EXT_CHK) {
if (init_pid_list()) { if (init_pid_list()) {
Alert("Starting [%s] check: out of memory.\n", px->id); ha_alert("Starting [%s] check: out of memory.\n", px->id);
return ERR_ALERT | ERR_FATAL; return ERR_ALERT | ERR_FATAL;
} }
} }
@ -3415,7 +3415,7 @@ static void enqueue_email_alert(struct proxy *p, struct server *s, const char *m
for (i = 0, mailer = p->email_alert.mailers.m->mailer_list; for (i = 0, mailer = p->email_alert.mailers.m->mailer_list;
i < p->email_alert.mailers.m->count; i++, mailer = mailer->next) { i < p->email_alert.mailers.m->count; i++, mailer = mailer->next) {
if (!enqueue_one_email_alert(p, s, &p->email_alert.queues[i], msg)) { if (!enqueue_one_email_alert(p, s, &p->email_alert.queues[i], msg)) {
Alert("Email alert [%s] could not be enqueued: out of memory\n", p->id); ha_alert("Email alert [%s] could not be enqueued: out of memory\n", p->id);
return; return;
} }
} }
@ -3441,7 +3441,7 @@ void send_email_alert(struct server *s, int level, const char *format, ...)
va_end(argp); va_end(argp);
if (len < 0 || len >= sizeof(buf)) { if (len < 0 || len >= sizeof(buf)) {
Alert("Email alert [%s] could not format message\n", p->id); ha_alert("Email alert [%s] could not format message\n", p->id);
return; return;
} }

View File

@ -460,7 +460,7 @@ static int cli_output_msg(struct channel *chn, const char *msg, int severity, in
chunk_reset(tmp); chunk_reset(tmp);
if (severity < 0 || severity > 7) { if (severity < 0 || severity > 7) {
Warning("socket command feedback with invalid severity %d", severity); ha_warning("socket command feedback with invalid severity %d", severity);
chunk_printf(tmp, "[%d]: ", severity); chunk_printf(tmp, "[%d]: ", severity);
} }
else { else {
@ -472,7 +472,7 @@ static int cli_output_msg(struct channel *chn, const char *msg, int severity, in
chunk_printf(tmp, "[%s]: ", log_levels[severity]); chunk_printf(tmp, "[%s]: ", log_levels[severity]);
break; break;
default: default:
Warning("Unrecognized severity output %d", severity_output); ha_warning("Unrecognized severity output %d", severity_output);
} }
} }
chunk_appendf(tmp, "%s", msg); chunk_appendf(tmp, "%s", msg);
@ -1254,16 +1254,16 @@ static int _getsocks(char **args, struct appctx *appctx, void *private)
/* Temporary set the FD in blocking mode, that will make our life easier */ /* Temporary set the FD in blocking mode, that will make our life easier */
old_fcntl = fcntl(fd, F_GETFL); old_fcntl = fcntl(fd, F_GETFL);
if (old_fcntl < 0) { if (old_fcntl < 0) {
Warning("Couldn't get the flags for the unix socket\n"); ha_warning("Couldn't get the flags for the unix socket\n");
goto out; goto out;
} }
cmsgbuf = malloc(CMSG_SPACE(sizeof(int) * MAX_SEND_FD)); cmsgbuf = malloc(CMSG_SPACE(sizeof(int) * MAX_SEND_FD));
if (!cmsgbuf) { if (!cmsgbuf) {
Warning("Failed to allocate memory to send sockets\n"); ha_warning("Failed to allocate memory to send sockets\n");
goto out; goto out;
} }
if (fcntl(fd, F_SETFL, old_fcntl &~ O_NONBLOCK) == -1) { if (fcntl(fd, F_SETFL, old_fcntl &~ O_NONBLOCK) == -1) {
Warning("Cannot make the unix socket blocking\n"); ha_warning("Cannot make the unix socket blocking\n");
goto out; goto out;
} }
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (void *)&tv, sizeof(tv)); setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (void *)&tv, sizeof(tv));
@ -1300,7 +1300,7 @@ static int _getsocks(char **args, struct appctx *appctx, void *private)
msghdr.msg_iovlen = 1; msghdr.msg_iovlen = 1;
ret = sendmsg(fd, &msghdr, 0); ret = sendmsg(fd, &msghdr, 0);
if (ret != sizeof(tot_fd_nb)) { if (ret != sizeof(tot_fd_nb)) {
Warning("Failed to send the number of sockets to send\n"); ha_warning("Failed to send the number of sockets to send\n");
goto out; goto out;
} }
@ -1326,7 +1326,7 @@ static int _getsocks(char **args, struct appctx *appctx, void *private)
*/ */
tmpbuf = malloc(MAX_SEND_FD * (1 + MAXPATHLEN + 1 + IFNAMSIZ + sizeof(int))); tmpbuf = malloc(MAX_SEND_FD * (1 + MAXPATHLEN + 1 + IFNAMSIZ + sizeof(int)));
if (tmpbuf == NULL) { if (tmpbuf == NULL) {
Warning("Failed to allocate memory to transfer socket informations\n"); ha_warning("Failed to allocate memory to transfer socket informations\n");
goto out; goto out;
} }
iov.iov_base = tmpbuf; iov.iov_base = tmpbuf;
@ -1370,7 +1370,7 @@ static int _getsocks(char **args, struct appctx *appctx, void *private)
if ((!(i % MAX_SEND_FD))) { if ((!(i % MAX_SEND_FD))) {
iov.iov_len = curoff; iov.iov_len = curoff;
if (sendmsg(fd, &msghdr, 0) != curoff) { if (sendmsg(fd, &msghdr, 0) != curoff) {
Warning("Failed to transfer sockets\n"); ha_warning("Failed to transfer sockets\n");
printf("errno %d\n", errno); printf("errno %d\n", errno);
goto out; goto out;
} }
@ -1380,7 +1380,7 @@ static int _getsocks(char **args, struct appctx *appctx, void *private)
sizeof(tot_fd_nb), 0); sizeof(tot_fd_nb), 0);
} while (ret == -1 && errno == EINTR); } while (ret == -1 && errno == EINTR);
if (ret <= 0) { if (ret <= 0) {
Warning("Unexpected error while transferring sockets\n"); ha_warning("Unexpected error while transferring sockets\n");
goto out; goto out;
} }
curoff = 0; curoff = 0;
@ -1394,14 +1394,14 @@ static int _getsocks(char **args, struct appctx *appctx, void *private)
cmsg->cmsg_len = CMSG_LEN((i % MAX_SEND_FD) * sizeof(int)); cmsg->cmsg_len = CMSG_LEN((i % MAX_SEND_FD) * sizeof(int));
msghdr.msg_controllen = CMSG_SPACE(sizeof(int) * (i % MAX_SEND_FD)); msghdr.msg_controllen = CMSG_SPACE(sizeof(int) * (i % MAX_SEND_FD));
if (sendmsg(fd, &msghdr, 0) != curoff) { if (sendmsg(fd, &msghdr, 0) != curoff) {
Warning("Failed to transfer sockets\n"); ha_warning("Failed to transfer sockets\n");
goto out; goto out;
} }
} }
out: out:
if (old_fcntl >= 0 && fcntl(fd, F_SETFL, old_fcntl) == -1) { if (old_fcntl >= 0 && fcntl(fd, F_SETFL, old_fcntl) == -1) {
Warning("Cannot make the unix socket non-blocking\n"); ha_warning("Cannot make the unix socket non-blocking\n");
goto out; goto out;
} }
appctx->st0 = CLI_ST_END; appctx->st0 = CLI_ST_END;

View File

@ -102,7 +102,7 @@ static void da_haproxy_log(da_severity_t severity, da_status_t status,
if (global_deviceatlas.loglevel && severity <= global_deviceatlas.loglevel) { if (global_deviceatlas.loglevel && severity <= global_deviceatlas.loglevel) {
char logbuf[256]; char logbuf[256];
vsnprintf(logbuf, sizeof(logbuf), fmt, args); vsnprintf(logbuf, sizeof(logbuf), fmt, args);
Warning("deviceatlas : %s.\n", logbuf); ha_warning("deviceatlas : %s.\n", logbuf);
} }
} }
@ -122,15 +122,15 @@ static int init_deviceatlas(void)
da_status_t status; da_status_t status;
if (global.nbthread > 1) { if (global.nbthread > 1) {
Alert("deviceatlas: multithreading is not supported for now.\n"); ha_alert("deviceatlas: multithreading is not supported for now.\n");
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
jsonp = fopen(global_deviceatlas.jsonpath, "r"); jsonp = fopen(global_deviceatlas.jsonpath, "r");
if (jsonp == 0) { if (jsonp == 0) {
Alert("deviceatlas : '%s' json file has invalid path or is not readable.\n", ha_alert("deviceatlas : '%s' json file has invalid path or is not readable.\n",
global_deviceatlas.jsonpath); global_deviceatlas.jsonpath);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -141,8 +141,8 @@ static int init_deviceatlas(void)
&global_deviceatlas.atlasimgptr, &atlasimglen); &global_deviceatlas.atlasimgptr, &atlasimglen);
fclose(jsonp); fclose(jsonp);
if (status != DA_OK) { if (status != DA_OK) {
Alert("deviceatlas : '%s' json file is invalid.\n", ha_alert("deviceatlas : '%s' json file is invalid.\n",
global_deviceatlas.jsonpath); global_deviceatlas.jsonpath);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -151,7 +151,7 @@ static int init_deviceatlas(void)
global_deviceatlas.atlasimgptr, atlasimglen); global_deviceatlas.atlasimgptr, atlasimglen);
if (status != DA_OK) { if (status != DA_OK) {
Alert("deviceatlas : data could not be compiled.\n"); ha_alert("deviceatlas : data could not be compiled.\n");
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }

View File

@ -89,14 +89,14 @@ struct dns_srvrq *new_dns_srvrq(struct server *srv, char *fqdn)
fqdn_len = strlen(fqdn); fqdn_len = strlen(fqdn);
hostname_dn_len = dns_str_to_dn_label(fqdn, fqdn_len + 1, trash.str, trash.size); hostname_dn_len = dns_str_to_dn_label(fqdn, fqdn_len + 1, trash.str, trash.size);
if (hostname_dn_len == -1) { if (hostname_dn_len == -1) {
Alert("config : %s '%s', server '%s': failed to parse FQDN '%s'\n", ha_alert("config : %s '%s', server '%s': failed to parse FQDN '%s'\n",
proxy_type_str(px), px->id, srv->id, fqdn); proxy_type_str(px), px->id, srv->id, fqdn);
goto err; goto err;
} }
if ((srvrq = calloc(1, sizeof(*srvrq))) == NULL) { if ((srvrq = calloc(1, sizeof(*srvrq))) == NULL) {
Alert("config : %s '%s', server '%s': out of memory\n", ha_alert("config : %s '%s', server '%s': out of memory\n",
proxy_type_str(px), px->id, srv->id); proxy_type_str(px), px->id, srv->id);
goto err; goto err;
} }
srvrq->obj_type = OBJ_TYPE_SRVRQ; srvrq->obj_type = OBJ_TYPE_SRVRQ;
@ -105,8 +105,8 @@ struct dns_srvrq *new_dns_srvrq(struct server *srv, char *fqdn)
srvrq->hostname_dn = strdup(trash.str); srvrq->hostname_dn = strdup(trash.str);
srvrq->hostname_dn_len = hostname_dn_len; srvrq->hostname_dn_len = hostname_dn_len;
if (!srvrq->name || !srvrq->hostname_dn) { if (!srvrq->name || !srvrq->hostname_dn) {
Alert("config : %s '%s', server '%s': out of memory\n", ha_alert("config : %s '%s', server '%s': out of memory\n",
proxy_type_str(px), px->id, srv->id); proxy_type_str(px), px->id, srv->id);
goto err; goto err;
} }
LIST_ADDQ(&dns_srvrq_list, &srvrq->list); LIST_ADDQ(&dns_srvrq_list, &srvrq->list);
@ -1852,14 +1852,14 @@ static int dns_finalize_config(void)
/* Check nameserver info */ /* Check nameserver info */
if ((fd = socket(ns->addr.ss_family, SOCK_DGRAM, IPPROTO_UDP)) == -1) { if ((fd = socket(ns->addr.ss_family, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
Alert("config : resolvers '%s': can't create socket for nameserver '%s'.\n", ha_alert("config : resolvers '%s': can't create socket for nameserver '%s'.\n",
resolvers->id, ns->id); resolvers->id, ns->id);
err_code |= (ERR_ALERT|ERR_ABORT); err_code |= (ERR_ALERT|ERR_ABORT);
continue; continue;
} }
if (connect(fd, (struct sockaddr*)&ns->addr, get_addr_len(&ns->addr)) == -1) { if (connect(fd, (struct sockaddr*)&ns->addr, get_addr_len(&ns->addr)) == -1) {
Alert("config : resolvers '%s': can't connect socket for nameserver '%s'.\n", ha_alert("config : resolvers '%s': can't connect socket for nameserver '%s'.\n",
resolvers->id, ns->id); resolvers->id, ns->id);
close(fd); close(fd);
err_code |= (ERR_ALERT|ERR_ABORT); err_code |= (ERR_ALERT|ERR_ABORT);
continue; continue;
@ -1869,8 +1869,8 @@ static int dns_finalize_config(void)
/* Create dgram structure that will hold the UPD socket /* Create dgram structure that will hold the UPD socket
* and attach it on the current nameserver */ * and attach it on the current nameserver */
if ((dgram = calloc(1, sizeof(*dgram))) == NULL) { if ((dgram = calloc(1, sizeof(*dgram))) == NULL) {
Alert("config: resolvers '%s' : out of memory.\n", ha_alert("config: resolvers '%s' : out of memory.\n",
resolvers->id); resolvers->id);
err_code |= (ERR_ALERT|ERR_ABORT); err_code |= (ERR_ALERT|ERR_ABORT);
goto err; goto err;
} }
@ -1885,7 +1885,7 @@ static int dns_finalize_config(void)
/* Create the task associated to the resolvers section */ /* Create the task associated to the resolvers section */
if ((t = task_new(MAX_THREADS_MASK)) == NULL) { if ((t = task_new(MAX_THREADS_MASK)) == NULL) {
Alert("config : resolvers '%s' : out of memory.\n", resolvers->id); ha_alert("config : resolvers '%s' : out of memory.\n", resolvers->id);
err_code |= (ERR_ALERT|ERR_ABORT); err_code |= (ERR_ALERT|ERR_ABORT);
goto err; goto err;
} }
@ -1907,8 +1907,8 @@ static int dns_finalize_config(void)
continue; continue;
if ((resolvers = find_resolvers_by_id(srv->resolvers_id)) == NULL) { if ((resolvers = find_resolvers_by_id(srv->resolvers_id)) == NULL) {
Alert("config : %s '%s', server '%s': unable to find required resolvers '%s'\n", ha_alert("config : %s '%s', server '%s': unable to find required resolvers '%s'\n",
proxy_type_str(px), px->id, srv->id, srv->resolvers_id); proxy_type_str(px), px->id, srv->id, srv->resolvers_id);
err_code |= (ERR_ALERT|ERR_ABORT); err_code |= (ERR_ALERT|ERR_ABORT);
continue; continue;
} }
@ -1917,15 +1917,15 @@ static int dns_finalize_config(void)
if (srv->srvrq && !srv->srvrq->resolvers) { if (srv->srvrq && !srv->srvrq->resolvers) {
srv->srvrq->resolvers = srv->resolvers; srv->srvrq->resolvers = srv->resolvers;
if (dns_link_resolution(srv->srvrq, OBJ_TYPE_SRVRQ, 0) == -1) { if (dns_link_resolution(srv->srvrq, OBJ_TYPE_SRVRQ, 0) == -1) {
Alert("config : %s '%s' : unable to set DNS resolution for server '%s'.\n", ha_alert("config : %s '%s' : unable to set DNS resolution for server '%s'.\n",
proxy_type_str(px), px->id, srv->id); proxy_type_str(px), px->id, srv->id);
err_code |= (ERR_ALERT|ERR_ABORT); err_code |= (ERR_ALERT|ERR_ABORT);
continue; continue;
} }
} }
if (dns_link_resolution(srv, OBJ_TYPE_SERVER, 0) == -1) { if (dns_link_resolution(srv, OBJ_TYPE_SERVER, 0) == -1) {
Alert("config : %s '%s', unable to set DNS resolution for server '%s'.\n", ha_alert("config : %s '%s', unable to set DNS resolution for server '%s'.\n",
proxy_type_str(px), px->id, srv->id); proxy_type_str(px), px->id, srv->id);
err_code |= (ERR_ALERT|ERR_ABORT); err_code |= (ERR_ALERT|ERR_ABORT);
continue; continue;
} }

View File

@ -291,8 +291,8 @@ flt_init_all()
for (px = proxy; px; px = px->next) { for (px = proxy; px; px = px->next) {
err_code |= flt_init(px); err_code |= flt_init(px);
if (err_code & (ERR_ABORT|ERR_FATAL)) { if (err_code & (ERR_ABORT|ERR_FATAL)) {
Alert("Failed to initialize filters for proxy '%s'.\n", ha_alert("Failed to initialize filters for proxy '%s'.\n",
px->id); px->id);
return err_code; return err_code;
} }
} }
@ -310,8 +310,8 @@ flt_init_all_per_thread()
for (px = proxy; px; px = px->next) { for (px = proxy; px; px = px->next) {
err_code = flt_init_per_thread(px); err_code = flt_init_per_thread(px);
if (err_code & (ERR_ABORT|ERR_FATAL)) { if (err_code & (ERR_ABORT|ERR_FATAL)) {
Alert("Failed to initialize filters for proxy '%s' for thread %u.\n", ha_alert("Failed to initialize filters for proxy '%s' for thread %u.\n",
px->id, tid); px->id, tid);
return 0; return 0;
} }
} }

View File

@ -261,7 +261,7 @@ comp_http_forward_data(struct stream *s, struct filter *filter,
/* To work, previous filters MUST forward all data */ /* To work, previous filters MUST forward all data */
if (flt_rsp_fwd(filter) + len != flt_rsp_nxt(filter)) { if (flt_rsp_fwd(filter) + len != flt_rsp_nxt(filter)) {
Warning("HTTP compression failed: unexpected behavior of previous filters\n"); ha_warning("HTTP compression failed: unexpected behavior of previous filters\n");
return -1; return -1;
} }
@ -298,8 +298,8 @@ comp_http_forward_data(struct stream *s, struct filter *filter,
if (msg->flags & HTTP_MSGF_TE_CHNK) { if (msg->flags & HTTP_MSGF_TE_CHNK) {
ret = http_compression_buffer_add_data(st, tmpbuf, zbuf, tmpbuf->i); ret = http_compression_buffer_add_data(st, tmpbuf, zbuf, tmpbuf->i);
if (ret != tmpbuf->i) { if (ret != tmpbuf->i) {
Warning("HTTP compression failed: Must consume %d bytes but only %d bytes consumed\n", ha_warning("HTTP compression failed: Must consume %d bytes but only %d bytes consumed\n",
tmpbuf->i, ret); tmpbuf->i, ret);
return -1; return -1;
} }
} }
@ -903,16 +903,16 @@ check_legacy_http_comp_flt(struct proxy *proxy)
if (fconf->id == http_comp_flt_id) if (fconf->id == http_comp_flt_id)
goto end; goto end;
} }
Alert("config: %s '%s': require an explicit filter declaration to use HTTP compression\n", ha_alert("config: %s '%s': require an explicit filter declaration to use HTTP compression\n",
proxy_type_str(proxy), proxy->id); proxy_type_str(proxy), proxy->id);
err++; err++;
goto end; goto end;
} }
fconf = calloc(1, sizeof(*fconf)); fconf = calloc(1, sizeof(*fconf));
if (!fconf) { if (!fconf) {
Alert("config: %s '%s': out of memory\n", ha_alert("config: %s '%s': out of memory\n",
proxy_type_str(proxy), proxy->id); proxy_type_str(proxy), proxy->id);
err++; err++;
goto end; goto end;
} }

View File

@ -2893,25 +2893,25 @@ spoe_check(struct proxy *px, struct flt_conf *fconf)
/* Check engine Id. It should be uniq */ /* Check engine Id. It should be uniq */
if (!strcmp(conf->id, c->id)) { if (!strcmp(conf->id, c->id)) {
Alert("Proxy %s : duplicated name for SPOE engine '%s'.\n", ha_alert("Proxy %s : duplicated name for SPOE engine '%s'.\n",
px->id, conf->id); px->id, conf->id);
return 1; return 1;
} }
} }
target = proxy_be_by_name(conf->agent->b.name); target = proxy_be_by_name(conf->agent->b.name);
if (target == NULL) { if (target == NULL) {
Alert("Proxy %s : unknown backend '%s' used by SPOE agent '%s'" ha_alert("Proxy %s : unknown backend '%s' used by SPOE agent '%s'"
" declared at %s:%d.\n", " declared at %s:%d.\n",
px->id, conf->agent->b.name, conf->agent->id, px->id, conf->agent->b.name, conf->agent->id,
conf->agent->conf.file, conf->agent->conf.line); conf->agent->conf.file, conf->agent->conf.line);
return 1; return 1;
} }
if (target->mode != PR_MODE_TCP) { if (target->mode != PR_MODE_TCP) {
Alert("Proxy %s : backend '%s' used by SPOE agent '%s' declared" ha_alert("Proxy %s : backend '%s' used by SPOE agent '%s' declared"
" at %s:%d does not support HTTP mode.\n", " at %s:%d does not support HTTP mode.\n",
px->id, target->id, conf->agent->id, px->id, target->id, conf->agent->id,
conf->agent->conf.file, conf->agent->conf.line); conf->agent->conf.file, conf->agent->conf.line);
return 1; return 1;
} }
@ -3152,8 +3152,8 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
if (!strcmp(args[0], "spoe-agent")) { /* new spoe-agent section */ if (!strcmp(args[0], "spoe-agent")) { /* new spoe-agent section */
if (!*args[1]) { if (!*args[1]) {
Alert("parsing [%s:%d] : missing name for spoe-agent section.\n", ha_alert("parsing [%s:%d] : missing name for spoe-agent section.\n",
file, linenum); file, linenum);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
goto out; goto out;
} }
@ -3164,20 +3164,20 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
err = invalid_char(args[1]); err = invalid_char(args[1]);
if (err) { if (err) {
Alert("parsing [%s:%d] : character '%c' is not permitted in '%s' name '%s'.\n", ha_alert("parsing [%s:%d] : character '%c' is not permitted in '%s' name '%s'.\n",
file, linenum, *err, args[0], args[1]); file, linenum, *err, args[0], args[1]);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
goto out; goto out;
} }
if (curagent != NULL) { if (curagent != NULL) {
Alert("parsing [%s:%d] : another spoe-agent section previously defined.\n", ha_alert("parsing [%s:%d] : another spoe-agent section previously defined.\n",
file, linenum); file, linenum);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
goto out; goto out;
} }
if ((curagent = calloc(1, sizeof(*curagent))) == NULL) { if ((curagent = calloc(1, sizeof(*curagent))) == NULL) {
Alert("parsing [%s:%d] : out of memory.\n", file, linenum); ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
goto out; goto out;
} }
@ -3209,7 +3209,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
LIST_INIT(&curagent->messages); LIST_INIT(&curagent->messages);
if ((curagent->rt = calloc(global.nbthread, sizeof(*curagent->rt))) == NULL) { if ((curagent->rt = calloc(global.nbthread, sizeof(*curagent->rt))) == NULL) {
Alert("parsing [%s:%d] : out of memory.\n", file, linenum); ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
goto out; goto out;
} }
@ -3226,8 +3226,8 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
} }
else if (!strcmp(args[0], "use-backend")) { else if (!strcmp(args[0], "use-backend")) {
if (!*args[1]) { if (!*args[1]) {
Alert("parsing [%s:%d] : '%s' expects a backend name.\n", ha_alert("parsing [%s:%d] : '%s' expects a backend name.\n",
file, linenum, args[0]); file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -3243,15 +3243,15 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
list_for_each_entry(ph, &curmphs, list) { list_for_each_entry(ph, &curmphs, list) {
if (!strcmp(ph->id, args[cur_arg])) { if (!strcmp(ph->id, args[cur_arg])) {
Alert("parsing [%s:%d]: spoe-message '%s' already used.\n", ha_alert("parsing [%s:%d]: spoe-message '%s' already used.\n",
file, linenum, args[cur_arg]); file, linenum, args[cur_arg]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
} }
if ((ph = calloc(1, sizeof(*ph))) == NULL) { if ((ph = calloc(1, sizeof(*ph))) == NULL) {
Alert("parsing [%s:%d] : out of memory.\n", file, linenum); ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
goto out; goto out;
} }
@ -3267,15 +3267,15 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
list_for_each_entry(ph, &curgphs, list) { list_for_each_entry(ph, &curgphs, list) {
if (!strcmp(ph->id, args[cur_arg])) { if (!strcmp(ph->id, args[cur_arg])) {
Alert("parsing [%s:%d]: spoe-group '%s' already used.\n", ha_alert("parsing [%s:%d]: spoe-group '%s' already used.\n",
file, linenum, args[cur_arg]); file, linenum, args[cur_arg]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
} }
if ((ph = calloc(1, sizeof(*ph))) == NULL) { if ((ph = calloc(1, sizeof(*ph))) == NULL) {
Alert("parsing [%s:%d] : out of memory.\n", file, linenum); ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
goto out; goto out;
} }
@ -3290,8 +3290,8 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
unsigned timeout; unsigned timeout;
if (!*args[1]) { if (!*args[1]) {
Alert("parsing [%s:%d] : 'timeout' expects 'hello', 'idle' and 'processing'.\n", ha_alert("parsing [%s:%d] : 'timeout' expects 'hello', 'idle' and 'processing'.\n",
file, linenum); file, linenum);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -3304,21 +3304,21 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
else if (!strcmp(args[1], "processing")) else if (!strcmp(args[1], "processing"))
tv = &curagent->timeout.processing; tv = &curagent->timeout.processing;
else { else {
Alert("parsing [%s:%d] : 'timeout' supports 'hello', 'idle' or 'processing' (got %s).\n", ha_alert("parsing [%s:%d] : 'timeout' supports 'hello', 'idle' or 'processing' (got %s).\n",
file, linenum, args[1]); file, linenum, args[1]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
if (!*args[2]) { if (!*args[2]) {
Alert("parsing [%s:%d] : 'timeout %s' expects an integer value (in milliseconds).\n", ha_alert("parsing [%s:%d] : 'timeout %s' expects an integer value (in milliseconds).\n",
file, linenum, args[1]); file, linenum, args[1]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
res = parse_time_err(args[2], &timeout, TIME_UNIT_MS); res = parse_time_err(args[2], &timeout, TIME_UNIT_MS);
if (res) { if (res) {
Alert("parsing [%s:%d] : unexpected character '%c' in 'timeout %s'.\n", ha_alert("parsing [%s:%d] : unexpected character '%c' in 'timeout %s'.\n",
file, linenum, *res, args[1]); file, linenum, *res, args[1]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -3326,8 +3326,8 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
} }
else if (!strcmp(args[0], "option")) { else if (!strcmp(args[0], "option")) {
if (!*args[1]) { if (!*args[1]) {
Alert("parsing [%s:%d]: '%s' expects an option name.\n", ha_alert("parsing [%s:%d]: '%s' expects an option name.\n",
file, linenum, args[0]); file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -3350,8 +3350,8 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
if (global.nbthread == 1) if (global.nbthread == 1)
curagent->flags |= SPOE_FL_ASYNC; curagent->flags |= SPOE_FL_ASYNC;
else { else {
Warning("parsing [%s:%d] Async option is not supported with threads.\n", ha_warning("parsing [%s:%d] Async option is not supported with threads.\n",
file, linenum); file, linenum);
err_code |= ERR_WARN; err_code |= ERR_WARN;
} }
} }
@ -3369,8 +3369,8 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
/* Following options does not support negation */ /* Following options does not support negation */
if (kwm == 1) { if (kwm == 1) {
Alert("parsing [%s:%d]: negation is not supported for option '%s'.\n", ha_alert("parsing [%s:%d]: negation is not supported for option '%s'.\n",
file, linenum, args[1]); file, linenum, args[1]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -3379,9 +3379,9 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
char *tmp; char *tmp;
if (!*args[2]) { if (!*args[2]) {
Alert("parsing [%s:%d]: '%s %s' expects a value.\n", ha_alert("parsing [%s:%d]: '%s %s' expects a value.\n",
file, linenum, args[0], file, linenum, args[0],
args[1]); args[1]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -3390,8 +3390,8 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
tmp = args[2]; tmp = args[2];
while (*tmp) { while (*tmp) {
if (!isalnum(*tmp) && *tmp != '_' && *tmp != '.') { if (!isalnum(*tmp) && *tmp != '_' && *tmp != '.') {
Alert("parsing [%s:%d]: '%s %s' only supports [a-zA-Z_-.] chars.\n", ha_alert("parsing [%s:%d]: '%s %s' only supports [a-zA-Z_-.] chars.\n",
file, linenum, args[0], args[1]); file, linenum, args[0], args[1]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -3408,9 +3408,9 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
char *tmp; char *tmp;
if (!*args[2]) { if (!*args[2]) {
Alert("parsing [%s:%d]: '%s %s' expects a value.\n", ha_alert("parsing [%s:%d]: '%s %s' expects a value.\n",
file, linenum, args[0], file, linenum, args[0],
args[1]); args[1]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -3419,8 +3419,8 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
tmp = args[2]; tmp = args[2];
while (*tmp) { while (*tmp) {
if (!isalnum(*tmp) && *tmp != '_' && *tmp != '.') { if (!isalnum(*tmp) && *tmp != '_' && *tmp != '.') {
Alert("parsing [%s:%d]: '%s %s' only supports [a-zA-Z_-.] chars.\n", ha_alert("parsing [%s:%d]: '%s %s' only supports [a-zA-Z_-.] chars.\n",
file, linenum, args[0], args[1]); file, linenum, args[0], args[1]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -3429,16 +3429,16 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
curagent->var_on_error = strdup(args[2]); curagent->var_on_error = strdup(args[2]);
} }
else { else {
Alert("parsing [%s:%d]: option '%s' is not supported.\n", ha_alert("parsing [%s:%d]: option '%s' is not supported.\n",
file, linenum, args[1]); file, linenum, args[1]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
} }
else if (!strcmp(args[0], "maxconnrate")) { else if (!strcmp(args[0], "maxconnrate")) {
if (!*args[1]) { if (!*args[1]) {
Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", ha_alert("parsing [%s:%d] : '%s' expects an integer argument.\n",
file, linenum, args[0]); file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -3448,8 +3448,8 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
} }
else if (!strcmp(args[0], "maxerrrate")) { else if (!strcmp(args[0], "maxerrrate")) {
if (!*args[1]) { if (!*args[1]) {
Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", ha_alert("parsing [%s:%d] : '%s' expects an integer argument.\n",
file, linenum, args[0]); file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -3459,8 +3459,8 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
} }
else if (!strcmp(args[0], "max-frame-size")) { else if (!strcmp(args[0], "max-frame-size")) {
if (!*args[1]) { if (!*args[1]) {
Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", ha_alert("parsing [%s:%d] : '%s' expects an integer argument.\n",
file, linenum, args[0]); file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -3469,15 +3469,15 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
curagent->max_frame_size = atol(args[1]); curagent->max_frame_size = atol(args[1]);
if (curagent->max_frame_size < MIN_FRAME_SIZE || if (curagent->max_frame_size < MIN_FRAME_SIZE ||
curagent->max_frame_size > MAX_FRAME_SIZE) { curagent->max_frame_size > MAX_FRAME_SIZE) {
Alert("parsing [%s:%d] : '%s' expects a positive integer argument in the range [%d, %d].\n", ha_alert("parsing [%s:%d] : '%s' expects a positive integer argument in the range [%d, %d].\n",
file, linenum, args[0], MIN_FRAME_SIZE, MAX_FRAME_SIZE); file, linenum, args[0], MIN_FRAME_SIZE, MAX_FRAME_SIZE);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
} }
else if (*args[0]) { else if (*args[0]) {
Alert("parsing [%s:%d] : unknown keyword '%s' in spoe-agent section.\n", ha_alert("parsing [%s:%d] : unknown keyword '%s' in spoe-agent section.\n",
file, linenum, args[0]); file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -3498,8 +3498,8 @@ cfg_parse_spoe_group(const char *file, int linenum, char **args, int kwm)
if (!strcmp(args[0], "spoe-group")) { /* new spoe-group section */ if (!strcmp(args[0], "spoe-group")) { /* new spoe-group section */
if (!*args[1]) { if (!*args[1]) {
Alert("parsing [%s:%d] : missing name for spoe-group section.\n", ha_alert("parsing [%s:%d] : missing name for spoe-group section.\n",
file, linenum); file, linenum);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
goto out; goto out;
} }
@ -3510,24 +3510,24 @@ cfg_parse_spoe_group(const char *file, int linenum, char **args, int kwm)
err = invalid_char(args[1]); err = invalid_char(args[1]);
if (err) { if (err) {
Alert("parsing [%s:%d] : character '%c' is not permitted in '%s' name '%s'.\n", ha_alert("parsing [%s:%d] : character '%c' is not permitted in '%s' name '%s'.\n",
file, linenum, *err, args[0], args[1]); file, linenum, *err, args[0], args[1]);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
goto out; goto out;
} }
list_for_each_entry(grp, &curgrps, list) { list_for_each_entry(grp, &curgrps, list) {
if (!strcmp(grp->id, args[1])) { if (!strcmp(grp->id, args[1])) {
Alert("parsing [%s:%d]: spoe-group section '%s' has the same" ha_alert("parsing [%s:%d]: spoe-group section '%s' has the same"
" name as another one declared at %s:%d.\n", " name as another one declared at %s:%d.\n",
file, linenum, args[1], grp->conf.file, grp->conf.line); file, linenum, args[1], grp->conf.file, grp->conf.line);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
} }
if ((curgrp = calloc(1, sizeof(*curgrp))) == NULL) { if ((curgrp = calloc(1, sizeof(*curgrp))) == NULL) {
Alert("parsing [%s:%d] : out of memory.\n", file, linenum); ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
goto out; goto out;
} }
@ -3546,15 +3546,15 @@ cfg_parse_spoe_group(const char *file, int linenum, char **args, int kwm)
list_for_each_entry(ph, &curgrp->phs, list) { list_for_each_entry(ph, &curgrp->phs, list) {
if (!strcmp(ph->id, args[cur_arg])) { if (!strcmp(ph->id, args[cur_arg])) {
Alert("parsing [%s:%d]: spoe-message '%s' already used.\n", ha_alert("parsing [%s:%d]: spoe-message '%s' already used.\n",
file, linenum, args[cur_arg]); file, linenum, args[cur_arg]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
} }
if ((ph = calloc(1, sizeof(*ph))) == NULL) { if ((ph = calloc(1, sizeof(*ph))) == NULL) {
Alert("parsing [%s:%d] : out of memory.\n", file, linenum); ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
goto out; goto out;
} }
@ -3564,8 +3564,8 @@ cfg_parse_spoe_group(const char *file, int linenum, char **args, int kwm)
} }
} }
else if (*args[0]) { else if (*args[0]) {
Alert("parsing [%s:%d] : unknown keyword '%s' in spoe-group section.\n", ha_alert("parsing [%s:%d] : unknown keyword '%s' in spoe-group section.\n",
file, linenum, args[0]); file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -3589,8 +3589,8 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm)
if (!strcmp(args[0], "spoe-message")) { /* new spoe-message section */ if (!strcmp(args[0], "spoe-message")) { /* new spoe-message section */
if (!*args[1]) { if (!*args[1]) {
Alert("parsing [%s:%d] : missing name for spoe-message section.\n", ha_alert("parsing [%s:%d] : missing name for spoe-message section.\n",
file, linenum); file, linenum);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
goto out; goto out;
} }
@ -3601,24 +3601,24 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm)
err = invalid_char(args[1]); err = invalid_char(args[1]);
if (err) { if (err) {
Alert("parsing [%s:%d] : character '%c' is not permitted in '%s' name '%s'.\n", ha_alert("parsing [%s:%d] : character '%c' is not permitted in '%s' name '%s'.\n",
file, linenum, *err, args[0], args[1]); file, linenum, *err, args[0], args[1]);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
goto out; goto out;
} }
list_for_each_entry(msg, &curmsgs, list) { list_for_each_entry(msg, &curmsgs, list) {
if (!strcmp(msg->id, args[1])) { if (!strcmp(msg->id, args[1])) {
Alert("parsing [%s:%d]: spoe-message section '%s' has the same" ha_alert("parsing [%s:%d]: spoe-message section '%s' has the same"
" name as another one declared at %s:%d.\n", " name as another one declared at %s:%d.\n",
file, linenum, args[1], msg->conf.file, msg->conf.line); file, linenum, args[1], msg->conf.file, msg->conf.line);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
} }
if ((curmsg = calloc(1, sizeof(*curmsg))) == NULL) { if ((curmsg = calloc(1, sizeof(*curmsg))) == NULL) {
Alert("parsing [%s:%d] : out of memory.\n", file, linenum); ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
goto out; goto out;
} }
@ -3646,7 +3646,7 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm)
int idx = 0; int idx = 0;
if ((arg = calloc(1, sizeof(*arg))) == NULL) { if ((arg = calloc(1, sizeof(*arg))) == NULL) {
Alert("parsing [%s:%d] : out of memory.\n", file, linenum); ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
goto out; goto out;
} }
@ -3665,7 +3665,7 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm)
&idx, file, linenum, &errmsg, &idx, file, linenum, &errmsg,
&curproxy->conf.args); &curproxy->conf.args);
if (arg->expr == NULL) { if (arg->expr == NULL) {
Alert("parsing [%s:%d] : '%s': %s.\n", file, linenum, args[0], errmsg); ha_alert("parsing [%s:%d] : '%s': %s.\n", file, linenum, args[0], errmsg);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
free(arg->name); free(arg->name);
free(arg); free(arg);
@ -3681,21 +3681,21 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm)
else if (!strcmp(args[0], "acl")) { else if (!strcmp(args[0], "acl")) {
err = invalid_char(args[1]); err = invalid_char(args[1]);
if (err) { if (err) {
Alert("parsing [%s:%d] : character '%c' is not permitted in acl name '%s'.\n", ha_alert("parsing [%s:%d] : character '%c' is not permitted in acl name '%s'.\n",
file, linenum, *err, args[1]); file, linenum, *err, args[1]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
if (parse_acl((const char **)args + 1, &curmsg->acls, &errmsg, &curproxy->conf.args, file, linenum) == NULL) { if (parse_acl((const char **)args + 1, &curmsg->acls, &errmsg, &curproxy->conf.args, file, linenum) == NULL) {
Alert("parsing [%s:%d] : error detected while parsing ACL '%s' : %s.\n", ha_alert("parsing [%s:%d] : error detected while parsing ACL '%s' : %s.\n",
file, linenum, args[1], errmsg); file, linenum, args[1], errmsg);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
} }
else if (!strcmp(args[0], "event")) { else if (!strcmp(args[0], "event")) {
if (!*args[1]) { if (!*args[1]) {
Alert("parsing [%s:%d] : missing event name.\n", file, linenum); ha_alert("parsing [%s:%d] : missing event name.\n", file, linenum);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -3721,8 +3721,8 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm)
else if (!strcmp(args[1], spoe_event_str[SPOE_EV_ON_HTTP_RSP])) else if (!strcmp(args[1], spoe_event_str[SPOE_EV_ON_HTTP_RSP]))
curmsg->event = SPOE_EV_ON_HTTP_RSP; curmsg->event = SPOE_EV_ON_HTTP_RSP;
else { else {
Alert("parsing [%s:%d] : unkown event '%s'.\n", ha_alert("parsing [%s:%d] : unkown event '%s'.\n",
file, linenum, args[1]); file, linenum, args[1]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -3734,25 +3734,25 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm)
curproxy, (const char **)args+2, curproxy, (const char **)args+2,
&errmsg); &errmsg);
if (cond == NULL) { if (cond == NULL) {
Alert("parsing [%s:%d] : error detected while " ha_alert("parsing [%s:%d] : error detected while "
"parsing an 'event %s' condition : %s.\n", "parsing an 'event %s' condition : %s.\n",
file, linenum, args[1], errmsg); file, linenum, args[1], errmsg);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
curmsg->cond = cond; curmsg->cond = cond;
} }
else if (*args[2]) { else if (*args[2]) {
Alert("parsing [%s:%d]: 'event %s' expects either 'if' " ha_alert("parsing [%s:%d]: 'event %s' expects either 'if' "
"or 'unless' followed by a condition but found '%s'.\n", "or 'unless' followed by a condition but found '%s'.\n",
file, linenum, args[1], args[2]); file, linenum, args[1], args[2]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
} }
else if (!*args[0]) { else if (!*args[0]) {
Alert("parsing [%s:%d] : unknown keyword '%s' in spoe-message section.\n", ha_alert("parsing [%s:%d] : unknown keyword '%s' in spoe-message section.\n",
file, linenum, args[0]); file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -3856,11 +3856,11 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
if (curagent->timeout.hello == TICK_ETERNITY || if (curagent->timeout.hello == TICK_ETERNITY ||
curagent->timeout.idle == TICK_ETERNITY || curagent->timeout.idle == TICK_ETERNITY ||
curagent->timeout.processing == TICK_ETERNITY) { curagent->timeout.processing == TICK_ETERNITY) {
Warning("Proxy '%s': missing timeouts for SPOE agent '%s' declare at %s:%d.\n" ha_warning("Proxy '%s': missing timeouts for SPOE agent '%s' declare at %s:%d.\n"
" | While not properly invalid, you will certainly encounter various problems\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" " | with such a configuration. To fix this, please ensure that all following\n"
" | timeouts are set to a non-zero value: 'hello', 'idle', 'processing'.\n", " | timeouts are set to a non-zero value: 'hello', 'idle', 'processing'.\n",
px->id, curagent->id, curagent->conf.file, curagent->conf.line); px->id, curagent->id, curagent->conf.file, curagent->conf.line);
} }
if (curagent->var_pfx == NULL) { if (curagent->var_pfx == NULL) {
char *tmp = curagent->id; char *tmp = curagent->id;
@ -3880,8 +3880,8 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
curagent->engine_id = generate_pseudo_uuid(); curagent->engine_id = generate_pseudo_uuid();
if (LIST_ISEMPTY(&curmphs) && LIST_ISEMPTY(&curgphs)) { if (LIST_ISEMPTY(&curmphs) && LIST_ISEMPTY(&curgphs)) {
Warning("Proxy '%s': No message/group used by SPOE agent '%s' declared at %s:%d.\n", ha_warning("Proxy '%s': No message/group used by SPOE agent '%s' declared at %s:%d.\n",
px->id, curagent->id, curagent->conf.file, curagent->conf.line); px->id, curagent->id, curagent->conf.file, curagent->conf.line);
goto finish; goto finish;
} }
@ -3902,13 +3902,13 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
if (!(px->cap & PR_CAP_FE) && (msg->event == SPOE_EV_ON_CLIENT_SESS || if (!(px->cap & PR_CAP_FE) && (msg->event == SPOE_EV_ON_CLIENT_SESS ||
msg->event == SPOE_EV_ON_TCP_REQ_FE || msg->event == SPOE_EV_ON_TCP_REQ_FE ||
msg->event == SPOE_EV_ON_HTTP_REQ_FE)) { msg->event == SPOE_EV_ON_HTTP_REQ_FE)) {
Warning("Proxy '%s': frontend event used on a backend proxy at %s:%d.\n", ha_warning("Proxy '%s': frontend event used on a backend proxy at %s:%d.\n",
px->id, msg->conf.file, msg->conf.line); px->id, msg->conf.file, msg->conf.line);
goto next_mph; goto next_mph;
} }
if (msg->event == SPOE_EV_NONE) { if (msg->event == SPOE_EV_NONE) {
Warning("Proxy '%s': Ignore SPOE message '%s' without event at %s:%d.\n", ha_warning("Proxy '%s': Ignore SPOE message '%s' without event at %s:%d.\n",
px->id, msg->id, msg->conf.file, msg->conf.line); px->id, msg->id, msg->conf.file, msg->conf.line);
goto next_mph; goto next_mph;
} }

View File

@ -685,14 +685,14 @@ static void mworker_reload()
next_argv[next_argc++] = NULL; next_argv[next_argc++] = NULL;
} }
Warning("Reexecuting Master process\n"); ha_warning("Reexecuting Master process\n");
execvp(next_argv[0], next_argv); execvp(next_argv[0], next_argv);
Warning("Failed to reexecute the master process [%d]: %s\n", pid, strerror(errno)); ha_warning("Failed to reexecute the master process [%d]: %s\n", pid, strerror(errno));
return; return;
alloc_error: alloc_error:
Warning("Failed to reexecute the master processs [%d]: Cannot allocate memory\n", pid); ha_warning("Failed to reexecute the master processs [%d]: Cannot allocate memory\n", pid);
return; return;
} }
@ -730,7 +730,7 @@ static void mworker_wait()
sd_notify(0, "STOPPING=1"); sd_notify(0, "STOPPING=1");
} }
#endif #endif
Warning("Exiting Master process...\n"); ha_warning("Exiting Master process...\n");
mworker_kill(sig); mworker_kill(sig);
mworker_unregister_signals(); mworker_unregister_signals();
} }
@ -738,7 +738,7 @@ static void mworker_wait()
} }
if (exitpid == -1 && errno == ECHILD) { if (exitpid == -1 && errno == ECHILD) {
Warning("All workers are left. Leaving... (%d)\n", status); ha_warning("All workers are left. Leaving... (%d)\n", status);
atexit_flag = 0; atexit_flag = 0;
exit(status); /* parent must leave using the latest status code known */ exit(status); /* parent must leave using the latest status code known */
} }
@ -753,18 +753,18 @@ static void mworker_wait()
status = 255; status = 255;
if (!children) { if (!children) {
Warning("Worker %d left with exit code %d\n", exitpid, status); ha_warning("Worker %d left with exit code %d\n", exitpid, status);
} else { } else {
/* check if exited child was in the current children list */ /* check if exited child was in the current children list */
if (current_child(exitpid)) { if (current_child(exitpid)) {
Alert("Current worker %d left with exit code %d\n", exitpid, status); ha_alert("Current worker %d left with exit code %d\n", exitpid, status);
if (status != 0 && status != 130 && status != 143 if (status != 0 && status != 130 && status != 143
&& global.tune.options & GTUNE_EXIT_ONFAILURE) { && global.tune.options & GTUNE_EXIT_ONFAILURE) {
Alert("exit-on-failure: killing every workers with SIGTERM\n"); ha_alert("exit-on-failure: killing every workers with SIGTERM\n");
mworker_kill(SIGTERM); mworker_kill(SIGTERM);
} }
} else { } else {
Warning("Former worker %d left with exit code %d\n", exitpid, status); ha_warning("Former worker %d left with exit code %d\n", exitpid, status);
delete_oldpid(exitpid); delete_oldpid(exitpid);
} }
} }
@ -782,7 +782,7 @@ void reexec_on_failure()
setenv("HAPROXY_MWORKER_WAIT_ONLY", "1", 1); setenv("HAPROXY_MWORKER_WAIT_ONLY", "1", 1);
Warning("Reexecuting Master process in waitpid mode\n"); ha_warning("Reexecuting Master process in waitpid mode\n");
mworker_reload(); mworker_reload();
} }
@ -823,7 +823,7 @@ static void sig_dump_state(struct sig_handler *sh)
{ {
struct proxy *p = proxy; struct proxy *p = proxy;
Warning("SIGHUP received, dumping servers states.\n"); ha_warning("SIGHUP received, dumping servers states.\n");
while (p) { while (p) {
struct server *s = p->srv; struct server *s = p->srv;
@ -834,7 +834,7 @@ static void sig_dump_state(struct sig_handler *sh)
p->id, s->id, p->id, s->id,
(s->cur_state != SRV_ST_STOPPED) ? "UP" : "DOWN", (s->cur_state != SRV_ST_STOPPED) ? "UP" : "DOWN",
s->cur_sess, s->nbpend, s->counters.cum_sess); s->cur_sess, s->nbpend, s->counters.cum_sess);
Warning("%s\n", trash.str); ha_warning("%s\n", trash.str);
send_log(p, LOG_NOTICE, "%s\n", trash.str); send_log(p, LOG_NOTICE, "%s\n", trash.str);
s = s->next; s = s->next;
} }
@ -858,7 +858,7 @@ static void sig_dump_state(struct sig_handler *sh)
p->id, p->srv_act, p->srv_bck, p->id, p->srv_act, p->srv_bck,
p->feconn, p->beconn, p->totpend, p->nbpend, p->fe_counters.cum_conn, p->be_counters.cum_conn); p->feconn, p->beconn, p->totpend, p->nbpend, p->fe_counters.cum_conn, p->be_counters.cum_conn);
} }
Warning("%s\n", trash.str); ha_warning("%s\n", trash.str);
send_log(p, LOG_NOTICE, "%s\n", trash.str); send_log(p, LOG_NOTICE, "%s\n", trash.str);
p = p->next; p = p->next;
@ -891,9 +891,9 @@ static void cfgfiles_expand_directories(void)
int dir_entries_it; int dir_entries_it;
if (stat(wl->s, &file_stat)) { if (stat(wl->s, &file_stat)) {
Alert("Cannot open configuration file/directory %s : %s\n", ha_alert("Cannot open configuration file/directory %s : %s\n",
wl->s, wl->s,
strerror(errno)); strerror(errno));
exit(1); exit(1);
} }
@ -904,9 +904,9 @@ static void cfgfiles_expand_directories(void)
dir_entries_nb = scandir(wl->s, &dir_entries, NULL, alphasort); dir_entries_nb = scandir(wl->s, &dir_entries, NULL, alphasort);
if (dir_entries_nb < 0) { if (dir_entries_nb < 0) {
Alert("Cannot open configuration directory %s : %s\n", ha_alert("Cannot open configuration directory %s : %s\n",
wl->s, wl->s,
strerror(errno)); strerror(errno));
exit(1); exit(1);
} }
@ -924,15 +924,15 @@ static void cfgfiles_expand_directories(void)
goto next_dir_entry; goto next_dir_entry;
if (!memprintf(&filename, "%s/%s", wl->s, dir_entry->d_name)) { if (!memprintf(&filename, "%s/%s", wl->s, dir_entry->d_name)) {
Alert("Cannot load configuration files %s : out of memory.\n", ha_alert("Cannot load configuration files %s : out of memory.\n",
filename); filename);
exit(1); exit(1);
} }
if (stat(filename, &file_stat)) { if (stat(filename, &file_stat)) {
Alert("Cannot open configuration file %s : %s\n", ha_alert("Cannot open configuration file %s : %s\n",
wl->s, wl->s,
strerror(errno)); strerror(errno));
exit(1); exit(1);
} }
@ -943,9 +943,9 @@ static void cfgfiles_expand_directories(void)
goto next_dir_entry; goto next_dir_entry;
if (!list_append_word(&wl->list, filename, &err)) { if (!list_append_word(&wl->list, filename, &err)) {
Alert("Cannot load configuration files %s : %s\n", ha_alert("Cannot load configuration files %s : %s\n",
filename, filename,
err); err);
exit(1); exit(1);
} }
@ -986,13 +986,13 @@ static int get_old_sockets(const char *unixsocket)
memset(&msghdr, 0, sizeof(msghdr)); memset(&msghdr, 0, sizeof(msghdr));
cmsgbuf = malloc(CMSG_SPACE(sizeof(int)) * MAX_SEND_FD); cmsgbuf = malloc(CMSG_SPACE(sizeof(int)) * MAX_SEND_FD);
if (!cmsgbuf) { if (!cmsgbuf) {
Warning("Failed to allocate memory to send sockets\n"); ha_warning("Failed to allocate memory to send sockets\n");
goto out; goto out;
} }
sock = socket(PF_UNIX, SOCK_STREAM, 0); sock = socket(PF_UNIX, SOCK_STREAM, 0);
if (sock < 0) { if (sock < 0) {
Warning("Failed to connect to the old process socket '%s'\n", ha_warning("Failed to connect to the old process socket '%s'\n",
unixsocket); unixsocket);
goto out; goto out;
} }
strncpy(addr.sun_path, unixsocket, sizeof(addr.sun_path)); strncpy(addr.sun_path, unixsocket, sizeof(addr.sun_path));
@ -1000,8 +1000,8 @@ static int get_old_sockets(const char *unixsocket)
addr.sun_family = PF_UNIX; addr.sun_family = PF_UNIX;
ret = connect(sock, (struct sockaddr *)&addr, sizeof(addr)); ret = connect(sock, (struct sockaddr *)&addr, sizeof(addr));
if (ret < 0) { if (ret < 0) {
Warning("Failed to connect to the old process socket '%s'\n", ha_warning("Failed to connect to the old process socket '%s'\n",
unixsocket); unixsocket);
goto out; goto out;
} }
setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (void *)&tv, sizeof(tv)); setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (void *)&tv, sizeof(tv));
@ -1012,7 +1012,7 @@ static int get_old_sockets(const char *unixsocket)
send(sock, "_getsocks\n", strlen("_getsocks\n"), 0); send(sock, "_getsocks\n", strlen("_getsocks\n"), 0);
/* First, get the number of file descriptors to be received */ /* First, get the number of file descriptors to be received */
if (recvmsg(sock, &msghdr, MSG_WAITALL) != sizeof(fd_nb)) { if (recvmsg(sock, &msghdr, MSG_WAITALL) != sizeof(fd_nb)) {
Warning("Failed to get the number of sockets to be transferred !\n"); ha_warning("Failed to get the number of sockets to be transferred !\n");
goto out; goto out;
} }
if (fd_nb == 0) { if (fd_nb == 0) {
@ -1021,12 +1021,12 @@ static int get_old_sockets(const char *unixsocket)
} }
tmpbuf = malloc(fd_nb * (1 + MAXPATHLEN + 1 + IFNAMSIZ + sizeof(int))); tmpbuf = malloc(fd_nb * (1 + MAXPATHLEN + 1 + IFNAMSIZ + sizeof(int)));
if (tmpbuf == NULL) { if (tmpbuf == NULL) {
Warning("Failed to allocate memory while receiving sockets\n"); ha_warning("Failed to allocate memory while receiving sockets\n");
goto out; goto out;
} }
tmpfd = malloc(fd_nb * sizeof(int)); tmpfd = malloc(fd_nb * sizeof(int));
if (tmpfd == NULL) { if (tmpfd == NULL) {
Warning("Failed to allocate memory while receiving sockets\n"); ha_warning("Failed to allocate memory while receiving sockets\n");
goto out; goto out;
} }
msghdr.msg_control = cmsgbuf; msghdr.msg_control = cmsgbuf;
@ -1054,7 +1054,7 @@ static int get_old_sockets(const char *unixsocket)
size_t totlen = cmsg->cmsg_len - size_t totlen = cmsg->cmsg_len -
CMSG_LEN(0); CMSG_LEN(0);
if (totlen / sizeof(int) + got_fd > fd_nb) { if (totlen / sizeof(int) + got_fd > fd_nb) {
Warning("Got to many sockets !\n"); ha_warning("Got to many sockets !\n");
goto out; goto out;
} }
/* /*
@ -1069,8 +1069,8 @@ static int get_old_sockets(const char *unixsocket)
} while (got_fd < fd_nb); } while (got_fd < fd_nb);
if (got_fd != fd_nb) { if (got_fd != fd_nb) {
Warning("We didn't get the expected number of sockets (expecting %d got %d)\n", ha_warning("We didn't get the expected number of sockets (expecting %d got %d)\n",
fd_nb, got_fd); fd_nb, got_fd);
goto out; goto out;
} }
maxoff = curoff; maxoff = curoff;
@ -1082,32 +1082,32 @@ static int get_old_sockets(const char *unixsocket)
xfer_sock = calloc(1, sizeof(*xfer_sock)); xfer_sock = calloc(1, sizeof(*xfer_sock));
if (!xfer_sock) { if (!xfer_sock) {
Warning("Failed to allocate memory in get_old_sockets() !\n"); ha_warning("Failed to allocate memory in get_old_sockets() !\n");
break; break;
} }
xfer_sock->fd = -1; xfer_sock->fd = -1;
socklen = sizeof(xfer_sock->addr); socklen = sizeof(xfer_sock->addr);
if (getsockname(fd, (struct sockaddr *)&xfer_sock->addr, &socklen) != 0) { if (getsockname(fd, (struct sockaddr *)&xfer_sock->addr, &socklen) != 0) {
Warning("Failed to get socket address\n"); ha_warning("Failed to get socket address\n");
free(xfer_sock); free(xfer_sock);
xfer_sock = NULL; xfer_sock = NULL;
continue; continue;
} }
if (curoff >= maxoff) { if (curoff >= maxoff) {
Warning("Inconsistency while transferring sockets\n"); ha_warning("Inconsistency while transferring sockets\n");
goto out; goto out;
} }
len = tmpbuf[curoff++]; len = tmpbuf[curoff++];
if (len > 0) { if (len > 0) {
/* We have a namespace */ /* We have a namespace */
if (curoff + len > maxoff) { if (curoff + len > maxoff) {
Warning("Inconsistency while transferring sockets\n"); ha_warning("Inconsistency while transferring sockets\n");
goto out; goto out;
} }
xfer_sock->namespace = malloc(len + 1); xfer_sock->namespace = malloc(len + 1);
if (!xfer_sock->namespace) { if (!xfer_sock->namespace) {
Warning("Failed to allocate memory while transferring sockets\n"); ha_warning("Failed to allocate memory while transferring sockets\n");
goto out; goto out;
} }
memcpy(xfer_sock->namespace, &tmpbuf[curoff], len); memcpy(xfer_sock->namespace, &tmpbuf[curoff], len);
@ -1115,19 +1115,19 @@ static int get_old_sockets(const char *unixsocket)
curoff += len; curoff += len;
} }
if (curoff >= maxoff) { if (curoff >= maxoff) {
Warning("Inconsistency while transferring sockets\n"); ha_warning("Inconsistency while transferring sockets\n");
goto out; goto out;
} }
len = tmpbuf[curoff++]; len = tmpbuf[curoff++];
if (len > 0) { if (len > 0) {
/* We have an interface */ /* We have an interface */
if (curoff + len > maxoff) { if (curoff + len > maxoff) {
Warning("Inconsistency while transferring sockets\n"); ha_warning("Inconsistency while transferring sockets\n");
goto out; goto out;
} }
xfer_sock->iface = malloc(len + 1); xfer_sock->iface = malloc(len + 1);
if (!xfer_sock->iface) { if (!xfer_sock->iface) {
Warning("Failed to allocate memory while transferring sockets\n"); ha_warning("Failed to allocate memory while transferring sockets\n");
goto out; goto out;
} }
memcpy(xfer_sock->iface, &tmpbuf[curoff], len); memcpy(xfer_sock->iface, &tmpbuf[curoff], len);
@ -1135,7 +1135,7 @@ static int get_old_sockets(const char *unixsocket)
curoff += len; curoff += len;
} }
if (curoff + sizeof(int) > maxoff) { if (curoff + sizeof(int) > maxoff) {
Warning("Inconsistency while transferring sockets\n"); ha_warning("Inconsistency while transferring sockets\n");
goto out; goto out;
} }
memcpy(&xfer_sock->options, &tmpbuf[curoff], memcpy(&xfer_sock->options, &tmpbuf[curoff],
@ -1189,7 +1189,7 @@ static char **copy_argv(int argc, char **argv)
newargv = calloc(argc + 2, sizeof(char *)); newargv = calloc(argc + 2, sizeof(char *));
if (newargv == NULL) { if (newargv == NULL) {
Warning("Cannot allocate memory\n"); ha_warning("Cannot allocate memory\n");
return NULL; return NULL;
} }
@ -1231,7 +1231,7 @@ static void init(int argc, char **argv)
next_argv = copy_argv(argc, argv); next_argv = copy_argv(argc, argv);
if (!init_trash_buffers(1)) { if (!init_trash_buffers(1)) {
Alert("failed to initialize trash buffers.\n"); ha_alert("failed to initialize trash buffers.\n");
exit(1); exit(1);
} }
@ -1367,7 +1367,7 @@ static void init(int argc, char **argv)
#if defined(USE_SYSTEMD) #if defined(USE_SYSTEMD)
global.tune.options |= GTUNE_USE_SYSTEMD; global.tune.options |= GTUNE_USE_SYSTEMD;
#else #else
Alert("master-worker mode with systemd support (-Ws) requested, but not compiled. Use master-worker mode (-W) if you are not using Type=notify in your unit file or recompile with USE_SYSTEMD=1.\n\n"); ha_alert("master-worker mode with systemd support (-Ws) requested, but not compiled. Use master-worker mode (-W) if you are not using Type=notify in your unit file or recompile with USE_SYSTEMD=1.\n\n");
usage(progname); usage(progname);
#endif #endif
} }
@ -1377,11 +1377,11 @@ static void init(int argc, char **argv)
arg_mode |= MODE_QUIET; arg_mode |= MODE_QUIET;
else if (*flag == 'x') { else if (*flag == 'x') {
if (argc <= 1 || argv[1][0] == '-') { if (argc <= 1 || argv[1][0] == '-') {
Alert("Unix socket path expected with the -x flag\n\n"); ha_alert("Unix socket path expected with the -x flag\n\n");
usage(progname); usage(progname);
} }
if (old_unixsocket) if (old_unixsocket)
Warning("-x option already set, overwriting the value\n"); ha_warning("-x option already set, overwriting the value\n");
old_unixsocket = argv[1]; old_unixsocket = argv[1];
argv++; argv++;
@ -1397,7 +1397,7 @@ static void init(int argc, char **argv)
while (argc > 1 && argv[1][0] != '-') { while (argc > 1 && argv[1][0] != '-') {
oldpids = realloc(oldpids, (nb_oldpids + 1) * sizeof(int)); oldpids = realloc(oldpids, (nb_oldpids + 1) * sizeof(int));
if (!oldpids) { if (!oldpids) {
Alert("Cannot allocate old pid : out of memory.\n"); ha_alert("Cannot allocate old pid : out of memory.\n");
exit(1); exit(1);
} }
argc--; argv++; argc--; argv++;
@ -1412,9 +1412,9 @@ static void init(int argc, char **argv)
argv++; argc--; argv++; argc--;
while (argc > 0) { while (argc > 0) {
if (!list_append_word(&cfg_cfgfiles, *argv, &err_msg)) { if (!list_append_word(&cfg_cfgfiles, *argv, &err_msg)) {
Alert("Cannot load configuration file/directory %s : %s\n", ha_alert("Cannot load configuration file/directory %s : %s\n",
*argv, *argv,
err_msg); err_msg);
exit(1); exit(1);
} }
argv++; argc--; argv++; argc--;
@ -1434,9 +1434,9 @@ static void init(int argc, char **argv)
case 'L' : strncpy(localpeer, *argv, sizeof(localpeer) - 1); break; case 'L' : strncpy(localpeer, *argv, sizeof(localpeer) - 1); break;
case 'f' : case 'f' :
if (!list_append_word(&cfg_cfgfiles, *argv, &err_msg)) { if (!list_append_word(&cfg_cfgfiles, *argv, &err_msg)) {
Alert("Cannot load configuration file/directory %s : %s\n", ha_alert("Cannot load configuration file/directory %s : %s\n",
*argv, *argv,
err_msg); err_msg);
exit(1); exit(1);
} }
break; break;
@ -1466,7 +1466,7 @@ static void init(int argc, char **argv)
} }
if (change_dir && chdir(change_dir) < 0) { if (change_dir && chdir(change_dir) < 0) {
Alert("Could not change to directory %s : %s\n", change_dir, strerror(errno)); ha_alert("Could not change to directory %s : %s\n", change_dir, strerror(errno));
exit(1); exit(1);
} }
@ -1485,12 +1485,12 @@ static void init(int argc, char **argv)
ret = readcfgfile(wl->s); ret = readcfgfile(wl->s);
if (ret == -1) { if (ret == -1) {
Alert("Could not open configuration file %s : %s\n", ha_alert("Could not open configuration file %s : %s\n",
wl->s, strerror(errno)); wl->s, strerror(errno));
exit(1); exit(1);
} }
if (ret & (ERR_ABORT|ERR_FATAL)) if (ret & (ERR_ABORT|ERR_FATAL))
Alert("Error(s) found in configuration file : %s\n", wl->s); ha_alert("Error(s) found in configuration file : %s\n", wl->s);
err_code |= ret; err_code |= ret;
if (err_code & ERR_ABORT) if (err_code & ERR_ABORT)
exit(1); exit(1);
@ -1501,7 +1501,7 @@ static void init(int argc, char **argv)
* or failed memory allocations. * or failed memory allocations.
*/ */
if (err_code & (ERR_ABORT|ERR_FATAL)) { if (err_code & (ERR_ABORT|ERR_FATAL)) {
Alert("Fatal errors found in configuration.\n"); ha_alert("Fatal errors found in configuration.\n");
exit(1); exit(1);
} }
@ -1509,7 +1509,7 @@ static void init(int argc, char **argv)
err_code |= check_config_validity(); err_code |= check_config_validity();
if (err_code & (ERR_ABORT|ERR_FATAL)) { if (err_code & (ERR_ABORT|ERR_FATAL)) {
Alert("Fatal errors found in configuration.\n"); ha_alert("Fatal errors found in configuration.\n");
exit(1); exit(1);
} }
@ -1532,7 +1532,7 @@ static void init(int argc, char **argv)
#ifdef CONFIG_HAP_NS #ifdef CONFIG_HAP_NS
err_code |= netns_init(); err_code |= netns_init();
if (err_code & (ERR_ABORT|ERR_FATAL)) { if (err_code & (ERR_ABORT|ERR_FATAL)) {
Alert("Failed to initialize namespace support.\n"); ha_alert("Failed to initialize namespace support.\n");
exit(1); exit(1);
} }
#endif #endif
@ -1546,7 +1546,7 @@ static void init(int argc, char **argv)
/* Apply servers' configured address */ /* Apply servers' configured address */
err_code |= srv_init_addr(); err_code |= srv_init_addr();
if (err_code & (ERR_ABORT|ERR_FATAL)) { if (err_code & (ERR_ABORT|ERR_FATAL)) {
Alert("Failed to initialize server(s) addr.\n"); ha_alert("Failed to initialize server(s) addr.\n");
exit(1); exit(1);
} }
@ -1573,7 +1573,7 @@ static void init(int argc, char **argv)
global_listener_queue_task = task_new(MAX_THREADS_MASK); global_listener_queue_task = task_new(MAX_THREADS_MASK);
if (!global_listener_queue_task) { if (!global_listener_queue_task) {
Alert("Out of memory when initializing global task\n"); ha_alert("Out of memory when initializing global task\n");
exit(1); exit(1);
} }
/* very simple initialization, users will queue the task if needed */ /* very simple initialization, users will queue the task if needed */
@ -1679,12 +1679,12 @@ static void init(int argc, char **argv)
global.maxsslconn = round_2dig(global.maxsslconn); global.maxsslconn = round_2dig(global.maxsslconn);
if (sslmem <= 0 || global.maxsslconn < sides) { if (sslmem <= 0 || global.maxsslconn < sides) {
Alert("Cannot compute the automatic maxsslconn because global.maxconn is already too " ha_alert("Cannot compute the automatic maxsslconn because global.maxconn is already too "
"high for the global.memmax value (%d MB). The absolute maximum possible value " "high for the global.memmax value (%d MB). The absolute maximum possible value "
"without SSL is %d, but %d was found and SSL is in use.\n", "without SSL is %d, but %d was found and SSL is in use.\n",
global.rlimit_memmax, global.rlimit_memmax,
(int)(mem / (STREAM_MAX_COST + 2 * global.tune.bufsize)), (int)(mem / (STREAM_MAX_COST + 2 * global.tune.bufsize)),
global.maxconn); global.maxconn);
exit(1); exit(1);
} }
@ -1719,12 +1719,12 @@ static void init(int argc, char **argv)
#endif /* SYSTEM_MAXCONN */ #endif /* SYSTEM_MAXCONN */
if (clearmem <= 0 || !global.maxconn) { if (clearmem <= 0 || !global.maxconn) {
Alert("Cannot compute the automatic maxconn because global.maxsslconn is already too " ha_alert("Cannot compute the automatic maxconn because global.maxsslconn is already too "
"high for the global.memmax value (%d MB). The absolute maximum possible value " "high for the global.memmax value (%d MB). The absolute maximum possible value "
"is %d, but %d was found.\n", "is %d, but %d was found.\n",
global.rlimit_memmax, global.rlimit_memmax,
(int)(mem / (global.ssl_session_max_cost + global.ssl_handshake_max_cost)), (int)(mem / (global.ssl_session_max_cost + global.ssl_handshake_max_cost)),
global.maxsslconn); global.maxsslconn);
exit(1); exit(1);
} }
@ -1803,13 +1803,13 @@ static void init(int argc, char **argv)
global.mode |= (arg_mode & (MODE_QUIET | MODE_VERBOSE)); global.mode |= (arg_mode & (MODE_QUIET | MODE_VERBOSE));
if ((global.mode & MODE_DEBUG) && (global.mode & (MODE_DAEMON | MODE_QUIET))) { if ((global.mode & MODE_DEBUG) && (global.mode & (MODE_DAEMON | MODE_QUIET))) {
Warning("<debug> mode incompatible with <quiet> and <daemon>. Keeping <debug> only.\n"); ha_warning("<debug> mode incompatible with <quiet> and <daemon>. Keeping <debug> only.\n");
global.mode &= ~(MODE_DAEMON | MODE_QUIET); global.mode &= ~(MODE_DAEMON | MODE_QUIET);
} }
if ((global.nbproc > 1) && !(global.mode & (MODE_DAEMON | MODE_MWORKER))) { if ((global.nbproc > 1) && !(global.mode & (MODE_DAEMON | MODE_MWORKER))) {
if (!(global.mode & (MODE_FOREGROUND | MODE_DEBUG))) if (!(global.mode & (MODE_FOREGROUND | MODE_DEBUG)))
Warning("<nbproc> is only meaningful in daemon mode or master-worker mode. Setting limit to 1 process.\n"); ha_warning("<nbproc> is only meaningful in daemon mode or master-worker mode. Setting limit to 1 process.\n");
global.nbproc = 1; global.nbproc = 1;
} }
@ -1821,12 +1821,12 @@ static void init(int argc, char **argv)
/* Realloc trash buffers because global.tune.bufsize may have changed */ /* Realloc trash buffers because global.tune.bufsize may have changed */
if (!init_trash_buffers(0)) { if (!init_trash_buffers(0)) {
Alert("failed to initialize trash buffers.\n"); ha_alert("failed to initialize trash buffers.\n");
exit(1); exit(1);
} }
if (!init_log_buffers()) { if (!init_log_buffers()) {
Alert("failed to initialize log buffers.\n"); ha_alert("failed to initialize log buffers.\n");
exit(1); exit(1);
} }
@ -1856,16 +1856,16 @@ static void init(int argc, char **argv)
} }
if (!init_pollers()) { if (!init_pollers()) {
Alert("No polling mechanism available.\n" ha_alert("No polling mechanism available.\n"
" It is likely that haproxy was built with TARGET=generic and that FD_SETSIZE\n" " It is likely that haproxy was built with TARGET=generic and that FD_SETSIZE\n"
" is too low on this platform to support maxconn and the number of listeners\n" " is too low on this platform to support maxconn and the number of listeners\n"
" and servers. You should rebuild haproxy specifying your system using TARGET=\n" " and servers. You should rebuild haproxy specifying your system using TARGET=\n"
" in order to support other polling systems (poll, epoll, kqueue) or reduce the\n" " in order to support other polling systems (poll, epoll, kqueue) or reduce the\n"
" global maxconn setting to accommodate the system's limitation. For reference,\n" " global maxconn setting to accommodate the system's limitation. For reference,\n"
" FD_SETSIZE=%d on this system, global.maxconn=%d resulting in a maximum of\n" " FD_SETSIZE=%d on this system, global.maxconn=%d resulting in a maximum of\n"
" %d file descriptors. You should thus reduce global.maxconn by %d. Also,\n" " %d file descriptors. You should thus reduce global.maxconn by %d. Also,\n"
" check build settings using 'haproxy -vv'.\n\n", " check build settings using 'haproxy -vv'.\n\n",
FD_SETSIZE, global.maxconn, global.maxsock, (global.maxsock + 1 - FD_SETSIZE) / 2); FD_SETSIZE, global.maxconn, global.maxsock, (global.maxsock + 1 - FD_SETSIZE) / 2);
exit(1); exit(1);
} }
if (global.mode & (MODE_VERBOSE|MODE_DEBUG)) { if (global.mode & (MODE_VERBOSE|MODE_DEBUG)) {
@ -2362,7 +2362,7 @@ static void *run_thread_poll_loop(void *data)
list_for_each_entry(ptif, &per_thread_init_list, list) { list_for_each_entry(ptif, &per_thread_init_list, list) {
if (!ptif->fct()) { if (!ptif->fct()) {
Alert("failed to initialize thread %u.\n", tid); ha_alert("failed to initialize thread %u.\n", tid);
exit(1); exit(1);
} }
} }
@ -2448,7 +2448,7 @@ int main(int argc, char **argv)
if (setrlimit(RLIMIT_NOFILE, &limit) != -1) if (setrlimit(RLIMIT_NOFILE, &limit) != -1)
getrlimit(RLIMIT_NOFILE, &limit); getrlimit(RLIMIT_NOFILE, &limit);
Warning("[%s.main()] Cannot raise FD limit to %d, limit is %d.\n", argv[0], global.rlimit_nofile, (int)limit.rlim_cur); ha_warning("[%s.main()] Cannot raise FD limit to %d, limit is %d.\n", argv[0], global.rlimit_nofile, (int)limit.rlim_cur);
global.rlimit_nofile = limit.rlim_cur; global.rlimit_nofile = limit.rlim_cur;
} }
} }
@ -2458,13 +2458,13 @@ int main(int argc, char **argv)
global.rlimit_memmax * 1048576ULL; global.rlimit_memmax * 1048576ULL;
#ifdef RLIMIT_AS #ifdef RLIMIT_AS
if (setrlimit(RLIMIT_AS, &limit) == -1) { if (setrlimit(RLIMIT_AS, &limit) == -1) {
Warning("[%s.main()] Cannot fix MEM limit to %d megs.\n", ha_warning("[%s.main()] Cannot fix MEM limit to %d megs.\n",
argv[0], global.rlimit_memmax); argv[0], global.rlimit_memmax);
} }
#else #else
if (setrlimit(RLIMIT_DATA, &limit) == -1) { if (setrlimit(RLIMIT_DATA, &limit) == -1) {
Warning("[%s.main()] Cannot fix MEM limit to %d megs.\n", ha_warning("[%s.main()] Cannot fix MEM limit to %d megs.\n",
argv[0], global.rlimit_memmax); argv[0], global.rlimit_memmax);
} }
#endif #endif
} }
@ -2472,7 +2472,7 @@ int main(int argc, char **argv)
if (old_unixsocket) { if (old_unixsocket) {
if (strcmp("/dev/null", old_unixsocket) != 0) { if (strcmp("/dev/null", old_unixsocket) != 0) {
if (get_old_sockets(old_unixsocket) != 0) { if (get_old_sockets(old_unixsocket) != 0) {
Alert("Failed to get the sockets from the old process!\n"); ha_alert("Failed to get the sockets from the old process!\n");
if (!(global.mode & MODE_MWORKER)) if (!(global.mode & MODE_MWORKER))
exit(1); exit(1);
} }
@ -2521,7 +2521,7 @@ int main(int argc, char **argv)
} }
if (listeners == 0) { if (listeners == 0) {
Alert("[%s.main()] No enabled listener found (check for 'bind' directives) ! Exiting.\n", argv[0]); ha_alert("[%s.main()] No enabled listener found (check for 'bind' directives) ! Exiting.\n", argv[0]);
/* Note: we don't have to send anything to the old pids because we /* Note: we don't have to send anything to the old pids because we
* never stopped them. */ * never stopped them. */
exit(1); exit(1);
@ -2530,15 +2530,15 @@ int main(int argc, char **argv)
err = protocol_bind_all(errmsg, sizeof(errmsg)); err = protocol_bind_all(errmsg, sizeof(errmsg));
if ((err & ~ERR_WARN) != ERR_NONE) { if ((err & ~ERR_WARN) != ERR_NONE) {
if ((err & ERR_ALERT) || (err & ERR_WARN)) if ((err & ERR_ALERT) || (err & ERR_WARN))
Alert("[%s.main()] %s.\n", argv[0], errmsg); ha_alert("[%s.main()] %s.\n", argv[0], errmsg);
Alert("[%s.main()] Some protocols failed to start their listeners! Exiting.\n", argv[0]); ha_alert("[%s.main()] Some protocols failed to start their listeners! Exiting.\n", argv[0]);
protocol_unbind_all(); /* cleanup everything we can */ protocol_unbind_all(); /* cleanup everything we can */
if (nb_oldpids) if (nb_oldpids)
tell_old_pids(SIGTTIN); tell_old_pids(SIGTTIN);
exit(1); exit(1);
} else if (err & ERR_WARN) { } else if (err & ERR_WARN) {
Alert("[%s.main()] %s.\n", argv[0], errmsg); ha_alert("[%s.main()] %s.\n", argv[0], errmsg);
} }
/* Ok, all listener should now be bound, close any leftover sockets /* Ok, all listener should now be bound, close any leftover sockets
* the previous process gave us, we don't need them anymore * the previous process gave us, we don't need them anymore
@ -2568,7 +2568,7 @@ int main(int argc, char **argv)
unlink(global.pidfile); unlink(global.pidfile);
pidfd = open(global.pidfile, O_CREAT | O_WRONLY | O_TRUNC, 0644); pidfd = open(global.pidfile, O_CREAT | O_WRONLY | O_TRUNC, 0644);
if (pidfd < 0) { if (pidfd < 0) {
Alert("[%s.main()] Cannot create pidfile %s\n", argv[0], global.pidfile); ha_alert("[%s.main()] Cannot create pidfile %s\n", argv[0], global.pidfile);
if (nb_oldpids) if (nb_oldpids)
tell_old_pids(SIGTTIN); tell_old_pids(SIGTTIN);
protocol_unbind_all(); protocol_unbind_all();
@ -2577,8 +2577,8 @@ int main(int argc, char **argv)
} }
if ((global.last_checks & LSTCHK_NETADM) && global.uid) { if ((global.last_checks & LSTCHK_NETADM) && global.uid) {
Alert("[%s.main()] Some configuration options require full privileges, so global.uid cannot be changed.\n" ha_alert("[%s.main()] Some configuration options require full privileges, so global.uid cannot be changed.\n"
"", argv[0]); "", argv[0]);
protocol_unbind_all(); protocol_unbind_all();
exit(1); exit(1);
} }
@ -2587,16 +2587,16 @@ int main(int argc, char **argv)
* but we inform him that unexpected behaviour may occur. * but we inform him that unexpected behaviour may occur.
*/ */
if ((global.last_checks & LSTCHK_NETADM) && getuid()) if ((global.last_checks & LSTCHK_NETADM) && getuid())
Warning("[%s.main()] Some options which require full privileges" ha_warning("[%s.main()] Some options which require full privileges"
" might not work well.\n" " might not work well.\n"
"", argv[0]); "", argv[0]);
if ((global.mode & (MODE_MWORKER|MODE_DAEMON)) == 0) { if ((global.mode & (MODE_MWORKER|MODE_DAEMON)) == 0) {
/* chroot if needed */ /* chroot if needed */
if (global.chroot != NULL) { if (global.chroot != NULL) {
if (chroot(global.chroot) == -1 || chdir("/") == -1) { if (chroot(global.chroot) == -1 || chdir("/") == -1) {
Alert("[%s.main()] Cannot chroot(%s).\n", argv[0], global.chroot); ha_alert("[%s.main()] Cannot chroot(%s).\n", argv[0], global.chroot);
if (nb_oldpids) if (nb_oldpids)
tell_old_pids(SIGTTIN); tell_old_pids(SIGTTIN);
protocol_unbind_all(); protocol_unbind_all();
@ -2623,18 +2623,18 @@ int main(int argc, char **argv)
/* setgid / setuid */ /* setgid / setuid */
if (global.gid) { if (global.gid) {
if (getgroups(0, NULL) > 0 && setgroups(0, NULL) == -1) if (getgroups(0, NULL) > 0 && setgroups(0, NULL) == -1)
Warning("[%s.main()] Failed to drop supplementary groups. Using 'gid'/'group'" ha_warning("[%s.main()] Failed to drop supplementary groups. Using 'gid'/'group'"
" without 'uid'/'user' is generally useless.\n", argv[0]); " without 'uid'/'user' is generally useless.\n", argv[0]);
if (setgid(global.gid) == -1) { if (setgid(global.gid) == -1) {
Alert("[%s.main()] Cannot set gid %d.\n", argv[0], global.gid); ha_alert("[%s.main()] Cannot set gid %d.\n", argv[0], global.gid);
protocol_unbind_all(); protocol_unbind_all();
exit(1); exit(1);
} }
} }
if (global.uid && setuid(global.uid) == -1) { if (global.uid && setuid(global.uid) == -1) {
Alert("[%s.main()] Cannot set uid %d.\n", argv[0], global.uid); ha_alert("[%s.main()] Cannot set uid %d.\n", argv[0], global.uid);
protocol_unbind_all(); protocol_unbind_all();
exit(1); exit(1);
} }
@ -2643,8 +2643,8 @@ int main(int argc, char **argv)
limit.rlim_cur = limit.rlim_max = 0; limit.rlim_cur = limit.rlim_max = 0;
getrlimit(RLIMIT_NOFILE, &limit); getrlimit(RLIMIT_NOFILE, &limit);
if (limit.rlim_cur < global.maxsock) { if (limit.rlim_cur < global.maxsock) {
Warning("[%s.main()] FD limit (%d) too low for maxconn=%d/maxsock=%d. Please raise 'ulimit-n' to %d or more to avoid any trouble.\n", ha_warning("[%s.main()] FD limit (%d) too low for maxconn=%d/maxsock=%d. Please raise 'ulimit-n' to %d or more to avoid any trouble.\n",
argv[0], (int)limit.rlim_cur, global.maxconn, global.maxsock, global.maxsock); argv[0], (int)limit.rlim_cur, global.maxconn, global.maxsock, global.maxsock);
} }
if (global.mode & (MODE_DAEMON | MODE_MWORKER)) { if (global.mode & (MODE_DAEMON | MODE_MWORKER)) {
@ -2664,7 +2664,7 @@ int main(int argc, char **argv)
&& (global.mode & MODE_DAEMON)) { && (global.mode & MODE_DAEMON)) {
ret = fork(); ret = fork();
if (ret < 0) { if (ret < 0) {
Alert("[%s.main()] Cannot fork.\n", argv[0]); ha_alert("[%s.main()] Cannot fork.\n", argv[0]);
protocol_unbind_all(); protocol_unbind_all();
exit(1); /* there has been an error */ exit(1); /* there has been an error */
} }
@ -2679,7 +2679,7 @@ int main(int argc, char **argv)
/* master pipe to ensure the master is still alive */ /* master pipe to ensure the master is still alive */
ret = pipe(mworker_pipe); ret = pipe(mworker_pipe);
if (ret < 0) { if (ret < 0) {
Warning("[%s.main()] Cannot create master pipe.\n", argv[0]); ha_warning("[%s.main()] Cannot create master pipe.\n", argv[0]);
} else { } else {
memprintf(&msg, "%d", mworker_pipe[0]); memprintf(&msg, "%d", mworker_pipe[0]);
setenv("HAPROXY_MWORKER_PIPE_RD", msg, 1); setenv("HAPROXY_MWORKER_PIPE_RD", msg, 1);
@ -2691,7 +2691,7 @@ int main(int argc, char **argv)
mworker_pipe[0] = atol(getenv("HAPROXY_MWORKER_PIPE_RD")); mworker_pipe[0] = atol(getenv("HAPROXY_MWORKER_PIPE_RD"));
mworker_pipe[1] = atol(getenv("HAPROXY_MWORKER_PIPE_WR")); mworker_pipe[1] = atol(getenv("HAPROXY_MWORKER_PIPE_WR"));
if (mworker_pipe[0] <= 0 || mworker_pipe[1] <= 0) { if (mworker_pipe[0] <= 0 || mworker_pipe[1] <= 0) {
Warning("[%s.main()] Cannot get master pipe FDs.\n", argv[0]); ha_warning("[%s.main()] Cannot get master pipe FDs.\n", argv[0]);
} }
} }
} }
@ -2707,7 +2707,7 @@ int main(int argc, char **argv)
for (proc = 0; proc < global.nbproc; proc++) { for (proc = 0; proc < global.nbproc; proc++) {
ret = fork(); ret = fork();
if (ret < 0) { if (ret < 0) {
Alert("[%s.main()] Cannot fork.\n", argv[0]); ha_alert("[%s.main()] Cannot fork.\n", argv[0]);
protocol_unbind_all(); protocol_unbind_all();
exit(1); /* there has been an error */ exit(1); /* there has been an error */
} }
@ -2774,7 +2774,7 @@ int main(int argc, char **argv)
/* chroot if needed */ /* chroot if needed */
if (global.chroot != NULL) { if (global.chroot != NULL) {
if (chroot(global.chroot) == -1 || chdir("/") == -1) { if (chroot(global.chroot) == -1 || chdir("/") == -1) {
Alert("[%s.main()] Cannot chroot1(%s).\n", argv[0], global.chroot); ha_alert("[%s.main()] Cannot chroot1(%s).\n", argv[0], global.chroot);
if (nb_oldpids) if (nb_oldpids)
tell_old_pids(SIGTTIN); tell_old_pids(SIGTTIN);
protocol_unbind_all(); protocol_unbind_all();
@ -2788,18 +2788,18 @@ int main(int argc, char **argv)
/* setgid / setuid */ /* setgid / setuid */
if (global.gid) { if (global.gid) {
if (getgroups(0, NULL) > 0 && setgroups(0, NULL) == -1) if (getgroups(0, NULL) > 0 && setgroups(0, NULL) == -1)
Warning("[%s.main()] Failed to drop supplementary groups. Using 'gid'/'group'" ha_warning("[%s.main()] Failed to drop supplementary groups. Using 'gid'/'group'"
" without 'uid'/'user' is generally useless.\n", argv[0]); " without 'uid'/'user' is generally useless.\n", argv[0]);
if (setgid(global.gid) == -1) { if (setgid(global.gid) == -1) {
Alert("[%s.main()] Cannot set gid %d.\n", argv[0], global.gid); ha_alert("[%s.main()] Cannot set gid %d.\n", argv[0], global.gid);
protocol_unbind_all(); protocol_unbind_all();
exit(1); exit(1);
} }
} }
if (global.uid && setuid(global.uid) == -1) { if (global.uid && setuid(global.uid) == -1) {
Alert("[%s.main()] Cannot set uid %d.\n", argv[0], global.uid); ha_alert("[%s.main()] Cannot set uid %d.\n", argv[0], global.uid);
protocol_unbind_all(); protocol_unbind_all();
exit(1); exit(1);
} }

View File

@ -259,7 +259,7 @@ __LJMP static int hlua_http_get_headers(lua_State *L, struct hlua_txn *htxn, str
do { \ do { \
send_log(__be, LOG_ERR, __fmt, ## __args); \ send_log(__be, LOG_ERR, __fmt, ## __args); \
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) \ if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) \
Alert(__fmt, ## __args); \ ha_alert(__fmt, ## __args); \
} while (0) } while (0)
/* Used to check an Lua function type in the stack. It creates and /* Used to check an Lua function type in the stack. It creates and
@ -7291,15 +7291,15 @@ int hlua_post_init()
lua_pop(gL.T, -1); lua_pop(gL.T, -1);
return 1; return 1;
case HLUA_E_AGAIN: case HLUA_E_AGAIN:
Alert("lua init: yield not allowed.\n"); ha_alert("lua init: yield not allowed.\n");
return 0; return 0;
case HLUA_E_ERRMSG: case HLUA_E_ERRMSG:
msg = lua_tostring(gL.T, -1); msg = lua_tostring(gL.T, -1);
Alert("lua init: %s.\n", msg); ha_alert("lua init: %s.\n", msg);
return 0; return 0;
case HLUA_E_ERR: case HLUA_E_ERR:
default: default:
Alert("lua init: unknown runtime error.\n"); ha_alert("lua init: unknown runtime error.\n");
return 0; return 0;
} }
} }

View File

@ -176,9 +176,9 @@ static int __resume_listener(struct listener *l)
err = l->proto->bind(l, msg, sizeof(msg)); err = l->proto->bind(l, msg, sizeof(msg));
if (err & ERR_ALERT) if (err & ERR_ALERT)
Alert("Resuming listener: %s\n", msg); ha_alert("Resuming listener: %s\n", msg);
else if (err & ERR_WARN) else if (err & ERR_WARN)
Warning("Resuming listener: %s\n", msg); ha_warning("Resuming listener: %s\n", msg);
if (err & (ERR_FATAL | ERR_ABORT)) { if (err & (ERR_FATAL | ERR_ABORT)) {
ret = 0; ret = 0;

View File

@ -388,9 +388,9 @@ int parse_logformat_var(char *arg, int arg_len, char *var, int var_len, struct p
LIST_ADDQ(list_format, &node->list); LIST_ADDQ(list_format, &node->list);
} }
if (logformat_keywords[j].replace_by) if (logformat_keywords[j].replace_by)
Warning("parsing [%s:%d] : deprecated variable '%s' in '%s', please replace it with '%s'.\n", ha_warning("parsing [%s:%d] : deprecated variable '%s' in '%s', please replace it with '%s'.\n",
curproxy->conf.args.file, curproxy->conf.args.line, curproxy->conf.args.file, curproxy->conf.args.line,
logformat_keywords[j].name, fmt_directive(curproxy), logformat_keywords[j].replace_by); logformat_keywords[j].name, fmt_directive(curproxy), logformat_keywords[j].replace_by);
return 1; return 1;
} else { } else {
memprintf(err, "format variable '%s' is reserved for HTTP mode", memprintf(err, "format variable '%s' is reserved for HTTP mode",
@ -698,7 +698,7 @@ static void print_message(const char *label, const char *fmt, va_list argp)
* Displays the message on stderr with the date and pid. Overrides the quiet * Displays the message on stderr with the date and pid. Overrides the quiet
* mode during startup. * mode during startup.
*/ */
void Alert(const char *fmt, ...) void ha_alert(const char *fmt, ...)
{ {
va_list argp; va_list argp;
@ -713,7 +713,7 @@ void Alert(const char *fmt, ...)
/* /*
* Displays the message on stderr with the date and pid. * Displays the message on stderr with the date and pid.
*/ */
void Warning(const char *fmt, ...) void ha_warning(const char *fmt, ...)
{ {
va_list argp; va_list argp;
@ -1168,8 +1168,8 @@ void __send_log(struct proxy *p, int level, char *message, size_t size, char *sd
int proto = logsrv->addr.ss_family == AF_UNIX ? 0 : IPPROTO_UDP; int proto = logsrv->addr.ss_family == AF_UNIX ? 0 : IPPROTO_UDP;
if ((*plogfd = socket(logsrv->addr.ss_family, SOCK_DGRAM, proto)) < 0) { if ((*plogfd = socket(logsrv->addr.ss_family, SOCK_DGRAM, proto)) < 0) {
Alert("socket for logger #%d failed: %s (errno=%d)\n", ha_alert("socket for logger #%d failed: %s (errno=%d)\n",
nblogger, strerror(errno), errno); nblogger, strerror(errno), errno);
continue; continue;
} }
/* we don't want to receive anything on this socket */ /* we don't want to receive anything on this socket */
@ -1296,8 +1296,8 @@ void __send_log(struct proxy *p, int level, char *message, size_t size, char *sd
sent = sendmsg(*plogfd, &msghdr, MSG_DONTWAIT | MSG_NOSIGNAL); sent = sendmsg(*plogfd, &msghdr, MSG_DONTWAIT | MSG_NOSIGNAL);
if (sent < 0) { if (sent < 0) {
Alert("sendmsg logger #%d failed: %s (errno=%d)\n", ha_alert("sendmsg logger #%d failed: %s (errno=%d)\n",
nblogger, strerror(errno), errno); nblogger, strerror(errno), errno);
} }
} }
} }

View File

@ -52,7 +52,7 @@ int netns_init(void)
* is not needed either */ * is not needed either */
if (!eb_is_empty(&namespace_tree_root)) { if (!eb_is_empty(&namespace_tree_root)) {
if (init_default_namespace() < 0) { if (init_default_namespace() < 0) {
Alert("Failed to open the default namespace.\n"); ha_alert("Failed to open the default namespace.\n");
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
} }
} }

View File

@ -1891,12 +1891,12 @@ static struct appctx *peer_session_create(struct peers *peers, struct peer *peer
sess = session_new(p, NULL, &appctx->obj_type); sess = session_new(p, NULL, &appctx->obj_type);
if (!sess) { if (!sess) {
Alert("out of memory in peer_session_create().\n"); ha_alert("out of memory in peer_session_create().\n");
goto out_free_appctx; goto out_free_appctx;
} }
if ((s = stream_new(sess, &appctx->obj_type)) == NULL) { if ((s = stream_new(sess, &appctx->obj_type)) == NULL) {
Alert("Failed to initialize stream in peer_session_create().\n"); ha_alert("Failed to initialize stream in peer_session_create().\n");
goto out_free_sess; goto out_free_sess;
} }

View File

@ -406,7 +406,7 @@ void init_proto_http()
for (msg = 0; msg < HTTP_ERR_SIZE; msg++) { for (msg = 0; msg < HTTP_ERR_SIZE; msg++) {
if (!http_err_msgs[msg]) { if (!http_err_msgs[msg]) {
Alert("Internal error: no message defined for HTTP return code %d. Aborting.\n", msg); ha_alert("Internal error: no message defined for HTTP return code %d. Aborting.\n", msg);
abort(); abort();
} }
@ -1227,7 +1227,7 @@ void capture_headers(char *som, struct hdr_idx *idx,
pool_alloc2(h->pool); pool_alloc2(h->pool);
if (cap[h->index] == NULL) { if (cap[h->index] == NULL) {
Alert("HTTP capture : out of memory.\n"); ha_alert("HTTP capture : out of memory.\n");
continue; continue;
} }
@ -1969,7 +1969,7 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
if (!(s->logs.logwait &= ~(LW_REQ|LW_INIT))) if (!(s->logs.logwait &= ~(LW_REQ|LW_INIT)))
s->do_log(s); s->do_log(s);
} else { } else {
Alert("HTTP logging : out of memory.\n"); ha_alert("HTTP logging : out of memory.\n");
} }
} }
@ -5897,8 +5897,8 @@ int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, s
if (sess->listener->counters) if (sess->listener->counters)
HA_ATOMIC_ADD(&sess->listener->counters->denied_resp, 1); HA_ATOMIC_ADD(&sess->listener->counters->denied_resp, 1);
Alert("Blocking cacheable cookie in response from instance %s, server %s.\n", ha_alert("Blocking cacheable cookie in response from instance %s, server %s.\n",
s->be->id, objt_server(s->target) ? objt_server(s->target)->id : "<dispatch>"); s->be->id, objt_server(s->target) ? objt_server(s->target)->id : "<dispatch>");
send_log(s->be, LOG_ALERT, send_log(s->be, LOG_ALERT,
"Blocking cacheable cookie in response from instance %s, server %s.\n", "Blocking cacheable cookie in response from instance %s, server %s.\n",
s->be->id, objt_server(s->target) ? objt_server(s->target)->id : "<dispatch>"); s->be->id, objt_server(s->target) ? objt_server(s->target)->id : "<dispatch>");
@ -6891,7 +6891,7 @@ void manage_client_side_cookies(struct stream *s, struct channel *req)
int log_len = val_end - att_beg; int log_len = val_end - att_beg;
if ((txn->cli_cookie = pool_alloc2(pool2_capture)) == NULL) { if ((txn->cli_cookie = pool_alloc2(pool2_capture)) == NULL) {
Alert("HTTP logging : out of memory.\n"); ha_alert("HTTP logging : out of memory.\n");
} else { } else {
if (log_len > sess->fe->capture_len) if (log_len > sess->fe->capture_len)
log_len = sess->fe->capture_len; log_len = sess->fe->capture_len;
@ -7543,7 +7543,7 @@ void manage_server_side_cookies(struct stream *s, struct channel *res)
memcmp(att_beg, sess->fe->capture_name, sess->fe->capture_namelen) == 0) { memcmp(att_beg, sess->fe->capture_name, sess->fe->capture_namelen) == 0) {
int log_len = val_end - att_beg; int log_len = val_end - att_beg;
if ((txn->srv_cookie = pool_alloc2(pool2_capture)) == NULL) { if ((txn->srv_cookie = pool_alloc2(pool2_capture)) == NULL) {
Alert("HTTP logging : out of memory.\n"); ha_alert("HTTP logging : out of memory.\n");
} }
else { else {
if (log_len > sess->fe->capture_len) if (log_len > sess->fe->capture_len)
@ -8185,7 +8185,7 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
rule = calloc(1, sizeof(*rule)); rule = calloc(1, sizeof(*rule));
if (!rule) { if (!rule) {
Alert("parsing [%s:%d]: out of memory.\n", file, linenum); ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
goto out_err; goto out_err;
} }
@ -8208,8 +8208,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
if (strcmp(args[cur_arg], "deny_status") == 0) { if (strcmp(args[cur_arg], "deny_status") == 0) {
cur_arg++; cur_arg++;
if (!args[cur_arg]) { if (!args[cur_arg]) {
Alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-request %s' rule : missing status code.\n", ha_alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-request %s' rule : missing status code.\n",
file, linenum, proxy_type_str(proxy), proxy->id, args[0]); file, linenum, proxy_type_str(proxy), proxy->id, args[0]);
goto out_err; goto out_err;
} }
@ -8223,8 +8223,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
} }
if (hc >= HTTP_ERR_SIZE) { if (hc >= HTTP_ERR_SIZE) {
Warning("parsing [%s:%d] : status code %d not handled, using default code %d.\n", ha_warning("parsing [%s:%d] : status code %d not handled, using default code %d.\n",
file, linenum, code, http_err_codes[rule->deny_status]); file, linenum, code, http_err_codes[rule->deny_status]);
} }
} }
} else if (!strcmp(args[0], "auth")) { } else if (!strcmp(args[0], "auth")) {
@ -8245,8 +8245,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || if (!*args[cur_arg] ||
(*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) { (*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-request %s' expects exactly 1 argument (integer value).\n", ha_alert("parsing [%s:%d]: 'http-request %s' expects exactly 1 argument (integer value).\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
rule->arg.nice = atoi(args[cur_arg]); rule->arg.nice = atoi(args[cur_arg]);
@ -8263,20 +8263,20 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || if (!*args[cur_arg] ||
(*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) { (*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-request %s' expects exactly 1 argument (integer/hex value).\n", ha_alert("parsing [%s:%d]: 'http-request %s' expects exactly 1 argument (integer/hex value).\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
rule->arg.tos = strtol(args[cur_arg], &err, 0); rule->arg.tos = strtol(args[cur_arg], &err, 0);
if (err && *err != '\0') { if (err && *err != '\0') {
Alert("parsing [%s:%d]: invalid character starting at '%s' in 'http-request %s' (integer/hex value expected).\n", ha_alert("parsing [%s:%d]: invalid character starting at '%s' in 'http-request %s' (integer/hex value expected).\n",
file, linenum, err, args[0]); file, linenum, err, args[0]);
goto out_err; goto out_err;
} }
cur_arg++; cur_arg++;
#else #else
Alert("parsing [%s:%d]: 'http-request %s' is not supported on this platform (IP_TOS undefined).\n", file, linenum, args[0]); ha_alert("parsing [%s:%d]: 'http-request %s' is not supported on this platform (IP_TOS undefined).\n", file, linenum, args[0]);
goto out_err; goto out_err;
#endif #endif
} else if (!strcmp(args[0], "set-mark")) { } else if (!strcmp(args[0], "set-mark")) {
@ -8287,21 +8287,21 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || if (!*args[cur_arg] ||
(*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) { (*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-request %s' expects exactly 1 argument (integer/hex value).\n", ha_alert("parsing [%s:%d]: 'http-request %s' expects exactly 1 argument (integer/hex value).\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
rule->arg.mark = strtoul(args[cur_arg], &err, 0); rule->arg.mark = strtoul(args[cur_arg], &err, 0);
if (err && *err != '\0') { if (err && *err != '\0') {
Alert("parsing [%s:%d]: invalid character starting at '%s' in 'http-request %s' (integer/hex value expected).\n", ha_alert("parsing [%s:%d]: invalid character starting at '%s' in 'http-request %s' (integer/hex value expected).\n",
file, linenum, err, args[0]); file, linenum, err, args[0]);
goto out_err; goto out_err;
} }
cur_arg++; cur_arg++;
global.last_checks |= LSTCHK_NETADM; global.last_checks |= LSTCHK_NETADM;
#else #else
Alert("parsing [%s:%d]: 'http-request %s' is not supported on this platform (SO_MARK undefined).\n", file, linenum, args[0]); ha_alert("parsing [%s:%d]: 'http-request %s' is not supported on this platform (SO_MARK undefined).\n", file, linenum, args[0]);
goto out_err; goto out_err;
#endif #endif
} else if (!strcmp(args[0], "set-log-level")) { } else if (!strcmp(args[0], "set-log-level")) {
@ -8311,8 +8311,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || if (!*args[cur_arg] ||
(*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) { (*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) {
bad_log_level: bad_log_level:
Alert("parsing [%s:%d]: 'http-request %s' expects exactly 1 argument (log level name or 'silent').\n", ha_alert("parsing [%s:%d]: 'http-request %s' expects exactly 1 argument (log level name or 'silent').\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
if (strcmp(args[cur_arg], "silent") == 0) if (strcmp(args[cur_arg], "silent") == 0)
@ -8326,8 +8326,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || !*args[cur_arg+1] || if (!*args[cur_arg] || !*args[cur_arg+1] ||
(*args[cur_arg+2] && strcmp(args[cur_arg+2], "if") != 0 && strcmp(args[cur_arg+2], "unless") != 0)) { (*args[cur_arg+2] && strcmp(args[cur_arg+2], "if") != 0 && strcmp(args[cur_arg+2], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-request %s' expects exactly 2 arguments.\n", ha_alert("parsing [%s:%d]: 'http-request %s' expects exactly 2 arguments.\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
@ -8339,8 +8339,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
error = NULL; error = NULL;
if (!parse_logformat_string(args[cur_arg + 1], proxy, &rule->arg.hdr_add.fmt, LOG_OPT_HTTP, if (!parse_logformat_string(args[cur_arg + 1], proxy, &rule->arg.hdr_add.fmt, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR, &error)) { (proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR, &error)) {
Alert("parsing [%s:%d]: 'http-request %s': %s.\n", ha_alert("parsing [%s:%d]: 'http-request %s': %s.\n",
file, linenum, args[0], error); file, linenum, args[0], error);
free(error); free(error);
goto out_err; goto out_err;
} }
@ -8354,8 +8354,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || !*args[cur_arg+1] || !*args[cur_arg+2] || if (!*args[cur_arg] || !*args[cur_arg+1] || !*args[cur_arg+2] ||
(*args[cur_arg+3] && strcmp(args[cur_arg+3], "if") != 0 && strcmp(args[cur_arg+3], "unless") != 0)) { (*args[cur_arg+3] && strcmp(args[cur_arg+3], "if") != 0 && strcmp(args[cur_arg+3], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-request %s' expects exactly 3 arguments.\n", ha_alert("parsing [%s:%d]: 'http-request %s' expects exactly 3 arguments.\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
@ -8365,8 +8365,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
error = NULL; error = NULL;
if (!regex_comp(args[cur_arg + 1], &rule->arg.hdr_add.re, 1, 1, &error)) { if (!regex_comp(args[cur_arg + 1], &rule->arg.hdr_add.re, 1, 1, &error)) {
Alert("parsing [%s:%d] : '%s' : %s.\n", file, linenum, ha_alert("parsing [%s:%d] : '%s' : %s.\n", file, linenum,
args[cur_arg + 1], error); args[cur_arg + 1], error);
free(error); free(error);
goto out_err; goto out_err;
} }
@ -8375,8 +8375,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
error = NULL; error = NULL;
if (!parse_logformat_string(args[cur_arg + 2], proxy, &rule->arg.hdr_add.fmt, LOG_OPT_HTTP, if (!parse_logformat_string(args[cur_arg + 2], proxy, &rule->arg.hdr_add.fmt, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR, &error)) { (proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR, &error)) {
Alert("parsing [%s:%d]: 'http-request %s': %s.\n", ha_alert("parsing [%s:%d]: 'http-request %s': %s.\n",
file, linenum, args[0], error); file, linenum, args[0], error);
free(error); free(error);
goto out_err; goto out_err;
} }
@ -8391,8 +8391,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || if (!*args[cur_arg] ||
(*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) { (*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-request %s' expects exactly 1 argument.\n", ha_alert("parsing [%s:%d]: 'http-request %s' expects exactly 1 argument.\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
@ -8416,8 +8416,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
expr = sample_parse_expr((char **)args, &cur_arg, file, linenum, &err, &proxy->conf.args); expr = sample_parse_expr((char **)args, &cur_arg, file, linenum, &err, &proxy->conf.args);
if (!expr) { if (!expr) {
Alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-request %s' rule : %s.\n", ha_alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-request %s' rule : %s.\n",
file, linenum, proxy_type_str(proxy), proxy->id, args[0], err); file, linenum, proxy_type_str(proxy), proxy->id, args[0], err);
free(err); free(err);
goto out_err; goto out_err;
} }
@ -8429,10 +8429,10 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
where |= SMP_VAL_BE_HRQ_HDR; where |= SMP_VAL_BE_HRQ_HDR;
if (!(expr->fetch->val & where)) { if (!(expr->fetch->val & where)) {
Alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-request %s' rule :" ha_alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-request %s' rule :"
" fetch method '%s' extracts information from '%s', none of which is available here.\n", " fetch method '%s' extracts information from '%s', none of which is available here.\n",
file, linenum, proxy_type_str(proxy), proxy->id, args[0], file, linenum, proxy_type_str(proxy), proxy->id, args[0],
args[cur_arg-1], sample_src_names(expr->fetch->use)); args[cur_arg-1], sample_src_names(expr->fetch->use));
free(expr); free(expr);
goto out_err; goto out_err;
} }
@ -8440,8 +8440,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
if (strcmp(args[cur_arg], "table") == 0) { if (strcmp(args[cur_arg], "table") == 0) {
cur_arg++; cur_arg++;
if (!args[cur_arg]) { if (!args[cur_arg]) {
Alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-request %s' rule : missing table name.\n", ha_alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-request %s' rule : missing table name.\n",
file, linenum, proxy_type_str(proxy), proxy->id, args[0]); file, linenum, proxy_type_str(proxy), proxy->id, args[0]);
free(expr); free(expr);
goto out_err; goto out_err;
} }
@ -8457,8 +8457,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
char *errmsg = NULL; char *errmsg = NULL;
if ((redir = http_parse_redirect_rule(file, linenum, proxy, (const char **)args + 1, &errmsg, 1, 0)) == NULL) { if ((redir = http_parse_redirect_rule(file, linenum, proxy, (const char **)args + 1, &errmsg, 1, 0)) == NULL) {
Alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-request %s' rule : %s.\n", ha_alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-request %s' rule : %s.\n",
file, linenum, proxy_type_str(proxy), proxy->id, args[0], errmsg); file, linenum, proxy_type_str(proxy), proxy->id, args[0], errmsg);
goto out_err; goto out_err;
} }
@ -8484,8 +8484,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || if (!*args[cur_arg] ||
(*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) { (*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-request %s' expects exactly 1 argument.\n", ha_alert("parsing [%s:%d]: 'http-request %s' expects exactly 1 argument.\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
@ -8494,8 +8494,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
error = NULL; error = NULL;
if (!parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP, if (!parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR, &error)) { (proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR, &error)) {
Alert("parsing [%s:%d]: 'http-request %s': %s.\n", ha_alert("parsing [%s:%d]: 'http-request %s': %s.\n",
file, linenum, args[0], error); file, linenum, args[0], error);
free(error); free(error);
goto out_err; goto out_err;
} }
@ -8516,8 +8516,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || if (!*args[cur_arg] ||
(*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) { (*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-request %s' expects exactly 1 argument.\n", ha_alert("parsing [%s:%d]: 'http-request %s' expects exactly 1 argument.\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
@ -8526,8 +8526,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
error = NULL; error = NULL;
if (!parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP, if (!parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR, &error)) { (proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR, &error)) {
Alert("parsing [%s:%d]: 'http-request %s': %s.\n", ha_alert("parsing [%s:%d]: 'http-request %s': %s.\n",
file, linenum, args[0], error); file, linenum, args[0], error);
free(error); free(error);
goto out_err; goto out_err;
} }
@ -8548,8 +8548,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || if (!*args[cur_arg] ||
(*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) { (*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-request %s' expects exactly 1 argument.\n", ha_alert("parsing [%s:%d]: 'http-request %s' expects exactly 1 argument.\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
@ -8558,8 +8558,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
error = NULL; error = NULL;
if (!parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP, if (!parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR, &error)) { (proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR, &error)) {
Alert("parsing [%s:%d]: 'http-request %s': %s.\n", ha_alert("parsing [%s:%d]: 'http-request %s': %s.\n",
file, linenum, args[0], error); file, linenum, args[0], error);
free(error); free(error);
goto out_err; goto out_err;
} }
@ -8580,8 +8580,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || !*args[cur_arg+1] || if (!*args[cur_arg] || !*args[cur_arg+1] ||
(*args[cur_arg+2] && strcmp(args[cur_arg+2], "if") != 0 && strcmp(args[cur_arg+2], "unless") != 0)) { (*args[cur_arg+2] && strcmp(args[cur_arg+2], "if") != 0 && strcmp(args[cur_arg+2], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-request %s' expects exactly 2 arguments.\n", ha_alert("parsing [%s:%d]: 'http-request %s' expects exactly 2 arguments.\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
@ -8593,8 +8593,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
error = NULL; error = NULL;
if (!parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP, if (!parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR, &error)) { (proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR, &error)) {
Alert("parsing [%s:%d]: 'http-request %s' key: %s.\n", ha_alert("parsing [%s:%d]: 'http-request %s' key: %s.\n",
file, linenum, args[0], error); file, linenum, args[0], error);
free(error); free(error);
goto out_err; goto out_err;
} }
@ -8603,8 +8603,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
error = NULL; error = NULL;
if (!parse_logformat_string(args[cur_arg + 1], proxy, &rule->arg.map.value, LOG_OPT_HTTP, if (!parse_logformat_string(args[cur_arg + 1], proxy, &rule->arg.map.value, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR, &error)) { (proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR, &error)) {
Alert("parsing [%s:%d]: 'http-request %s' pattern: %s.\n", ha_alert("parsing [%s:%d]: 'http-request %s' pattern: %s.\n",
file, linenum, args[0], error); file, linenum, args[0], error);
free(error); free(error);
goto out_err; goto out_err;
} }
@ -8620,18 +8620,18 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
rule->from = ACT_F_HTTP_REQ; rule->from = ACT_F_HTTP_REQ;
rule->kw = custom; rule->kw = custom;
if (custom->parse(args, &cur_arg, proxy, rule, &errmsg) == ACT_RET_PRS_ERR) { if (custom->parse(args, &cur_arg, proxy, rule, &errmsg) == ACT_RET_PRS_ERR) {
Alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-request %s' rule : %s.\n", ha_alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-request %s' rule : %s.\n",
file, linenum, proxy_type_str(proxy), proxy->id, args[0], errmsg); file, linenum, proxy_type_str(proxy), proxy->id, args[0], errmsg);
free(errmsg); free(errmsg);
goto out_err; goto out_err;
} }
} else { } else {
action_build_list(&http_req_keywords.list, &trash); action_build_list(&http_req_keywords.list, &trash);
Alert("parsing [%s:%d]: 'http-request' expects 'allow', 'deny', 'auth', 'redirect', " ha_alert("parsing [%s:%d]: 'http-request' expects 'allow', 'deny', 'auth', 'redirect', "
"'tarpit', 'add-header', 'set-header', 'replace-header', 'replace-value', 'set-nice', " "'tarpit', 'add-header', 'set-header', 'replace-header', 'replace-value', 'set-nice', "
"'set-tos', 'set-mark', 'set-log-level', 'add-acl', 'del-acl', 'del-map', 'set-map', 'track-sc*'" "'set-tos', 'set-mark', 'set-log-level', 'add-acl', 'del-acl', 'del-map', 'set-map', 'track-sc*'"
"%s%s, but got '%s'%s.\n", "%s%s, but got '%s'%s.\n",
file, linenum, *trash.str ? ", " : "", trash.str, args[0], *args[0] ? "" : " (missing argument)"); file, linenum, *trash.str ? ", " : "", trash.str, args[0], *args[0] ? "" : " (missing argument)");
goto out_err; goto out_err;
} }
@ -8640,17 +8640,17 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
char *errmsg = NULL; char *errmsg = NULL;
if ((cond = build_acl_cond(file, linenum, &proxy->acl, proxy, args+cur_arg, &errmsg)) == NULL) { if ((cond = build_acl_cond(file, linenum, &proxy->acl, proxy, args+cur_arg, &errmsg)) == NULL) {
Alert("parsing [%s:%d] : error detected while parsing an 'http-request %s' condition : %s.\n", ha_alert("parsing [%s:%d] : error detected while parsing an 'http-request %s' condition : %s.\n",
file, linenum, args[0], errmsg); file, linenum, args[0], errmsg);
free(errmsg); free(errmsg);
goto out_err; goto out_err;
} }
rule->cond = cond; rule->cond = cond;
} }
else if (*args[cur_arg]) { else if (*args[cur_arg]) {
Alert("parsing [%s:%d]: 'http-request %s' expects 'realm' for 'auth' or" ha_alert("parsing [%s:%d]: 'http-request %s' expects 'realm' for 'auth' or"
" either 'if' or 'unless' followed by a condition but found '%s'.\n", " either 'if' or 'unless' followed by a condition but found '%s'.\n",
file, linenum, args[0], args[cur_arg]); file, linenum, args[0], args[cur_arg]);
goto out_err; goto out_err;
} }
@ -8670,7 +8670,7 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
rule = calloc(1, sizeof(*rule)); rule = calloc(1, sizeof(*rule));
if (!rule) { if (!rule) {
Alert("parsing [%s:%d]: out of memory.\n", file, linenum); ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
goto out_err; goto out_err;
} }
@ -8686,8 +8686,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || if (!*args[cur_arg] ||
(*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) { (*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument (integer value).\n", ha_alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument (integer value).\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
rule->arg.nice = atoi(args[cur_arg]); rule->arg.nice = atoi(args[cur_arg]);
@ -8704,20 +8704,20 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || if (!*args[cur_arg] ||
(*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) { (*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument (integer/hex value).\n", ha_alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument (integer/hex value).\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
rule->arg.tos = strtol(args[cur_arg], &err, 0); rule->arg.tos = strtol(args[cur_arg], &err, 0);
if (err && *err != '\0') { if (err && *err != '\0') {
Alert("parsing [%s:%d]: invalid character starting at '%s' in 'http-response %s' (integer/hex value expected).\n", ha_alert("parsing [%s:%d]: invalid character starting at '%s' in 'http-response %s' (integer/hex value expected).\n",
file, linenum, err, args[0]); file, linenum, err, args[0]);
goto out_err; goto out_err;
} }
cur_arg++; cur_arg++;
#else #else
Alert("parsing [%s:%d]: 'http-response %s' is not supported on this platform (IP_TOS undefined).\n", file, linenum, args[0]); ha_alert("parsing [%s:%d]: 'http-response %s' is not supported on this platform (IP_TOS undefined).\n", file, linenum, args[0]);
goto out_err; goto out_err;
#endif #endif
} else if (!strcmp(args[0], "set-mark")) { } else if (!strcmp(args[0], "set-mark")) {
@ -8728,21 +8728,21 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || if (!*args[cur_arg] ||
(*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) { (*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument (integer/hex value).\n", ha_alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument (integer/hex value).\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
rule->arg.mark = strtoul(args[cur_arg], &err, 0); rule->arg.mark = strtoul(args[cur_arg], &err, 0);
if (err && *err != '\0') { if (err && *err != '\0') {
Alert("parsing [%s:%d]: invalid character starting at '%s' in 'http-response %s' (integer/hex value expected).\n", ha_alert("parsing [%s:%d]: invalid character starting at '%s' in 'http-response %s' (integer/hex value expected).\n",
file, linenum, err, args[0]); file, linenum, err, args[0]);
goto out_err; goto out_err;
} }
cur_arg++; cur_arg++;
global.last_checks |= LSTCHK_NETADM; global.last_checks |= LSTCHK_NETADM;
#else #else
Alert("parsing [%s:%d]: 'http-response %s' is not supported on this platform (SO_MARK undefined).\n", file, linenum, args[0]); ha_alert("parsing [%s:%d]: 'http-response %s' is not supported on this platform (SO_MARK undefined).\n", file, linenum, args[0]);
goto out_err; goto out_err;
#endif #endif
} else if (!strcmp(args[0], "set-log-level")) { } else if (!strcmp(args[0], "set-log-level")) {
@ -8752,8 +8752,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || if (!*args[cur_arg] ||
(*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) { (*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) {
bad_log_level: bad_log_level:
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument (log level name or 'silent').\n", ha_alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument (log level name or 'silent').\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
if (strcmp(args[cur_arg], "silent") == 0) if (strcmp(args[cur_arg], "silent") == 0)
@ -8767,8 +8767,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || !*args[cur_arg+1] || if (!*args[cur_arg] || !*args[cur_arg+1] ||
(*args[cur_arg+2] && strcmp(args[cur_arg+2], "if") != 0 && strcmp(args[cur_arg+2], "unless") != 0)) { (*args[cur_arg+2] && strcmp(args[cur_arg+2], "if") != 0 && strcmp(args[cur_arg+2], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 2 arguments.\n", ha_alert("parsing [%s:%d]: 'http-response %s' expects exactly 2 arguments.\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
@ -8780,8 +8780,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
error = NULL; error = NULL;
if (!parse_logformat_string(args[cur_arg + 1], proxy, &rule->arg.hdr_add.fmt, LOG_OPT_HTTP, if (!parse_logformat_string(args[cur_arg + 1], proxy, &rule->arg.hdr_add.fmt, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR, &error)) { (proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR, &error)) {
Alert("parsing [%s:%d]: 'http-response %s': %s.\n", ha_alert("parsing [%s:%d]: 'http-response %s': %s.\n",
file, linenum, args[0], error); file, linenum, args[0], error);
free(error); free(error);
goto out_err; goto out_err;
} }
@ -8795,8 +8795,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || !*args[cur_arg+1] || !*args[cur_arg+2] || if (!*args[cur_arg] || !*args[cur_arg+1] || !*args[cur_arg+2] ||
(*args[cur_arg+3] && strcmp(args[cur_arg+3], "if") != 0 && strcmp(args[cur_arg+3], "unless") != 0)) { (*args[cur_arg+3] && strcmp(args[cur_arg+3], "if") != 0 && strcmp(args[cur_arg+3], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 3 arguments.\n", ha_alert("parsing [%s:%d]: 'http-response %s' expects exactly 3 arguments.\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
@ -8806,8 +8806,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
error = NULL; error = NULL;
if (!regex_comp(args[cur_arg + 1], &rule->arg.hdr_add.re, 1, 1, &error)) { if (!regex_comp(args[cur_arg + 1], &rule->arg.hdr_add.re, 1, 1, &error)) {
Alert("parsing [%s:%d] : '%s' : %s.\n", file, linenum, ha_alert("parsing [%s:%d] : '%s' : %s.\n", file, linenum,
args[cur_arg + 1], error); args[cur_arg + 1], error);
free(error); free(error);
goto out_err; goto out_err;
} }
@ -8816,8 +8816,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
error = NULL; error = NULL;
if (!parse_logformat_string(args[cur_arg + 2], proxy, &rule->arg.hdr_add.fmt, LOG_OPT_HTTP, if (!parse_logformat_string(args[cur_arg + 2], proxy, &rule->arg.hdr_add.fmt, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR, &error)) { (proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR, &error)) {
Alert("parsing [%s:%d]: 'http-response %s': %s.\n", ha_alert("parsing [%s:%d]: 'http-response %s': %s.\n",
file, linenum, args[0], error); file, linenum, args[0], error);
free(error); free(error);
goto out_err; goto out_err;
} }
@ -8832,8 +8832,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || if (!*args[cur_arg] ||
(*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) { (*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument.\n", ha_alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument.\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
@ -8858,8 +8858,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || if (!*args[cur_arg] ||
(*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) { (*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument.\n", ha_alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument.\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
@ -8868,8 +8868,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
error = NULL; error = NULL;
if (!parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP, if (!parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR, &error)) { (proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR, &error)) {
Alert("parsing [%s:%d]: 'http-response %s': %s.\n", ha_alert("parsing [%s:%d]: 'http-response %s': %s.\n",
file, linenum, args[0], error); file, linenum, args[0], error);
free(error); free(error);
goto out_err; goto out_err;
} }
@ -8891,8 +8891,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || if (!*args[cur_arg] ||
(*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) { (*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument.\n", ha_alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument.\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
@ -8901,8 +8901,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
error = NULL; error = NULL;
if (!parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP, if (!parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR, &error)) { (proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR, &error)) {
Alert("parsing [%s:%d]: 'http-response %s': %s.\n", ha_alert("parsing [%s:%d]: 'http-response %s': %s.\n",
file, linenum, args[0], error); file, linenum, args[0], error);
free(error); free(error);
goto out_err; goto out_err;
} }
@ -8923,8 +8923,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || if (!*args[cur_arg] ||
(*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) { (*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument.\n", ha_alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument.\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
@ -8933,8 +8933,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
error = NULL; error = NULL;
if (!parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP, if (!parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR, &error)) { (proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR, &error)) {
Alert("parsing [%s:%d]: 'http-response %s' %s.\n", ha_alert("parsing [%s:%d]: 'http-response %s' %s.\n",
file, linenum, args[0], error); file, linenum, args[0], error);
free(error); free(error);
goto out_err; goto out_err;
} }
@ -8955,8 +8955,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
if (!*args[cur_arg] || !*args[cur_arg+1] || if (!*args[cur_arg] || !*args[cur_arg+1] ||
(*args[cur_arg+2] && strcmp(args[cur_arg+2], "if") != 0 && strcmp(args[cur_arg+2], "unless") != 0)) { (*args[cur_arg+2] && strcmp(args[cur_arg+2], "if") != 0 && strcmp(args[cur_arg+2], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 2 arguments.\n", ha_alert("parsing [%s:%d]: 'http-response %s' expects exactly 2 arguments.\n",
file, linenum, args[0]); file, linenum, args[0]);
goto out_err; goto out_err;
} }
@ -8969,8 +8969,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
error = NULL; error = NULL;
if (!parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP, if (!parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR, &error)) { (proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR, &error)) {
Alert("parsing [%s:%d]: 'http-response %s' name: %s.\n", ha_alert("parsing [%s:%d]: 'http-response %s' name: %s.\n",
file, linenum, args[0], error); file, linenum, args[0], error);
free(error); free(error);
goto out_err; goto out_err;
} }
@ -8979,8 +8979,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
error = NULL; error = NULL;
if (!parse_logformat_string(args[cur_arg + 1], proxy, &rule->arg.map.value, LOG_OPT_HTTP, if (!parse_logformat_string(args[cur_arg + 1], proxy, &rule->arg.map.value, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR, &error)) { (proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR, &error)) {
Alert("parsing [%s:%d]: 'http-response %s' value: %s.\n", ha_alert("parsing [%s:%d]: 'http-response %s' value: %s.\n",
file, linenum, args[0], error); file, linenum, args[0], error);
free(error); free(error);
goto out_err; goto out_err;
} }
@ -8995,8 +8995,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
char *errmsg = NULL; char *errmsg = NULL;
if ((redir = http_parse_redirect_rule(file, linenum, proxy, (const char **)args + 1, &errmsg, 1, 1)) == NULL) { if ((redir = http_parse_redirect_rule(file, linenum, proxy, (const char **)args + 1, &errmsg, 1, 1)) == NULL) {
Alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-response %s' rule : %s.\n", ha_alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-response %s' rule : %s.\n",
file, linenum, proxy_type_str(proxy), proxy->id, args[0], errmsg); file, linenum, proxy_type_str(proxy), proxy->id, args[0], errmsg);
goto out_err; goto out_err;
} }
@ -9021,8 +9021,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
expr = sample_parse_expr((char **)args, &cur_arg, file, linenum, &err, &proxy->conf.args); expr = sample_parse_expr((char **)args, &cur_arg, file, linenum, &err, &proxy->conf.args);
if (!expr) { if (!expr) {
Alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-response %s' rule : %s.\n", ha_alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-response %s' rule : %s.\n",
file, linenum, proxy_type_str(proxy), proxy->id, args[0], err); file, linenum, proxy_type_str(proxy), proxy->id, args[0], err);
free(err); free(err);
goto out_err; goto out_err;
} }
@ -9034,10 +9034,10 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
where |= SMP_VAL_BE_HRS_HDR; where |= SMP_VAL_BE_HRS_HDR;
if (!(expr->fetch->val & where)) { if (!(expr->fetch->val & where)) {
Alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-response %s' rule :" ha_alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-response %s' rule :"
" fetch method '%s' extracts information from '%s', none of which is available here.\n", " fetch method '%s' extracts information from '%s', none of which is available here.\n",
file, linenum, proxy_type_str(proxy), proxy->id, args[0], file, linenum, proxy_type_str(proxy), proxy->id, args[0],
args[cur_arg-1], sample_src_names(expr->fetch->use)); args[cur_arg-1], sample_src_names(expr->fetch->use));
free(expr); free(expr);
goto out_err; goto out_err;
} }
@ -9045,8 +9045,8 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
if (strcmp(args[cur_arg], "table") == 0) { if (strcmp(args[cur_arg], "table") == 0) {
cur_arg++; cur_arg++;
if (!args[cur_arg]) { if (!args[cur_arg]) {
Alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-response %s' rule : missing table name.\n", ha_alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-response %s' rule : missing table name.\n",
file, linenum, proxy_type_str(proxy), proxy->id, args[0]); file, linenum, proxy_type_str(proxy), proxy->id, args[0]);
free(expr); free(expr);
goto out_err; goto out_err;
} }
@ -9064,18 +9064,18 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
rule->from = ACT_F_HTTP_RES; rule->from = ACT_F_HTTP_RES;
rule->kw = custom; rule->kw = custom;
if (custom->parse(args, &cur_arg, proxy, rule, &errmsg) == ACT_RET_PRS_ERR) { if (custom->parse(args, &cur_arg, proxy, rule, &errmsg) == ACT_RET_PRS_ERR) {
Alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-response %s' rule : %s.\n", ha_alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-response %s' rule : %s.\n",
file, linenum, proxy_type_str(proxy), proxy->id, args[0], errmsg); file, linenum, proxy_type_str(proxy), proxy->id, args[0], errmsg);
free(errmsg); free(errmsg);
goto out_err; goto out_err;
} }
} else { } else {
action_build_list(&http_res_keywords.list, &trash); action_build_list(&http_res_keywords.list, &trash);
Alert("parsing [%s:%d]: 'http-response' expects 'allow', 'deny', 'redirect', " ha_alert("parsing [%s:%d]: 'http-response' expects 'allow', 'deny', 'redirect', "
"'add-header', 'del-header', 'set-header', 'replace-header', 'replace-value', 'set-nice', " "'add-header', 'del-header', 'set-header', 'replace-header', 'replace-value', 'set-nice', "
"'set-tos', 'set-mark', 'set-log-level', 'add-acl', 'del-acl', 'del-map', 'set-map', 'track-sc*'" "'set-tos', 'set-mark', 'set-log-level', 'add-acl', 'del-acl', 'del-map', 'set-map', 'track-sc*'"
"%s%s, but got '%s'%s.\n", "%s%s, but got '%s'%s.\n",
file, linenum, *trash.str ? ", " : "", trash.str, args[0], *args[0] ? "" : " (missing argument)"); file, linenum, *trash.str ? ", " : "", trash.str, args[0], *args[0] ? "" : " (missing argument)");
goto out_err; goto out_err;
} }
@ -9084,17 +9084,17 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
char *errmsg = NULL; char *errmsg = NULL;
if ((cond = build_acl_cond(file, linenum, &proxy->acl, proxy, args+cur_arg, &errmsg)) == NULL) { if ((cond = build_acl_cond(file, linenum, &proxy->acl, proxy, args+cur_arg, &errmsg)) == NULL) {
Alert("parsing [%s:%d] : error detected while parsing an 'http-response %s' condition : %s.\n", ha_alert("parsing [%s:%d] : error detected while parsing an 'http-response %s' condition : %s.\n",
file, linenum, args[0], errmsg); file, linenum, args[0], errmsg);
free(errmsg); free(errmsg);
goto out_err; goto out_err;
} }
rule->cond = cond; rule->cond = cond;
} }
else if (*args[cur_arg]) { else if (*args[cur_arg]) {
Alert("parsing [%s:%d]: 'http-response %s' expects" ha_alert("parsing [%s:%d]: 'http-response %s' expects"
" either 'if' or 'unless' followed by a condition but found '%s'.\n", " either 'if' or 'unless' followed by a condition but found '%s'.\n",
file, linenum, args[0], args[cur_arg]); file, linenum, args[0], args[cur_arg]);
goto out_err; goto out_err;
} }

View File

@ -344,7 +344,7 @@ int tcp_connect_server(struct connection *conn, int data, int delack)
/* do not log anything there, it's a normal condition when this option /* do not log anything there, it's a normal condition when this option
* is used to serialize connections to a server ! * is used to serialize connections to a server !
*/ */
Alert("socket(): not enough free sockets. Raise -n argument. Giving up.\n"); ha_alert("socket(): not enough free sockets. Raise -n argument. Giving up.\n");
close(fd); close(fd);
conn->err_code = CO_ER_CONF_FDLIM; conn->err_code = CO_ER_CONF_FDLIM;
conn->flags |= CO_FL_ERROR; conn->flags |= CO_FL_ERROR;
@ -447,14 +447,14 @@ int tcp_connect_server(struct connection *conn, int data, int delack)
close(fd); close(fd);
if (ret == 1) { if (ret == 1) {
Alert("Cannot bind to source address before connect() for backend %s. Aborting.\n", ha_alert("Cannot bind to source address before connect() for backend %s. Aborting.\n",
be->id); be->id);
send_log(be, LOG_EMERG, send_log(be, LOG_EMERG,
"Cannot bind to source address before connect() for backend %s.\n", "Cannot bind to source address before connect() for backend %s.\n",
be->id); be->id);
} else { } else {
Alert("Cannot bind to tproxy source address before connect() for backend %s. Aborting.\n", ha_alert("Cannot bind to tproxy source address before connect() for backend %s. Aborting.\n",
be->id); be->id);
send_log(be, LOG_EMERG, send_log(be, LOG_EMERG,
"Cannot bind to tproxy source address before connect() for backend %s.\n", "Cannot bind to tproxy source address before connect() for backend %s.\n",
be->id); be->id);
@ -851,11 +851,11 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen)
default_tcp_maxseg = -2; default_tcp_maxseg = -2;
fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (fd < 0) if (fd < 0)
Warning("Failed to create a temporary socket!\n"); ha_warning("Failed to create a temporary socket!\n");
else { else {
if (getsockopt(fd, IPPROTO_TCP, TCP_MAXSEG, &default_tcp_maxseg, if (getsockopt(fd, IPPROTO_TCP, TCP_MAXSEG, &default_tcp_maxseg,
&ready_len) == -1) &ready_len) == -1)
Warning("Failed to get the default value of TCP_MAXSEG\n"); ha_warning("Failed to get the default value of TCP_MAXSEG\n");
} }
close(fd); close(fd);
} }
@ -865,7 +865,7 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen)
if (fd >= 0) { if (fd >= 0) {
if (getsockopt(fd, IPPROTO_TCP, TCP_MAXSEG, &default_tcp6_maxseg, if (getsockopt(fd, IPPROTO_TCP, TCP_MAXSEG, &default_tcp6_maxseg,
&ready_len) == -1) &ready_len) == -1)
Warning("Failed ot get the default value of TCP_MAXSEG for IPv6\n"); ha_warning("Failed ot get the default value of TCP_MAXSEG for IPv6\n");
close(fd); close(fd);
} }
} }
@ -1898,7 +1898,7 @@ static int bind_parse_namespace(char **args, int cur_arg, struct proxy *px, stru
l->netns = netns_store_insert(namespace); l->netns = netns_store_insert(namespace);
if (l->netns == NULL) { if (l->netns == NULL) {
Alert("Cannot open namespace '%s'.\n", args[cur_arg + 1]); ha_alert("Cannot open namespace '%s'.\n", args[cur_arg + 1]);
return ERR_ALERT | ERR_FATAL; return ERR_ALERT | ERR_FATAL;
} }
} }

View File

@ -482,7 +482,7 @@ static int uxst_connect_server(struct connection *conn, int data, int delack)
/* do not log anything there, it's a normal condition when this option /* do not log anything there, it's a normal condition when this option
* is used to serialize connections to a server ! * is used to serialize connections to a server !
*/ */
Alert("socket(): not enough free sockets. Raise -n argument. Giving up.\n"); ha_alert("socket(): not enough free sockets. Raise -n argument. Giving up.\n");
close(fd); close(fd);
conn->err_code = CO_ER_CONF_FDLIM; conn->err_code = CO_ER_CONF_FDLIM;
conn->flags |= CO_FL_ERROR; conn->flags |= CO_FL_ERROR;

View File

@ -661,8 +661,8 @@ struct server *findserver(const struct proxy *px, const char *name) {
continue; continue;
} }
Alert("Refusing to use duplicated server '%s' found in proxy: %s!\n", ha_alert("Refusing to use duplicated server '%s' found in proxy: %s!\n",
name, px->id); name, px->id);
return NULL; return NULL;
} }
@ -679,40 +679,40 @@ struct server *findserver(const struct proxy *px, const char *name) {
int proxy_cfg_ensure_no_http(struct proxy *curproxy) int proxy_cfg_ensure_no_http(struct proxy *curproxy)
{ {
if (curproxy->cookie_name != NULL) { if (curproxy->cookie_name != NULL) {
Warning("config : cookie will be ignored for %s '%s' (needs 'mode http').\n", ha_warning("config : cookie will be ignored for %s '%s' (needs 'mode http').\n",
proxy_type_str(curproxy), curproxy->id); proxy_type_str(curproxy), curproxy->id);
} }
if (curproxy->rsp_exp != NULL) { if (curproxy->rsp_exp != NULL) {
Warning("config : server regular expressions will be ignored for %s '%s' (needs 'mode http').\n", ha_warning("config : server regular expressions will be ignored for %s '%s' (needs 'mode http').\n",
proxy_type_str(curproxy), curproxy->id); proxy_type_str(curproxy), curproxy->id);
} }
if (curproxy->req_exp != NULL) { if (curproxy->req_exp != NULL) {
Warning("config : client regular expressions will be ignored for %s '%s' (needs 'mode http').\n", ha_warning("config : client regular expressions will be ignored for %s '%s' (needs 'mode http').\n",
proxy_type_str(curproxy), curproxy->id); proxy_type_str(curproxy), curproxy->id);
} }
if (curproxy->monitor_uri != NULL) { if (curproxy->monitor_uri != NULL) {
Warning("config : monitor-uri will be ignored for %s '%s' (needs 'mode http').\n", ha_warning("config : monitor-uri will be ignored for %s '%s' (needs 'mode http').\n",
proxy_type_str(curproxy), curproxy->id); proxy_type_str(curproxy), curproxy->id);
} }
if (curproxy->lbprm.algo & BE_LB_NEED_HTTP) { if (curproxy->lbprm.algo & BE_LB_NEED_HTTP) {
curproxy->lbprm.algo &= ~BE_LB_ALGO; curproxy->lbprm.algo &= ~BE_LB_ALGO;
curproxy->lbprm.algo |= BE_LB_ALGO_RR; curproxy->lbprm.algo |= BE_LB_ALGO_RR;
Warning("config : Layer 7 hash not possible for %s '%s' (needs 'mode http'). Falling back to round robin.\n", ha_warning("config : Layer 7 hash not possible for %s '%s' (needs 'mode http'). Falling back to round robin.\n",
proxy_type_str(curproxy), curproxy->id); proxy_type_str(curproxy), curproxy->id);
} }
if (curproxy->to_log & (LW_REQ | LW_RESP)) { if (curproxy->to_log & (LW_REQ | LW_RESP)) {
curproxy->to_log &= ~(LW_REQ | LW_RESP); curproxy->to_log &= ~(LW_REQ | LW_RESP);
Warning("parsing [%s:%d] : HTTP log/header format not usable with %s '%s' (needs 'mode http').\n", ha_warning("parsing [%s:%d] : HTTP log/header format not usable with %s '%s' (needs 'mode http').\n",
curproxy->conf.lfs_file, curproxy->conf.lfs_line, curproxy->conf.lfs_file, curproxy->conf.lfs_line,
proxy_type_str(curproxy), curproxy->id); proxy_type_str(curproxy), curproxy->id);
} }
if (curproxy->conf.logformat_string == default_http_log_format || if (curproxy->conf.logformat_string == default_http_log_format ||
curproxy->conf.logformat_string == clf_http_log_format) { curproxy->conf.logformat_string == clf_http_log_format) {
/* Note: we don't change the directive's file:line number */ /* Note: we don't change the directive's file:line number */
curproxy->conf.logformat_string = default_tcp_log_format; curproxy->conf.logformat_string = default_tcp_log_format;
Warning("parsing [%s:%d] : 'option httplog' not usable with %s '%s' (needs 'mode http'). Falling back to 'option tcplog'.\n", ha_warning("parsing [%s:%d] : 'option httplog' not usable with %s '%s' (needs 'mode http'). Falling back to 'option tcplog'.\n",
curproxy->conf.lfs_file, curproxy->conf.lfs_line, curproxy->conf.lfs_file, curproxy->conf.lfs_line,
proxy_type_str(curproxy), curproxy->id); proxy_type_str(curproxy), curproxy->id);
} }
return 0; return 0;
@ -797,11 +797,11 @@ int start_proxies(int verbose)
/* errors are reported if <verbose> is set or if they are fatal */ /* errors are reported if <verbose> is set or if they are fatal */
if (verbose || (lerr & (ERR_FATAL | ERR_ABORT))) { if (verbose || (lerr & (ERR_FATAL | ERR_ABORT))) {
if (lerr & ERR_ALERT) if (lerr & ERR_ALERT)
Alert("Starting %s %s: %s\n", ha_alert("Starting %s %s: %s\n",
proxy_type_str(curproxy), curproxy->id, msg); proxy_type_str(curproxy), curproxy->id, msg);
else if (lerr & ERR_WARN) else if (lerr & ERR_WARN)
Warning("Starting %s %s: %s\n", ha_warning("Starting %s %s: %s\n",
proxy_type_str(curproxy), curproxy->id, msg); proxy_type_str(curproxy), curproxy->id, msg);
} }
err |= lerr; err |= lerr;
@ -849,8 +849,8 @@ struct task *manage_proxy(struct task *t)
int t; int t;
t = tick_remain(now_ms, p->stop_time); t = tick_remain(now_ms, p->stop_time);
if (t == 0) { if (t == 0) {
Warning("Proxy %s stopped (FE: %lld conns, BE: %lld conns).\n", ha_warning("Proxy %s stopped (FE: %lld conns, BE: %lld conns).\n",
p->id, p->fe_counters.cum_conn, p->be_counters.cum_conn); p->id, p->fe_counters.cum_conn, p->be_counters.cum_conn);
send_log(p, LOG_WARNING, "Proxy %s stopped (FE: %lld conns, BE: %lld conns).\n", send_log(p, LOG_WARNING, "Proxy %s stopped (FE: %lld conns, BE: %lld conns).\n",
p->id, p->fe_counters.cum_conn, p->be_counters.cum_conn); p->id, p->fe_counters.cum_conn, p->be_counters.cum_conn);
stop_proxy(p); stop_proxy(p);
@ -940,20 +940,20 @@ struct task *hard_stop(struct task *t)
struct stream *s; struct stream *s;
if (killed) { if (killed) {
Warning("Some tasks resisted to hard-stop, exiting now.\n"); ha_warning("Some tasks resisted to hard-stop, exiting now.\n");
send_log(NULL, LOG_WARNING, "Some tasks resisted to hard-stop, exiting now.\n"); send_log(NULL, LOG_WARNING, "Some tasks resisted to hard-stop, exiting now.\n");
/* Do some cleanup and explicitely quit */ /* Do some cleanup and explicitely quit */
deinit(); deinit();
exit(0); exit(0);
} }
Warning("soft-stop running for too long, performing a hard-stop.\n"); ha_warning("soft-stop running for too long, performing a hard-stop.\n");
send_log(NULL, LOG_WARNING, "soft-stop running for too long, performing a hard-stop.\n"); send_log(NULL, LOG_WARNING, "soft-stop running for too long, performing a hard-stop.\n");
p = proxy; p = proxy;
while (p) { while (p) {
if ((p->cap & PR_CAP_FE) && (p->feconn > 0)) { if ((p->cap & PR_CAP_FE) && (p->feconn > 0)) {
Warning("Proxy %s hard-stopped (%d remaining conns will be closed).\n", ha_warning("Proxy %s hard-stopped (%d remaining conns will be closed).\n",
p->id, p->feconn); p->id, p->feconn);
send_log(p, LOG_WARNING, "Proxy %s hard-stopped (%d remaining conns will be closed).\n", send_log(p, LOG_WARNING, "Proxy %s hard-stopped (%d remaining conns will be closed).\n",
p->id, p->feconn); p->id, p->feconn);
} }
@ -987,7 +987,7 @@ void soft_stop(void)
task_schedule(task, tick_add(now_ms, global.hard_stop_after)); task_schedule(task, tick_add(now_ms, global.hard_stop_after));
} }
else { else {
Alert("out of memory trying to allocate the hard-stop task.\n"); ha_alert("out of memory trying to allocate the hard-stop task.\n");
} }
} }
p = proxy; p = proxy;
@ -1007,7 +1007,7 @@ void soft_stop(void)
} }
if (p->state != PR_STSTOPPED) { if (p->state != PR_STSTOPPED) {
Warning("Stopping %s %s in %d ms.\n", proxy_cap_str(p->cap), p->id, p->grace); ha_warning("Stopping %s %s in %d ms.\n", proxy_cap_str(p->cap), p->id, p->grace);
send_log(p, LOG_WARNING, "Stopping %s %s in %d ms.\n", proxy_cap_str(p->cap), p->id, p->grace); send_log(p, LOG_WARNING, "Stopping %s %s in %d ms.\n", proxy_cap_str(p->cap), p->id, p->grace);
p->stop_time = tick_add(now_ms, p->grace); p->stop_time = tick_add(now_ms, p->grace);
@ -1048,7 +1048,7 @@ int pause_proxy(struct proxy *p)
p->state == PR_STSTOPPED || p->state == PR_STPAUSED) p->state == PR_STSTOPPED || p->state == PR_STPAUSED)
return 1; return 1;
Warning("Pausing %s %s.\n", proxy_cap_str(p->cap), p->id); ha_warning("Pausing %s %s.\n", proxy_cap_str(p->cap), p->id);
send_log(p, LOG_WARNING, "Pausing %s %s.\n", proxy_cap_str(p->cap), p->id); send_log(p, LOG_WARNING, "Pausing %s %s.\n", proxy_cap_str(p->cap), p->id);
list_for_each_entry(l, &p->conf.listeners, by_fe) { list_for_each_entry(l, &p->conf.listeners, by_fe) {
@ -1057,7 +1057,7 @@ int pause_proxy(struct proxy *p)
} }
if (p->state == PR_STERROR) { if (p->state == PR_STERROR) {
Warning("%s %s failed to enter pause mode.\n", proxy_cap_str(p->cap), p->id); ha_warning("%s %s failed to enter pause mode.\n", proxy_cap_str(p->cap), p->id);
send_log(p, LOG_WARNING, "%s %s failed to enter pause mode.\n", proxy_cap_str(p->cap), p->id); send_log(p, LOG_WARNING, "%s %s failed to enter pause mode.\n", proxy_cap_str(p->cap), p->id);
return 0; return 0;
} }
@ -1137,7 +1137,7 @@ int resume_proxy(struct proxy *p)
if (p->state != PR_STPAUSED) if (p->state != PR_STPAUSED)
return 1; return 1;
Warning("Enabling %s %s.\n", proxy_cap_str(p->cap), p->id); ha_warning("Enabling %s %s.\n", proxy_cap_str(p->cap), p->id);
send_log(p, LOG_WARNING, "Enabling %s %s.\n", proxy_cap_str(p->cap), p->id); send_log(p, LOG_WARNING, "Enabling %s %s.\n", proxy_cap_str(p->cap), p->id);
fail = 0; fail = 0;
@ -1147,14 +1147,14 @@ int resume_proxy(struct proxy *p)
port = get_host_port(&l->addr); port = get_host_port(&l->addr);
if (port) { if (port) {
Warning("Port %d busy while trying to enable %s %s.\n", ha_warning("Port %d busy while trying to enable %s %s.\n",
port, proxy_cap_str(p->cap), p->id); port, proxy_cap_str(p->cap), p->id);
send_log(p, LOG_WARNING, "Port %d busy while trying to enable %s %s.\n", send_log(p, LOG_WARNING, "Port %d busy while trying to enable %s %s.\n",
port, proxy_cap_str(p->cap), p->id); port, proxy_cap_str(p->cap), p->id);
} }
else { else {
Warning("Bind on socket %d busy while trying to enable %s %s.\n", ha_warning("Bind on socket %d busy while trying to enable %s %s.\n",
l->luid, proxy_cap_str(p->cap), p->id); l->luid, proxy_cap_str(p->cap), p->id);
send_log(p, LOG_WARNING, "Bind on socket %d busy while trying to enable %s %s.\n", send_log(p, LOG_WARNING, "Bind on socket %d busy while trying to enable %s %s.\n",
l->luid, proxy_cap_str(p->cap), p->id); l->luid, proxy_cap_str(p->cap), p->id);
} }
@ -1201,7 +1201,7 @@ void pause_proxies(void)
} }
if (err) { if (err) {
Warning("Some proxies refused to pause, performing soft stop now.\n"); ha_warning("Some proxies refused to pause, performing soft stop now.\n");
send_log(p, LOG_WARNING, "Some proxies refused to pause, performing soft stop now.\n"); send_log(p, LOG_WARNING, "Some proxies refused to pause, performing soft stop now.\n");
soft_stop(); soft_stop();
} }
@ -1235,7 +1235,7 @@ void resume_proxies(void)
} }
if (err) { if (err) {
Warning("Some proxies refused to resume, a restart is probably needed to resume safe operations.\n"); ha_warning("Some proxies refused to resume, a restart is probably needed to resume safe operations.\n");
send_log(p, LOG_WARNING, "Some proxies refused to resume, a restart is probably needed to resume safe operations.\n"); send_log(p, LOG_WARNING, "Some proxies refused to resume, a restart is probably needed to resume safe operations.\n");
} }
} }
@ -1706,8 +1706,8 @@ static int cli_parse_shutdown_frontend(char **args, struct appctx *appctx, void
return 1; return 1;
} }
Warning("Proxy %s stopped (FE: %lld conns, BE: %lld conns).\n", ha_warning("Proxy %s stopped (FE: %lld conns, BE: %lld conns).\n",
px->id, px->fe_counters.cum_conn, px->be_counters.cum_conn); px->id, px->fe_counters.cum_conn, px->be_counters.cum_conn);
send_log(px, LOG_WARNING, "Proxy %s stopped (FE: %lld conns, BE: %lld conns).\n", send_log(px, LOG_WARNING, "Proxy %s stopped (FE: %lld conns, BE: %lld conns).\n",
px->id, px->fe_counters.cum_conn, px->be_counters.cum_conn); px->id, px->fe_counters.cum_conn, px->be_counters.cum_conn);
stop_proxy(px); stop_proxy(px);

View File

@ -114,7 +114,7 @@ const char *check_replace_string(const char *str)
err = NULL; err = NULL;
} }
else { else {
Warning("'\\%c' : deprecated use of a backslash before something not '\\','x' or a digit.\n", *str); ha_warning("'\\%c' : deprecated use of a backslash before something not '\\','x' or a digit.\n", *str);
err = NULL; err = NULL;
} }
} }

View File

@ -1142,9 +1142,9 @@ int smp_resolve_args(struct proxy *p)
switch (arg->type) { switch (arg->type) {
case ARGT_SRV: case ARGT_SRV:
if (!arg->data.str.len) { if (!arg->data.str.len) {
Alert("parsing [%s:%d] : missing server name in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n", ha_alert("parsing [%s:%d] : missing server name in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n",
cur->file, cur->line, cur->file, cur->line,
cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id); cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id);
cfgerr++; cfgerr++;
continue; continue;
} }
@ -1158,9 +1158,9 @@ int smp_resolve_args(struct proxy *p)
px = proxy_be_by_name(pname); px = proxy_be_by_name(pname);
if (!px) { if (!px) {
Alert("parsing [%s:%d] : unable to find proxy '%s' referenced in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n", ha_alert("parsing [%s:%d] : unable to find proxy '%s' referenced in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n",
cur->file, cur->line, pname, cur->file, cur->line, pname,
cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id); cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id);
cfgerr++; cfgerr++;
break; break;
} }
@ -1170,9 +1170,9 @@ int smp_resolve_args(struct proxy *p)
srv = findserver(px, sname); srv = findserver(px, sname);
if (!srv) { if (!srv) {
Alert("parsing [%s:%d] : unable to find server '%s' in proxy '%s', referenced in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n", ha_alert("parsing [%s:%d] : unable to find server '%s' in proxy '%s', referenced in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n",
cur->file, cur->line, sname, pname, cur->file, cur->line, sname, pname,
cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id); cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id);
cfgerr++; cfgerr++;
break; break;
} }
@ -1190,17 +1190,17 @@ int smp_resolve_args(struct proxy *p)
} }
if (!px) { if (!px) {
Alert("parsing [%s:%d] : unable to find frontend '%s' referenced in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n", ha_alert("parsing [%s:%d] : unable to find frontend '%s' referenced in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n",
cur->file, cur->line, pname, cur->file, cur->line, pname,
cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id); cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id);
cfgerr++; cfgerr++;
break; break;
} }
if (!(px->cap & PR_CAP_FE)) { if (!(px->cap & PR_CAP_FE)) {
Alert("parsing [%s:%d] : proxy '%s', referenced in arg %d of %s%s%s%s '%s' %s proxy '%s', has not frontend capability.\n", ha_alert("parsing [%s:%d] : proxy '%s', referenced in arg %d of %s%s%s%s '%s' %s proxy '%s', has not frontend capability.\n",
cur->file, cur->line, pname, cur->file, cur->line, pname,
cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id); cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id);
cfgerr++; cfgerr++;
break; break;
} }
@ -1218,17 +1218,17 @@ int smp_resolve_args(struct proxy *p)
} }
if (!px) { if (!px) {
Alert("parsing [%s:%d] : unable to find backend '%s' referenced in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n", ha_alert("parsing [%s:%d] : unable to find backend '%s' referenced in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n",
cur->file, cur->line, pname, cur->file, cur->line, pname,
cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id); cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id);
cfgerr++; cfgerr++;
break; break;
} }
if (!(px->cap & PR_CAP_BE)) { if (!(px->cap & PR_CAP_BE)) {
Alert("parsing [%s:%d] : proxy '%s', referenced in arg %d of %s%s%s%s '%s' %s proxy '%s', has not backend capability.\n", ha_alert("parsing [%s:%d] : proxy '%s', referenced in arg %d of %s%s%s%s '%s' %s proxy '%s', has not backend capability.\n",
cur->file, cur->line, pname, cur->file, cur->line, pname,
cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id); cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id);
cfgerr++; cfgerr++;
break; break;
} }
@ -1246,17 +1246,17 @@ int smp_resolve_args(struct proxy *p)
} }
if (!px) { if (!px) {
Alert("parsing [%s:%d] : unable to find table '%s' referenced in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n", ha_alert("parsing [%s:%d] : unable to find table '%s' referenced in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n",
cur->file, cur->line, pname, cur->file, cur->line, pname,
cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id); cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id);
cfgerr++; cfgerr++;
break; break;
} }
if (!px->table.size) { if (!px->table.size) {
Alert("parsing [%s:%d] : no table in proxy '%s' referenced in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n", ha_alert("parsing [%s:%d] : no table in proxy '%s' referenced in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n",
cur->file, cur->line, pname, cur->file, cur->line, pname,
cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id); cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id);
cfgerr++; cfgerr++;
break; break;
} }
@ -1269,9 +1269,9 @@ int smp_resolve_args(struct proxy *p)
case ARGT_USR: case ARGT_USR:
if (!arg->data.str.len) { if (!arg->data.str.len) {
Alert("parsing [%s:%d] : missing userlist name in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n", ha_alert("parsing [%s:%d] : missing userlist name in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n",
cur->file, cur->line, cur->file, cur->line,
cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id); cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id);
cfgerr++; cfgerr++;
break; break;
} }
@ -1283,9 +1283,9 @@ int smp_resolve_args(struct proxy *p)
ul = auth_find_userlist(arg->data.str.str); ul = auth_find_userlist(arg->data.str.str);
if (!ul) { if (!ul) {
Alert("parsing [%s:%d] : unable to find userlist '%s' referenced in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n", ha_alert("parsing [%s:%d] : unable to find userlist '%s' referenced in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n",
cur->file, cur->line, arg->data.str.str, cur->file, cur->line, arg->data.str.str,
cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id); cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id);
cfgerr++; cfgerr++;
break; break;
} }
@ -1298,18 +1298,18 @@ int smp_resolve_args(struct proxy *p)
case ARGT_REG: case ARGT_REG:
if (!arg->data.str.len) { if (!arg->data.str.len) {
Alert("parsing [%s:%d] : missing regex in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n", ha_alert("parsing [%s:%d] : missing regex in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n",
cur->file, cur->line, cur->file, cur->line,
cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id); cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id);
cfgerr++; cfgerr++;
continue; continue;
} }
reg = calloc(1, sizeof(*reg)); reg = calloc(1, sizeof(*reg));
if (!reg) { if (!reg) {
Alert("parsing [%s:%d] : not enough memory to build regex in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n", ha_alert("parsing [%s:%d] : not enough memory to build regex in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n",
cur->file, cur->line, cur->file, cur->line,
cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id); cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id);
cfgerr++; cfgerr++;
continue; continue;
} }
@ -1319,10 +1319,10 @@ int smp_resolve_args(struct proxy *p)
err = NULL; err = NULL;
if (!regex_comp(arg->data.str.str, reg, !(rflags & REG_ICASE), 1 /* capture substr */, &err)) { if (!regex_comp(arg->data.str.str, reg, !(rflags & REG_ICASE), 1 /* capture substr */, &err)) {
Alert("parsing [%s:%d] : error in regex '%s' in arg %d of %s%s%s%s '%s' %s proxy '%s' : %s.\n", ha_alert("parsing [%s:%d] : error in regex '%s' in arg %d of %s%s%s%s '%s' %s proxy '%s' : %s.\n",
cur->file, cur->line, cur->file, cur->line,
arg->data.str.str, arg->data.str.str,
cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id, err); cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id, err);
cfgerr++; cfgerr++;
continue; continue;
} }

View File

@ -146,9 +146,9 @@ void srv_set_dyncookie(struct server *s)
continue; continue;
if (tmpserv->cookie && if (tmpserv->cookie &&
strcmp(tmpserv->cookie, s->cookie) == 0) { strcmp(tmpserv->cookie, s->cookie) == 0) {
Warning("We generated two equal cookies for two different servers.\n" ha_warning("We generated two equal cookies for two different servers.\n"
"Please change the secret key for '%s'.\n", "Please change the secret key for '%s'.\n",
s->proxy->id); s->proxy->id);
} }
} }
} }
@ -581,8 +581,8 @@ static int srv_parse_source(char **args, int *cur_arg,
proto = protocol_by_family(sk->ss_family); proto = protocol_by_family(sk->ss_family);
if (!proto || !proto->connect) { if (!proto || !proto->connect) {
Alert("'%s %s' : connect() not supported for this address family.\n", ha_alert("'%s %s' : connect() not supported for this address family.\n",
args[*cur_arg], args[*cur_arg + 1]); args[*cur_arg], args[*cur_arg + 1]);
goto err; goto err;
} }
@ -593,15 +593,15 @@ static int srv_parse_source(char **args, int *cur_arg,
int i; int i;
if (!port_low || !port_high) { if (!port_low || !port_high) {
Alert("'%s' does not support port offsets (found '%s').\n", ha_alert("'%s' does not support port offsets (found '%s').\n",
args[*cur_arg], args[*cur_arg + 1]); args[*cur_arg], args[*cur_arg + 1]);
goto err; goto err;
} }
if (port_low <= 0 || port_low > 65535 || if (port_low <= 0 || port_low > 65535 ||
port_high <= 0 || port_high > 65535 || port_high <= 0 || port_high > 65535 ||
port_low > port_high) { port_low > port_high) {
Alert("'%s': invalid source port range %d-%d.\n", args[*cur_arg], port_low, port_high); ha_alert("'%s': invalid source port range %d-%d.\n", args[*cur_arg], port_low, port_high);
goto err; goto err;
} }
newsrv->conn_src.sport_range = port_range_alloc_range(port_high - port_low + 1); newsrv->conn_src.sport_range = port_range_alloc_range(port_high - port_low + 1);
@ -614,8 +614,8 @@ static int srv_parse_source(char **args, int *cur_arg,
if (!strcmp(args[*cur_arg], "usesrc")) { /* address to use outside */ if (!strcmp(args[*cur_arg], "usesrc")) { /* address to use outside */
#if defined(CONFIG_HAP_TRANSPARENT) #if defined(CONFIG_HAP_TRANSPARENT)
if (!*args[*cur_arg + 1]) { if (!*args[*cur_arg + 1]) {
Alert("'usesrc' expects <addr>[:<port>], 'client', 'clientip', " ha_alert("'usesrc' expects <addr>[:<port>], 'client', 'clientip', "
"or 'hdr_ip(name,#)' as argument.\n"); "or 'hdr_ip(name,#)' as argument.\n");
goto err; goto err;
} }
if (!strcmp(args[*cur_arg + 1], "client")) { if (!strcmp(args[*cur_arg + 1], "client")) {
@ -660,8 +660,8 @@ static int srv_parse_source(char **args, int *cur_arg,
} }
if (newsrv->conn_src.bind_hdr_occ < -MAX_HDR_HISTORY) { if (newsrv->conn_src.bind_hdr_occ < -MAX_HDR_HISTORY) {
Alert("usesrc hdr_ip(name,num) does not support negative" ha_alert("usesrc hdr_ip(name,num) does not support negative"
" occurrences values smaller than %d.\n", MAX_HDR_HISTORY); " occurrences values smaller than %d.\n", MAX_HDR_HISTORY);
goto err; goto err;
} }
} }
@ -672,20 +672,20 @@ static int srv_parse_source(char **args, int *cur_arg,
/* 'sk' is statically allocated (no need to be freed). */ /* 'sk' is statically allocated (no need to be freed). */
sk = str2sa_range(args[*cur_arg + 1], NULL, &port1, &port2, &errmsg, NULL, NULL, 1); sk = str2sa_range(args[*cur_arg + 1], NULL, &port1, &port2, &errmsg, NULL, NULL, 1);
if (!sk) { if (!sk) {
Alert("'%s %s' : %s\n", args[*cur_arg], args[*cur_arg + 1], errmsg); ha_alert("'%s %s' : %s\n", args[*cur_arg], args[*cur_arg + 1], errmsg);
goto err; goto err;
} }
proto = protocol_by_family(sk->ss_family); proto = protocol_by_family(sk->ss_family);
if (!proto || !proto->connect) { if (!proto || !proto->connect) {
Alert("'%s %s' : connect() not supported for this address family.\n", ha_alert("'%s %s' : connect() not supported for this address family.\n",
args[*cur_arg], args[*cur_arg + 1]); args[*cur_arg], args[*cur_arg + 1]);
goto err; goto err;
} }
if (port1 != port2) { if (port1 != port2) {
Alert("'%s' : port ranges and offsets are not allowed in '%s'\n", ha_alert("'%s' : port ranges and offsets are not allowed in '%s'\n",
args[*cur_arg], args[*cur_arg + 1]); args[*cur_arg], args[*cur_arg + 1]);
goto err; goto err;
} }
newsrv->conn_src.tproxy_addr = *sk; newsrv->conn_src.tproxy_addr = *sk;
@ -695,7 +695,7 @@ static int srv_parse_source(char **args, int *cur_arg,
*cur_arg += 2; *cur_arg += 2;
continue; continue;
#else /* no TPROXY support */ #else /* no TPROXY support */
Alert("'usesrc' not allowed here because support for TPROXY was not compiled in.\n"); ha_alert("'usesrc' not allowed here because support for TPROXY was not compiled in.\n");
goto err; goto err;
#endif /* defined(CONFIG_HAP_TRANSPARENT) */ #endif /* defined(CONFIG_HAP_TRANSPARENT) */
} /* "usesrc" */ } /* "usesrc" */
@ -703,7 +703,7 @@ static int srv_parse_source(char **args, int *cur_arg,
if (!strcmp(args[*cur_arg], "interface")) { /* specifically bind to this interface */ if (!strcmp(args[*cur_arg], "interface")) { /* specifically bind to this interface */
#ifdef SO_BINDTODEVICE #ifdef SO_BINDTODEVICE
if (!*args[*cur_arg + 1]) { if (!*args[*cur_arg + 1]) {
Alert("'%s' : missing interface name.\n", args[0]); ha_alert("'%s' : missing interface name.\n", args[0]);
goto err; goto err;
} }
free(newsrv->conn_src.iface_name); free(newsrv->conn_src.iface_name);
@ -711,7 +711,7 @@ static int srv_parse_source(char **args, int *cur_arg,
newsrv->conn_src.iface_len = strlen(newsrv->conn_src.iface_name); newsrv->conn_src.iface_len = strlen(newsrv->conn_src.iface_name);
global.last_checks |= LSTCHK_NETADM; global.last_checks |= LSTCHK_NETADM;
#else #else
Alert("'%s' : '%s' option not implemented.\n", args[0], args[*cur_arg]); ha_alert("'%s' : '%s' option not implemented.\n", args[0], args[*cur_arg]);
goto err; goto err;
#endif #endif
*cur_arg += 2; *cur_arg += 2;
@ -1294,11 +1294,11 @@ static void display_parser_err(const char *file, int linenum, char **args, int c
{ {
if (err && *err) { if (err && *err) {
indent_msg(err, 2); indent_msg(err, 2);
Alert("parsing [%s:%d] : '%s %s' : %s\n", file, linenum, args[0], args[1], *err); ha_alert("parsing [%s:%d] : '%s %s' : %s\n", file, linenum, args[0], args[1], *err);
} }
else else
Alert("parsing [%s:%d] : '%s %s' : error encountered while processing '%s'.\n", ha_alert("parsing [%s:%d] : '%s %s' : error encountered while processing '%s'.\n",
file, linenum, args[0], args[1], args[cur_arg]); file, linenum, args[0], args[1], args[cur_arg]);
} }
static void srv_conn_src_sport_range_cpy(struct server *srv, static void srv_conn_src_sport_range_cpy(struct server *srv,
@ -1579,9 +1579,9 @@ static int server_healthcheck_validate(const char *file, int linenum, struct ser
r = (struct tcpcheck_rule *)srv->proxy->tcpcheck_rules.n; r = (struct tcpcheck_rule *)srv->proxy->tcpcheck_rules.n;
if (!r) { if (!r) {
Alert("parsing [%s:%d] : server %s has neither service port nor check port. " ha_alert("parsing [%s:%d] : server %s has neither service port nor check port. "
"Check has been disabled.\n", "Check has been disabled.\n",
file, linenum, srv->id); file, linenum, srv->id);
return -1; return -1;
} }
@ -1593,9 +1593,9 @@ static int server_healthcheck_validate(const char *file, int linenum, struct ser
} }
if ((r->action != TCPCHK_ACT_CONNECT) || !r->port) { if ((r->action != TCPCHK_ACT_CONNECT) || !r->port) {
Alert("parsing [%s:%d] : server %s has neither service port nor check port " ha_alert("parsing [%s:%d] : server %s has neither service port nor check port "
"nor tcp_check rule 'connect' with port information. Check has been disabled.\n", "nor tcp_check rule 'connect' with port information. Check has been disabled.\n",
file, linenum, srv->id); file, linenum, srv->id);
return -1; return -1;
} }
@ -1603,9 +1603,9 @@ static int server_healthcheck_validate(const char *file, int linenum, struct ser
l = &srv->proxy->tcpcheck_rules; l = &srv->proxy->tcpcheck_rules;
list_for_each_entry(r, l, list) { list_for_each_entry(r, l, list) {
if ((r->action == TCPCHK_ACT_CONNECT) && (!r->port)) { if ((r->action == TCPCHK_ACT_CONNECT) && (!r->port)) {
Alert("parsing [%s:%d] : server %s has neither service port nor check port, " ha_alert("parsing [%s:%d] : server %s has neither service port nor check port, "
"and a tcp_check rule 'connect' with no port information. Check has been disabled.\n", "and a tcp_check rule 'connect' with no port information. Check has been disabled.\n",
file, linenum, srv->id); file, linenum, srv->id);
return -1; return -1;
} }
} }
@ -1643,8 +1643,8 @@ static int server_health_check_init(const char *file, int linenum,
return 0; return 0;
if (srv->trackit) { if (srv->trackit) {
Alert("parsing [%s:%d]: unable to enable checks and tracking at the same time!\n", ha_alert("parsing [%s:%d]: unable to enable checks and tracking at the same time!\n",
file, linenum); file, linenum);
return ERR_ALERT | ERR_FATAL; return ERR_ALERT | ERR_FATAL;
} }
@ -1654,7 +1654,7 @@ static int server_health_check_init(const char *file, int linenum,
/* note: check type will be set during the config review phase */ /* note: check type will be set during the config review phase */
ret = do_health_check_init(srv, 0, CHK_ST_CONFIGURED | CHK_ST_ENABLED); ret = do_health_check_init(srv, 0, CHK_ST_CONFIGURED | CHK_ST_ENABLED);
if (ret) { if (ret) {
Alert("parsing [%s:%d] : %s.\n", file, linenum, ret); ha_alert("parsing [%s:%d] : %s.\n", file, linenum, ret);
return ERR_ALERT | ERR_ABORT; return ERR_ALERT | ERR_ABORT;
} }
@ -1694,14 +1694,14 @@ static int server_agent_check_init(const char *file, int linenum,
return 0; return 0;
if (!srv->agent.port) { if (!srv->agent.port) {
Alert("parsing [%s:%d] : server %s does not have agent port. Agent check has been disabled.\n", ha_alert("parsing [%s:%d] : server %s does not have agent port. Agent check has been disabled.\n",
file, linenum, srv->id); file, linenum, srv->id);
return ERR_ALERT | ERR_FATAL; return ERR_ALERT | ERR_FATAL;
} }
ret = do_server_agent_check_init(srv, CHK_ST_CONFIGURED | CHK_ST_ENABLED | CHK_ST_AGENT); ret = do_server_agent_check_init(srv, CHK_ST_CONFIGURED | CHK_ST_ENABLED | CHK_ST_AGENT);
if (ret) { if (ret) {
Alert("parsing [%s:%d] : %s.\n", file, linenum, ret); ha_alert("parsing [%s:%d] : %s.\n", file, linenum, ret);
return ERR_ALERT | ERR_ABORT; return ERR_ALERT | ERR_ABORT;
} }
@ -1876,7 +1876,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
int tmpl_range_low = 0, tmpl_range_high = 0; int tmpl_range_low = 0, tmpl_range_high = 0;
if (!defsrv && curproxy == defproxy) { if (!defsrv && curproxy == defproxy) {
Alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]); ha_alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
@ -1887,7 +1887,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
if (srv) { if (srv) {
if (!*args[2]) { if (!*args[2]) {
/* 'server' line number of argument check. */ /* 'server' line number of argument check. */
Alert("parsing [%s:%d] : '%s' expects <name> and <addr>[:<port>] as arguments.\n", ha_alert("parsing [%s:%d] : '%s' expects <name> and <addr>[:<port>] as arguments.\n",
file, linenum, args[0]); file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -1898,7 +1898,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
else if (srv_tmpl) { else if (srv_tmpl) {
if (!*args[3]) { if (!*args[3]) {
/* 'server-template' line number of argument check. */ /* 'server-template' line number of argument check. */
Alert("parsing [%s:%d] : '%s' expects <prefix> <nb | range> <addr>[:<port>] as arguments.\n", ha_alert("parsing [%s:%d] : '%s' expects <prefix> <nb | range> <addr>[:<port>] as arguments.\n",
file, linenum, args[0]); file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -1908,7 +1908,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
} }
if (err) { if (err) {
Alert("parsing [%s:%d] : character '%c' is not permitted in %s %s '%s'.\n", ha_alert("parsing [%s:%d] : character '%c' is not permitted in %s %s '%s'.\n",
file, linenum, *err, args[0], srv ? "name" : "prefix", args[1]); file, linenum, *err, args[0], srv ? "name" : "prefix", args[1]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -1918,7 +1918,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
if (srv_tmpl) { if (srv_tmpl) {
/* Parse server-template <nb | range> arg. */ /* Parse server-template <nb | range> arg. */
if (srv_tmpl_parse_range(newsrv, args[cur_arg], &tmpl_range_low, &tmpl_range_high) < 0) { if (srv_tmpl_parse_range(newsrv, args[cur_arg], &tmpl_range_low, &tmpl_range_high) < 0) {
Alert("parsing [%s:%d] : Wrong %s number or range arg '%s'.\n", ha_alert("parsing [%s:%d] : Wrong %s number or range arg '%s'.\n",
file, linenum, args[0], args[cur_arg]); file, linenum, args[0], args[cur_arg]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -1933,7 +1933,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
newsrv = new_server(curproxy); newsrv = new_server(curproxy);
if (!newsrv) { if (!newsrv) {
Alert("parsing [%s:%d] : out of memory.\n", file, linenum); ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
goto out; goto out;
} }
@ -1966,14 +1966,14 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
*/ */
sk = str2sa_range(args[cur_arg], &port, &port1, &port2, &errmsg, NULL, &fqdn, 0); sk = str2sa_range(args[cur_arg], &port, &port1, &port2, &errmsg, NULL, &fqdn, 0);
if (!sk) { if (!sk) {
Alert("parsing [%s:%d] : '%s %s' : %s\n", file, linenum, args[0], args[1], errmsg); ha_alert("parsing [%s:%d] : '%s %s' : %s\n", file, linenum, args[0], args[1], errmsg);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
proto = protocol_by_family(sk->ss_family); proto = protocol_by_family(sk->ss_family);
if (!fqdn && (!proto || !proto->connect)) { if (!fqdn && (!proto || !proto->connect)) {
Alert("parsing [%s:%d] : '%s %s' : connect() not supported for this address family.\n", ha_alert("parsing [%s:%d] : '%s %s' : connect() not supported for this address family.\n",
file, linenum, args[0], args[1]); file, linenum, args[0], args[1]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -1985,7 +1985,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
} }
else if (port1 != port2) { else if (port1 != port2) {
/* port range */ /* port range */
Alert("parsing [%s:%d] : '%s %s' : port ranges are not allowed in '%s'\n", ha_alert("parsing [%s:%d] : '%s %s' : port ranges are not allowed in '%s'\n",
file, linenum, args[0], args[1], args[2]); file, linenum, args[0], args[1], args[2]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2003,7 +2003,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
} }
} }
else if (srv_prepare_for_resolution(newsrv, fqdn) == -1) { else if (srv_prepare_for_resolution(newsrv, fqdn) == -1) {
Alert("parsing [%s:%d] : Can't create DNS resolution for server '%s'\n", ha_alert("parsing [%s:%d] : Can't create DNS resolution for server '%s'\n",
file, linenum, newsrv->id); file, linenum, newsrv->id);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2014,7 +2014,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
newsrv->svc_port = port; newsrv->svc_port = port;
if (!newsrv->srvrq && !newsrv->hostname && !protocol_by_family(newsrv->addr.ss_family)) { if (!newsrv->srvrq && !newsrv->hostname && !protocol_by_family(newsrv->addr.ss_family)) {
Alert("parsing [%s:%d] : Unknown protocol family %d '%s'\n", ha_alert("parsing [%s:%d] : Unknown protocol family %d '%s'\n",
file, linenum, newsrv->addr.ss_family, args[cur_arg]); file, linenum, newsrv->addr.ss_family, args[cur_arg]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2034,13 +2034,13 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
if (!strcmp(args[cur_arg], "agent-inter")) { if (!strcmp(args[cur_arg], "agent-inter")) {
const char *err = parse_time_err(args[cur_arg + 1], &val, TIME_UNIT_MS); const char *err = parse_time_err(args[cur_arg + 1], &val, TIME_UNIT_MS);
if (err) { if (err) {
Alert("parsing [%s:%d] : unexpected character '%c' in 'agent-inter' argument of server %s.\n", ha_alert("parsing [%s:%d] : unexpected character '%c' in 'agent-inter' argument of server %s.\n",
file, linenum, *err, newsrv->id); file, linenum, *err, newsrv->id);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
if (val <= 0) { if (val <= 0) {
Alert("parsing [%s:%d]: invalid value %d for argument '%s' of server %s.\n", ha_alert("parsing [%s:%d]: invalid value %d for argument '%s' of server %s.\n",
file, linenum, val, args[cur_arg], newsrv->id); file, linenum, val, args[cur_arg], newsrv->id);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2050,7 +2050,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
} }
else if (!strcmp(args[cur_arg], "agent-addr")) { else if (!strcmp(args[cur_arg], "agent-addr")) {
if(str2ip(args[cur_arg + 1], &newsrv->agent.addr) == NULL) { if(str2ip(args[cur_arg + 1], &newsrv->agent.addr) == NULL) {
Alert("parsing agent-addr failed. Check if %s is correct address.\n", args[cur_arg + 1]); ha_alert("parsing agent-addr failed. Check if %s is correct address.\n", args[cur_arg + 1]);
goto out; goto out;
} }
@ -2095,7 +2095,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
} }
else if (str2ip2(p, &sa, 0)) { else if (str2ip2(p, &sa, 0)) {
if (is_addr(&newsrv->init_addr)) { if (is_addr(&newsrv->init_addr)) {
Alert("parsing [%s:%d]: '%s' : initial address already specified, cannot add '%s'.\n", ha_alert("parsing [%s:%d]: '%s' : initial address already specified, cannot add '%s'.\n",
file, linenum, args[cur_arg], p); file, linenum, args[cur_arg], p);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2104,13 +2104,13 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
done = srv_append_initaddr(&newsrv->init_addr_methods, SRV_IADDR_IP); done = srv_append_initaddr(&newsrv->init_addr_methods, SRV_IADDR_IP);
} }
else { else {
Alert("parsing [%s:%d]: '%s' : unknown init-addr method '%s', supported methods are 'libc', 'last', 'none'.\n", ha_alert("parsing [%s:%d]: '%s' : unknown init-addr method '%s', supported methods are 'libc', 'last', 'none'.\n",
file, linenum, args[cur_arg], p); file, linenum, args[cur_arg], p);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
if (!done) { if (!done) {
Alert("parsing [%s:%d]: '%s' : too many init-addr methods when trying to add '%s'\n", ha_alert("parsing [%s:%d]: '%s' : too many init-addr methods when trying to add '%s'\n",
file, linenum, args[cur_arg], p); file, linenum, args[cur_arg], p);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2129,7 +2129,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
else if (!strcmp(args[cur_arg + 1], "ipv6")) else if (!strcmp(args[cur_arg + 1], "ipv6"))
newsrv->dns_opts.family_prio = AF_INET6; newsrv->dns_opts.family_prio = AF_INET6;
else { else {
Alert("parsing [%s:%d]: '%s' expects either ipv4 or ipv6 as argument.\n", ha_alert("parsing [%s:%d]: '%s' expects either ipv4 or ipv6 as argument.\n",
file, linenum, args[cur_arg]); file, linenum, args[cur_arg]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2142,7 +2142,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
struct dns_options *opt; struct dns_options *opt;
if (!args[cur_arg + 1] || args[cur_arg + 1][0] == '\0') { if (!args[cur_arg + 1] || args[cur_arg + 1][0] == '\0') {
Alert("parsing [%s:%d]: '%s' expects a list of networks.\n", ha_alert("parsing [%s:%d]: '%s' expects a list of networks.\n",
file, linenum, args[cur_arg]); file, linenum, args[cur_arg]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2158,7 +2158,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
while (*p != '\0') { while (*p != '\0') {
/* If no room avalaible, return error. */ /* If no room avalaible, return error. */
if (opt->pref_net_nb >= SRV_MAX_PREF_NET) { if (opt->pref_net_nb >= SRV_MAX_PREF_NET) {
Alert("parsing [%s:%d]: '%s' exceed %d networks.\n", ha_alert("parsing [%s:%d]: '%s' exceed %d networks.\n",
file, linenum, args[cur_arg], SRV_MAX_PREF_NET); file, linenum, args[cur_arg], SRV_MAX_PREF_NET);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2181,7 +2181,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
opt->pref_net[opt->pref_net_nb].family = AF_INET6; opt->pref_net[opt->pref_net_nb].family = AF_INET6;
} else { } else {
/* All network conversions fail, retrun error. */ /* All network conversions fail, retrun error. */
Alert("parsing [%s:%d]: '%s': invalid network '%s'.\n", ha_alert("parsing [%s:%d]: '%s': invalid network '%s'.\n",
file, linenum, args[cur_arg], p); file, linenum, args[cur_arg], p);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2194,7 +2194,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
} }
else if (!strcmp(args[cur_arg], "rise")) { else if (!strcmp(args[cur_arg], "rise")) {
if (!*args[cur_arg + 1]) { if (!*args[cur_arg + 1]) {
Alert("parsing [%s:%d]: '%s' expects an integer argument.\n", ha_alert("parsing [%s:%d]: '%s' expects an integer argument.\n",
file, linenum, args[cur_arg]); file, linenum, args[cur_arg]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2202,7 +2202,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
newsrv->check.rise = atol(args[cur_arg + 1]); newsrv->check.rise = atol(args[cur_arg + 1]);
if (newsrv->check.rise <= 0) { if (newsrv->check.rise <= 0) {
Alert("parsing [%s:%d]: '%s' has to be > 0.\n", ha_alert("parsing [%s:%d]: '%s' has to be > 0.\n",
file, linenum, args[cur_arg]); file, linenum, args[cur_arg]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2216,14 +2216,14 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
newsrv->check.fall = atol(args[cur_arg + 1]); newsrv->check.fall = atol(args[cur_arg + 1]);
if (!*args[cur_arg + 1]) { if (!*args[cur_arg + 1]) {
Alert("parsing [%s:%d]: '%s' expects an integer argument.\n", ha_alert("parsing [%s:%d]: '%s' expects an integer argument.\n",
file, linenum, args[cur_arg]); file, linenum, args[cur_arg]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
if (newsrv->check.fall <= 0) { if (newsrv->check.fall <= 0) {
Alert("parsing [%s:%d]: '%s' has to be > 0.\n", ha_alert("parsing [%s:%d]: '%s' has to be > 0.\n",
file, linenum, args[cur_arg]); file, linenum, args[cur_arg]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2234,13 +2234,13 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
else if (!strcmp(args[cur_arg], "inter")) { else if (!strcmp(args[cur_arg], "inter")) {
const char *err = parse_time_err(args[cur_arg + 1], &val, TIME_UNIT_MS); const char *err = parse_time_err(args[cur_arg + 1], &val, TIME_UNIT_MS);
if (err) { if (err) {
Alert("parsing [%s:%d] : unexpected character '%c' in 'inter' argument of server %s.\n", ha_alert("parsing [%s:%d] : unexpected character '%c' in 'inter' argument of server %s.\n",
file, linenum, *err, newsrv->id); file, linenum, *err, newsrv->id);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
if (val <= 0) { if (val <= 0) {
Alert("parsing [%s:%d]: invalid value %d for argument '%s' of server %s.\n", ha_alert("parsing [%s:%d]: invalid value %d for argument '%s' of server %s.\n",
file, linenum, val, args[cur_arg], newsrv->id); file, linenum, val, args[cur_arg], newsrv->id);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2251,13 +2251,13 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
else if (!strcmp(args[cur_arg], "fastinter")) { else if (!strcmp(args[cur_arg], "fastinter")) {
const char *err = parse_time_err(args[cur_arg + 1], &val, TIME_UNIT_MS); const char *err = parse_time_err(args[cur_arg + 1], &val, TIME_UNIT_MS);
if (err) { if (err) {
Alert("parsing [%s:%d]: unexpected character '%c' in 'fastinter' argument of server %s.\n", ha_alert("parsing [%s:%d]: unexpected character '%c' in 'fastinter' argument of server %s.\n",
file, linenum, *err, newsrv->id); file, linenum, *err, newsrv->id);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
if (val <= 0) { if (val <= 0) {
Alert("parsing [%s:%d]: invalid value %d for argument '%s' of server %s.\n", ha_alert("parsing [%s:%d]: invalid value %d for argument '%s' of server %s.\n",
file, linenum, val, args[cur_arg], newsrv->id); file, linenum, val, args[cur_arg], newsrv->id);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2268,13 +2268,13 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
else if (!strcmp(args[cur_arg], "downinter")) { else if (!strcmp(args[cur_arg], "downinter")) {
const char *err = parse_time_err(args[cur_arg + 1], &val, TIME_UNIT_MS); const char *err = parse_time_err(args[cur_arg + 1], &val, TIME_UNIT_MS);
if (err) { if (err) {
Alert("parsing [%s:%d]: unexpected character '%c' in 'downinter' argument of server %s.\n", ha_alert("parsing [%s:%d]: unexpected character '%c' in 'downinter' argument of server %s.\n",
file, linenum, *err, newsrv->id); file, linenum, *err, newsrv->id);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
} }
if (val <= 0) { if (val <= 0) {
Alert("parsing [%s:%d]: invalid value %d for argument '%s' of server %s.\n", ha_alert("parsing [%s:%d]: invalid value %d for argument '%s' of server %s.\n",
file, linenum, val, args[cur_arg], newsrv->id); file, linenum, val, args[cur_arg], newsrv->id);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2291,7 +2291,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
int w; int w;
w = atol(args[cur_arg + 1]); w = atol(args[cur_arg + 1]);
if (w < 0 || w > SRV_UWGHT_MAX) { if (w < 0 || w > SRV_UWGHT_MAX) {
Alert("parsing [%s:%d] : weight of server %s is not within 0 and %d (%d).\n", ha_alert("parsing [%s:%d] : weight of server %s is not within 0 and %d (%d).\n",
file, linenum, newsrv->id, SRV_UWGHT_MAX, w); file, linenum, newsrv->id, SRV_UWGHT_MAX, w);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2315,7 +2315,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
/* slowstart is stored in seconds */ /* slowstart is stored in seconds */
const char *err = parse_time_err(args[cur_arg + 1], &val, TIME_UNIT_MS); const char *err = parse_time_err(args[cur_arg + 1], &val, TIME_UNIT_MS);
if (err) { if (err) {
Alert("parsing [%s:%d] : unexpected character '%c' in 'slowstart' argument of server %s.\n", ha_alert("parsing [%s:%d] : unexpected character '%c' in 'slowstart' argument of server %s.\n",
file, linenum, *err, newsrv->id); file, linenum, *err, newsrv->id);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2333,7 +2333,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
else if (!strcmp(args[cur_arg + 1], "mark-down")) else if (!strcmp(args[cur_arg + 1], "mark-down"))
newsrv->onerror = HANA_ONERR_MARKDWN; newsrv->onerror = HANA_ONERR_MARKDWN;
else { else {
Alert("parsing [%s:%d]: '%s' expects one of 'fastinter', " ha_alert("parsing [%s:%d]: '%s' expects one of 'fastinter', "
"'fail-check', 'sudden-death' or 'mark-down' but got '%s'\n", "'fail-check', 'sudden-death' or 'mark-down' but got '%s'\n",
file, linenum, args[cur_arg], args[cur_arg + 1]); file, linenum, args[cur_arg], args[cur_arg + 1]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
@ -2346,7 +2346,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
if (!strcmp(args[cur_arg + 1], "shutdown-sessions")) if (!strcmp(args[cur_arg + 1], "shutdown-sessions"))
newsrv->onmarkeddown = HANA_ONMARKEDDOWN_SHUTDOWNSESSIONS; newsrv->onmarkeddown = HANA_ONMARKEDDOWN_SHUTDOWNSESSIONS;
else { else {
Alert("parsing [%s:%d]: '%s' expects 'shutdown-sessions' but got '%s'\n", ha_alert("parsing [%s:%d]: '%s' expects 'shutdown-sessions' but got '%s'\n",
file, linenum, args[cur_arg], args[cur_arg + 1]); file, linenum, args[cur_arg], args[cur_arg + 1]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2358,7 +2358,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
if (!strcmp(args[cur_arg + 1], "shutdown-backup-sessions")) if (!strcmp(args[cur_arg + 1], "shutdown-backup-sessions"))
newsrv->onmarkedup = HANA_ONMARKEDUP_SHUTDOWNBACKUPSESSIONS; newsrv->onmarkedup = HANA_ONMARKEDUP_SHUTDOWNBACKUPSESSIONS;
else { else {
Alert("parsing [%s:%d]: '%s' expects 'shutdown-backup-sessions' but got '%s'\n", ha_alert("parsing [%s:%d]: '%s' expects 'shutdown-backup-sessions' but got '%s'\n",
file, linenum, args[cur_arg], args[cur_arg + 1]); file, linenum, args[cur_arg], args[cur_arg + 1]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2368,7 +2368,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
} }
else if (!strcmp(args[cur_arg], "error-limit")) { else if (!strcmp(args[cur_arg], "error-limit")) {
if (!*args[cur_arg + 1]) { if (!*args[cur_arg + 1]) {
Alert("parsing [%s:%d]: '%s' expects an integer argument.\n", ha_alert("parsing [%s:%d]: '%s' expects an integer argument.\n",
file, linenum, args[cur_arg]); file, linenum, args[cur_arg]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2377,7 +2377,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
newsrv->consecutive_errors_limit = atoi(args[cur_arg + 1]); newsrv->consecutive_errors_limit = atoi(args[cur_arg + 1]);
if (newsrv->consecutive_errors_limit <= 0) { if (newsrv->consecutive_errors_limit <= 0) {
Alert("parsing [%s:%d]: %s has to be > 0.\n", ha_alert("parsing [%s:%d]: %s has to be > 0.\n",
file, linenum, args[cur_arg]); file, linenum, args[cur_arg]);
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2385,7 +2385,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
cur_arg += 2; cur_arg += 2;
} }
else if (!strcmp(args[cur_arg], "usesrc")) { /* address to use outside: needs "source" first */ else if (!strcmp(args[cur_arg], "usesrc")) { /* address to use outside: needs "source" first */
Alert("parsing [%s:%d] : '%s' only allowed after a '%s' statement.\n", ha_alert("parsing [%s:%d] : '%s' only allowed after a '%s' statement.\n",
file, linenum, "usesrc", "source"); file, linenum, "usesrc", "source");
err_code |= ERR_ALERT | ERR_FATAL; err_code |= ERR_ALERT | ERR_FATAL;
goto out; goto out;
@ -2401,7 +2401,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
int code; int code;
if (!kw->parse) { if (!kw->parse) {
Alert("parsing [%s:%d] : '%s %s' : '%s' option is not implemented in this version (check build options).\n", ha_alert("parsing [%s:%d] : '%s %s' : '%s' option is not implemented in this version (check build options).\n",
file, linenum, args[0], args[1], args[cur_arg]); file, linenum, args[0], args[1], args[cur_arg]);
if (kw->skip != -1) if (kw->skip != -1)
cur_arg += 1 + kw->skip ; cur_arg += 1 + kw->skip ;
@ -2410,7 +2410,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
} }
if (defsrv && !kw->default_ok) { if (defsrv && !kw->default_ok) {
Alert("parsing [%s:%d] : '%s %s' : '%s' option is not accepted in default-server sections.\n", ha_alert("parsing [%s:%d] : '%s %s' : '%s' option is not accepted in default-server sections.\n",
file, linenum, args[0], args[1], args[cur_arg]); file, linenum, args[0], args[1], args[cur_arg]);
if (kw->skip != -1) if (kw->skip != -1)
cur_arg += 1 + kw->skip ; cur_arg += 1 + kw->skip ;
@ -2443,7 +2443,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
srv_dumped = 1; srv_dumped = 1;
} }
Alert("parsing [%s:%d] : '%s %s' unknown keyword '%s'.%s%s\n", ha_alert("parsing [%s:%d] : '%s %s' unknown keyword '%s'.%s%s\n",
file, linenum, args[0], args[1], args[cur_arg], file, linenum, args[0], args[1], args[cur_arg],
err ? " Registered keywords :" : "", err ? err : ""); err ? " Registered keywords :" : "", err ? err : "");
free(err); free(err);
@ -2923,8 +2923,8 @@ static void srv_update_state(struct server *srv, int version, char **params)
out: out:
if (msg->len) { if (msg->len) {
chunk_appendf(msg, "\n"); chunk_appendf(msg, "\n");
Warning("server-state application failed for server '%s/%s'%s", ha_warning("server-state application failed for server '%s/%s'%s",
srv->proxy->id, srv->id, msg->str); srv->proxy->id, srv->id, msg->str);
} }
} }
@ -3084,7 +3084,7 @@ void apply_server_state(void)
errno = 0; errno = 0;
f = fopen(filepath, "r"); f = fopen(filepath, "r");
if (errno && fileopenerr) if (errno && fileopenerr)
Warning("Can't open server state file '%s': %s\n", filepath, strerror(errno)); ha_warning("Can't open server state file '%s': %s\n", filepath, strerror(errno));
if (!f) if (!f)
continue; continue;
@ -3094,7 +3094,7 @@ void apply_server_state(void)
/* first character of first line of the file must contain the version of the export */ /* first character of first line of the file must contain the version of the export */
if (fgets(mybuf, SRV_STATE_LINE_MAXLEN, f) == NULL) { if (fgets(mybuf, SRV_STATE_LINE_MAXLEN, f) == NULL) {
Warning("Can't read first line of the server state file '%s'\n", filepath); ha_warning("Can't read first line of the server state file '%s'\n", filepath);
goto fileclose; goto fileclose;
} }
@ -3130,7 +3130,7 @@ void apply_server_state(void)
/* truncated lines */ /* truncated lines */
if (mybuf[mybuflen - 1] != '\n') { if (mybuf[mybuflen - 1] != '\n') {
Warning("server-state file '%s': truncated line\n", filepath); ha_warning("server-state file '%s': truncated line\n", filepath);
continue; continue;
} }
@ -3200,11 +3200,11 @@ void apply_server_state(void)
if (!check_id && !check_name) if (!check_id && !check_name)
continue; continue;
else if (!check_id && check_name) { else if (!check_id && check_name) {
Warning("backend ID mismatch: from server state file: '%s', from running config '%d'\n", params[0], bk->uuid); ha_warning("backend ID mismatch: from server state file: '%s', from running config '%d'\n", params[0], bk->uuid);
send_log(bk, LOG_NOTICE, "backend ID mismatch: from server state file: '%s', from running config '%d'\n", params[0], bk->uuid); send_log(bk, LOG_NOTICE, "backend ID mismatch: from server state file: '%s', from running config '%d'\n", params[0], bk->uuid);
} }
else if (check_id && !check_name) { else if (check_id && !check_name) {
Warning("backend name mismatch: from server state file: '%s', from running config '%s'\n", params[1], bk->id); ha_warning("backend name mismatch: from server state file: '%s', from running config '%s'\n", params[1], bk->id);
send_log(bk, LOG_NOTICE, "backend name mismatch: from server state file: '%s', from running config '%s'\n", params[1], bk->id); send_log(bk, LOG_NOTICE, "backend name mismatch: from server state file: '%s', from running config '%s'\n", params[1], bk->id);
/* if name doesn't match, we still want to update curproxy if the backend id /* if name doesn't match, we still want to update curproxy if the backend id
* was forced in previous the previous configuration */ * was forced in previous the previous configuration */
@ -3219,19 +3219,19 @@ void apply_server_state(void)
if (!srv) { if (!srv) {
/* if no server found, then warning and continue with next line */ /* if no server found, then warning and continue with next line */
Warning("can't find server '%s' with id '%s' in backend with id '%s' or name '%s'\n", ha_warning("can't find server '%s' with id '%s' in backend with id '%s' or name '%s'\n",
params[3], params[2], params[0], params[1]); params[3], params[2], params[0], params[1]);
send_log(bk, LOG_NOTICE, "can't find server '%s' with id '%s' in backend with id '%s' or name '%s'\n", send_log(bk, LOG_NOTICE, "can't find server '%s' with id '%s' in backend with id '%s' or name '%s'\n",
params[3], params[2], params[0], params[1]); params[3], params[2], params[0], params[1]);
continue; continue;
} }
else if (diff & PR_FBM_MISMATCH_ID) { else if (diff & PR_FBM_MISMATCH_ID) {
Warning("In backend '%s' (id: '%d'): server ID mismatch: from server state file: '%s', from running config %d\n", bk->id, bk->uuid, params[2], srv->puid); ha_warning("In backend '%s' (id: '%d'): server ID mismatch: from server state file: '%s', from running config %d\n", bk->id, bk->uuid, params[2], srv->puid);
send_log(bk, LOG_NOTICE, "In backend '%s' (id: %d): server ID mismatch: from server state file: '%s', from running config %d\n", bk->id, bk->uuid, params[2], srv->puid); send_log(bk, LOG_NOTICE, "In backend '%s' (id: %d): server ID mismatch: from server state file: '%s', from running config %d\n", bk->id, bk->uuid, params[2], srv->puid);
continue; continue;
} }
else if (diff & PR_FBM_MISMATCH_NAME) { else if (diff & PR_FBM_MISMATCH_NAME) {
Warning("In backend '%s' (id: %d): server name mismatch: from server state file: '%s', from running config '%s'\n", bk->id, bk->uuid, params[3], srv->id); ha_warning("In backend '%s' (id: %d): server name mismatch: from server state file: '%s', from running config '%s'\n", bk->id, bk->uuid, params[3], srv->id);
send_log(bk, LOG_NOTICE, "In backend '%s' (id: %d): server name mismatch: from server state file: '%s', from running config '%s'\n", bk->id, bk->uuid, params[3], srv->id); send_log(bk, LOG_NOTICE, "In backend '%s' (id: %d): server name mismatch: from server state file: '%s', from running config '%s'\n", bk->id, bk->uuid, params[3], srv->id);
continue; continue;
} }
@ -3289,7 +3289,7 @@ int update_server_addr(struct server *s, void *ip, int ip_sin_family, const char
s->proxy->id, s->id, oldip, newip, updater); s->proxy->id, s->id, oldip, newip, updater);
/* write the buffer on stderr */ /* write the buffer on stderr */
Warning("%s.\n", trash.str); ha_warning("%s.\n", trash.str);
/* send a log */ /* send a log */
send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.str); send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.str);
@ -3519,7 +3519,7 @@ int snr_update_srv_status(struct server *s, int has_no_ip)
chunk_printf(&trash, "Server %s/%s administratively READY thanks to valid DNS answer", chunk_printf(&trash, "Server %s/%s administratively READY thanks to valid DNS answer",
s->proxy->id, s->id); s->proxy->id, s->id);
Warning("%s.\n", trash.str); ha_warning("%s.\n", trash.str);
send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.str); send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.str);
return 0; return 0;
@ -3885,16 +3885,16 @@ static int srv_iterate_initaddr(struct server *srv)
case SRV_IADDR_NONE: case SRV_IADDR_NONE:
srv_set_admin_flag(srv, SRV_ADMF_RMAINT, NULL); srv_set_admin_flag(srv, SRV_ADMF_RMAINT, NULL);
if (return_code) { if (return_code) {
Warning("parsing [%s:%d] : 'server %s' : could not resolve address '%s', disabling server.\n", ha_warning("parsing [%s:%d] : 'server %s' : could not resolve address '%s', disabling server.\n",
srv->conf.file, srv->conf.line, srv->id, srv->hostname); srv->conf.file, srv->conf.line, srv->id, srv->hostname);
} }
return return_code; return return_code;
case SRV_IADDR_IP: case SRV_IADDR_IP:
ipcpy(&srv->init_addr, &srv->addr); ipcpy(&srv->init_addr, &srv->addr);
if (return_code) { if (return_code) {
Warning("parsing [%s:%d] : 'server %s' : could not resolve address '%s', falling back to configured address.\n", ha_warning("parsing [%s:%d] : 'server %s' : could not resolve address '%s', falling back to configured address.\n",
srv->conf.file, srv->conf.line, srv->id, srv->hostname); srv->conf.file, srv->conf.line, srv->id, srv->hostname);
} }
goto out; goto out;
@ -3904,11 +3904,11 @@ static int srv_iterate_initaddr(struct server *srv)
} }
if (!return_code) { if (!return_code) {
Alert("parsing [%s:%d] : 'server %s' : no method found to resolve address '%s'\n", ha_alert("parsing [%s:%d] : 'server %s' : no method found to resolve address '%s'\n",
srv->conf.file, srv->conf.line, srv->id, srv->hostname); srv->conf.file, srv->conf.line, srv->id, srv->hostname);
} }
else { else {
Alert("parsing [%s:%d] : 'server %s' : could not resolve address '%s'.\n", ha_alert("parsing [%s:%d] : 'server %s' : could not resolve address '%s'.\n",
srv->conf.file, srv->conf.line, srv->id, srv->hostname); srv->conf.file, srv->conf.line, srv->id, srv->hostname);
} }
@ -4472,7 +4472,7 @@ void srv_update_status(struct server *s)
s->proxy->id, s->id); s->proxy->id, s->id);
srv_append_status(tmptrash, s, NULL, xferred, 0); srv_append_status(tmptrash, s, NULL, xferred, 0);
Warning("%s.\n", tmptrash->str); ha_warning("%s.\n", tmptrash->str);
/* we don't send an alert if the server was previously paused */ /* we don't send an alert if the server was previously paused */
log_level = srv_was_stopping ? LOG_NOTICE : LOG_ALERT; log_level = srv_was_stopping ? LOG_NOTICE : LOG_ALERT;
@ -4505,7 +4505,7 @@ void srv_update_status(struct server *s)
srv_append_status(tmptrash, s, NULL, xferred, 0); srv_append_status(tmptrash, s, NULL, xferred, 0);
Warning("%s.\n", tmptrash->str); ha_warning("%s.\n", tmptrash->str);
send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str); send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
free_trash_chunk(tmptrash); free_trash_chunk(tmptrash);
tmptrash = NULL; tmptrash = NULL;
@ -4563,7 +4563,7 @@ void srv_update_status(struct server *s)
s->proxy->id, s->id); s->proxy->id, s->id);
srv_append_status(tmptrash, s, NULL, xferred, 0); srv_append_status(tmptrash, s, NULL, xferred, 0);
Warning("%s.\n", tmptrash->str); ha_warning("%s.\n", tmptrash->str);
send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str); send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
send_email_alert(s, LOG_NOTICE, "%s", tmptrash->str); send_email_alert(s, LOG_NOTICE, "%s", tmptrash->str);
free_trash_chunk(tmptrash); free_trash_chunk(tmptrash);
@ -4618,7 +4618,7 @@ void srv_update_status(struct server *s)
srv_append_status(tmptrash, s, NULL, -1, (s->next_admin & SRV_ADMF_FMAINT)); srv_append_status(tmptrash, s, NULL, -1, (s->next_admin & SRV_ADMF_FMAINT));
if (!(global.mode & MODE_STARTING)) { if (!(global.mode & MODE_STARTING)) {
Warning("%s.\n", tmptrash->str); ha_warning("%s.\n", tmptrash->str);
send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str); send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
} }
free_trash_chunk(tmptrash); free_trash_chunk(tmptrash);
@ -4652,7 +4652,7 @@ void srv_update_status(struct server *s)
srv_append_status(tmptrash, s, NULL, xferred, (s->next_admin & SRV_ADMF_FMAINT)); srv_append_status(tmptrash, s, NULL, xferred, (s->next_admin & SRV_ADMF_FMAINT));
if (!(global.mode & MODE_STARTING)) { if (!(global.mode & MODE_STARTING)) {
Warning("%s.\n", tmptrash->str); ha_warning("%s.\n", tmptrash->str);
send_log(s->proxy, srv_was_stopping ? LOG_NOTICE : LOG_ALERT, "%s.\n", tmptrash->str); send_log(s->proxy, srv_was_stopping ? LOG_NOTICE : LOG_ALERT, "%s.\n", tmptrash->str);
} }
free_trash_chunk(tmptrash); free_trash_chunk(tmptrash);
@ -4728,7 +4728,7 @@ void srv_update_status(struct server *s)
(s->next_state == SRV_ST_STOPPED) ? "DOWN" : "UP", (s->next_state == SRV_ST_STOPPED) ? "DOWN" : "UP",
(s->next_admin & SRV_ADMF_DRAIN) ? "DRAIN" : "READY"); (s->next_admin & SRV_ADMF_DRAIN) ? "DRAIN" : "READY");
} }
Warning("%s.\n", tmptrash->str); ha_warning("%s.\n", tmptrash->str);
send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str); send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
free_trash_chunk(tmptrash); free_trash_chunk(tmptrash);
tmptrash = NULL; tmptrash = NULL;
@ -4766,7 +4766,7 @@ void srv_update_status(struct server *s)
if (s->track) /* normally it's mandatory here */ if (s->track) /* normally it's mandatory here */
chunk_appendf(tmptrash, " via %s/%s", chunk_appendf(tmptrash, " via %s/%s",
s->track->proxy->id, s->track->id); s->track->proxy->id, s->track->id);
Warning("%s.\n", tmptrash->str); ha_warning("%s.\n", tmptrash->str);
send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str); send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
free_trash_chunk(tmptrash); free_trash_chunk(tmptrash);
tmptrash = NULL; tmptrash = NULL;
@ -4783,7 +4783,7 @@ void srv_update_status(struct server *s)
if (s->track) /* normally it's mandatory here */ if (s->track) /* normally it's mandatory here */
chunk_appendf(tmptrash, " via %s/%s", chunk_appendf(tmptrash, " via %s/%s",
s->track->proxy->id, s->track->id); s->track->proxy->id, s->track->id);
Warning("%s.\n", tmptrash->str); ha_warning("%s.\n", tmptrash->str);
send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str); send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
free_trash_chunk(tmptrash); free_trash_chunk(tmptrash);
tmptrash = NULL; tmptrash = NULL;
@ -4796,7 +4796,7 @@ void srv_update_status(struct server *s)
"%sServer %s/%s remains in forced maintenance", "%sServer %s/%s remains in forced maintenance",
s->flags & SRV_F_BACKUP ? "Backup " : "", s->flags & SRV_F_BACKUP ? "Backup " : "",
s->proxy->id, s->id); s->proxy->id, s->id);
Warning("%s.\n", tmptrash->str); ha_warning("%s.\n", tmptrash->str);
send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str); send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
free_trash_chunk(tmptrash); free_trash_chunk(tmptrash);
tmptrash = NULL; tmptrash = NULL;
@ -4830,7 +4830,7 @@ void srv_update_status(struct server *s)
srv_append_status(tmptrash, s, NULL, xferred, (s->next_admin & SRV_ADMF_FDRAIN)); srv_append_status(tmptrash, s, NULL, xferred, (s->next_admin & SRV_ADMF_FDRAIN));
if (!(global.mode & MODE_STARTING)) { if (!(global.mode & MODE_STARTING)) {
Warning("%s.\n", tmptrash->str); ha_warning("%s.\n", tmptrash->str);
send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str); send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
send_email_alert(s, LOG_NOTICE, "%s", tmptrash->str); send_email_alert(s, LOG_NOTICE, "%s", tmptrash->str);
} }
@ -4874,7 +4874,7 @@ void srv_update_status(struct server *s)
s->track->proxy->id, s->track->id); s->track->proxy->id, s->track->id);
} }
Warning("%s.\n", tmptrash->str); ha_warning("%s.\n", tmptrash->str);
send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str); send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
free_trash_chunk(tmptrash); free_trash_chunk(tmptrash);
tmptrash = NULL; tmptrash = NULL;
@ -4913,7 +4913,7 @@ void srv_update_status(struct server *s)
s->flags & SRV_F_BACKUP ? "Backup " : "", s->flags & SRV_F_BACKUP ? "Backup " : "",
s->proxy->id, s->id); s->proxy->id, s->id);
} }
Warning("%s.\n", tmptrash->str); ha_warning("%s.\n", tmptrash->str);
send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str); send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
free_trash_chunk(tmptrash); free_trash_chunk(tmptrash);
tmptrash = NULL; tmptrash = NULL;

View File

@ -393,18 +393,18 @@ static int ssl_init_single_engine(const char *engine_id, const char *def_algorit
/* grab the structural reference to the engine */ /* grab the structural reference to the engine */
engine = ENGINE_by_id(engine_id); engine = ENGINE_by_id(engine_id);
if (engine == NULL) { if (engine == NULL) {
Alert("ssl-engine %s: failed to get structural reference\n", engine_id); ha_alert("ssl-engine %s: failed to get structural reference\n", engine_id);
goto fail_get; goto fail_get;
} }
if (!ENGINE_init(engine)) { if (!ENGINE_init(engine)) {
/* the engine couldn't initialise, release it */ /* the engine couldn't initialise, release it */
Alert("ssl-engine %s: failed to initialize\n", engine_id); ha_alert("ssl-engine %s: failed to initialize\n", engine_id);
goto fail_init; goto fail_init;
} }
if (ENGINE_set_default_string(engine, def_algorithms) == 0) { if (ENGINE_set_default_string(engine, def_algorithms) == 0) {
Alert("ssl-engine %s: failed on ENGINE_set_default_string\n", engine_id); ha_alert("ssl-engine %s: failed on ENGINE_set_default_string\n", engine_id);
goto fail_set_method; goto fail_set_method;
} }
@ -1169,7 +1169,7 @@ static int ssl_sock_load_ocsp(SSL_CTX *ctx, const char *cert_path)
warn = NULL; warn = NULL;
if (ssl_sock_load_ocsp_response_from_file(ocsp_path, iocsp, cid, &warn)) { if (ssl_sock_load_ocsp_response_from_file(ocsp_path, iocsp, cid, &warn)) {
memprintf(&warn, "Loading '%s': %s. Content will be ignored", ocsp_path, warn ? warn : "failure"); memprintf(&warn, "Loading '%s': %s. Content will be ignored", ocsp_path, warn ? warn : "failure");
Warning("%s.\n", warn); ha_warning("%s.\n", warn);
} }
out: out:
@ -1210,7 +1210,7 @@ static int ssl_sock_set_ocsp_response_from_file(SSL_CTX *ctx, const char *cert_p
fd = open(ocsp_path, O_RDONLY); fd = open(ocsp_path, O_RDONLY);
if (fd == -1) { if (fd == -1) {
Warning("Error opening OCSP response file %s.\n", ocsp_path); ha_warning("Error opening OCSP response file %s.\n", ocsp_path);
return -1; return -1;
} }
@ -1220,7 +1220,7 @@ static int ssl_sock_set_ocsp_response_from_file(SSL_CTX *ctx, const char *cert_p
if (r < 0) { if (r < 0) {
if (errno == EINTR) if (errno == EINTR)
continue; continue;
Warning("Error reading OCSP response from file %s.\n", ocsp_path); ha_warning("Error reading OCSP response from file %s.\n", ocsp_path);
close(fd); close(fd);
return -1; return -1;
} }
@ -3698,9 +3698,9 @@ ssl_sock_initial_ctx(struct bind_conf *bind_conf)
bind_conf->initial_ctx = ctx; bind_conf->initial_ctx = ctx;
if (conf_ssl_methods->flags && (conf_ssl_methods->min || conf_ssl_methods->max)) if (conf_ssl_methods->flags && (conf_ssl_methods->min || conf_ssl_methods->max))
Warning("Proxy '%s': no-sslv3/no-tlsv1x are ignored for bind '%s' at [%s:%d]. " ha_warning("Proxy '%s': no-sslv3/no-tlsv1x are ignored for bind '%s' at [%s:%d]. "
"Use only 'ssl-min-ver' and 'ssl-max-ver' to fix.\n", "Use only 'ssl-min-ver' and 'ssl-max-ver' to fix.\n",
bind_conf->frontend->id, bind_conf->arg, bind_conf->file, bind_conf->line); bind_conf->frontend->id, bind_conf->arg, bind_conf->file, bind_conf->line);
else else
flags = conf_ssl_methods->flags; flags = conf_ssl_methods->flags;
@ -3722,10 +3722,10 @@ ssl_sock_initial_ctx(struct bind_conf *bind_conf)
if (methodVersions[i].option && !(flags & methodVersions[i].flag)) { if (methodVersions[i].option && !(flags & methodVersions[i].flag)) {
if (min) { if (min) {
if (hole) { if (hole) {
Warning("Proxy '%s': SSL/TLS versions range not contiguous for bind '%s' at [%s:%d]. " ha_warning("Proxy '%s': SSL/TLS versions range not contiguous for bind '%s' at [%s:%d]. "
"Hole find for %s. Use only 'ssl-min-ver' and 'ssl-max-ver' to fix.\n", "Hole find for %s. Use only 'ssl-min-ver' and 'ssl-max-ver' to fix.\n",
bind_conf->frontend->id, bind_conf->arg, bind_conf->file, bind_conf->line, bind_conf->frontend->id, bind_conf->arg, bind_conf->file, bind_conf->line,
methodVersions[hole].name); methodVersions[hole].name);
hole = 0; hole = 0;
} }
max = i; max = i;
@ -3739,8 +3739,8 @@ ssl_sock_initial_ctx(struct bind_conf *bind_conf)
hole = i; hole = i;
} }
if (!min) { if (!min) {
Alert("Proxy '%s': all SSL/TLS versions are disabled for bind '%s' at [%s:%d].\n", ha_alert("Proxy '%s': all SSL/TLS versions are disabled for bind '%s' at [%s:%d].\n",
bind_conf->frontend->id, bind_conf->arg, bind_conf->file, bind_conf->line); bind_conf->frontend->id, bind_conf->arg, bind_conf->file, bind_conf->line);
cfgerr += 1; cfgerr += 1;
} }
/* save real min/max in bind_conf */ /* save real min/max in bind_conf */
@ -4068,8 +4068,8 @@ int ssl_sock_prepare_ctx(struct bind_conf *bind_conf, struct ssl_bind_conf *ssl_
conf_ssl_methods->min = min; conf_ssl_methods->min = min;
conf_ssl_methods->max = max; conf_ssl_methods->max = max;
if (!min) { if (!min) {
Alert("Proxy '%s': all SSL/TLS versions are disabled for bind '%s' at [%s:%d].\n", ha_alert("Proxy '%s': all SSL/TLS versions are disabled for bind '%s' at [%s:%d].\n",
bind_conf->frontend->id, bind_conf->arg, bind_conf->file, bind_conf->line); bind_conf->frontend->id, bind_conf->arg, bind_conf->file, bind_conf->line);
cfgerr += 1; cfgerr += 1;
} }
} }
@ -4092,8 +4092,8 @@ int ssl_sock_prepare_ctx(struct bind_conf *bind_conf, struct ssl_bind_conf *ssl_
if (ca_file) { if (ca_file) {
/* load CAfile to verify */ /* load CAfile to verify */
if (!SSL_CTX_load_verify_locations(ctx, ca_file, NULL)) { if (!SSL_CTX_load_verify_locations(ctx, ca_file, NULL)) {
Alert("Proxy '%s': unable to load CA file '%s' for bind '%s' at [%s:%d].\n", ha_alert("Proxy '%s': unable to load CA file '%s' for bind '%s' at [%s:%d].\n",
curproxy->id, ca_file, bind_conf->arg, bind_conf->file, bind_conf->line); curproxy->id, ca_file, bind_conf->arg, bind_conf->file, bind_conf->line);
cfgerr++; cfgerr++;
} }
if (!((ssl_conf && ssl_conf->no_ca_names) || bind_conf->ssl_conf.no_ca_names)) { if (!((ssl_conf && ssl_conf->no_ca_names) || bind_conf->ssl_conf.no_ca_names)) {
@ -4102,8 +4102,8 @@ int ssl_sock_prepare_ctx(struct bind_conf *bind_conf, struct ssl_bind_conf *ssl_
} }
} }
else { else {
Alert("Proxy '%s': verify is enabled but no CA file specified for bind '%s' at [%s:%d].\n", ha_alert("Proxy '%s': verify is enabled but no CA file specified for bind '%s' at [%s:%d].\n",
curproxy->id, bind_conf->arg, bind_conf->file, bind_conf->line); curproxy->id, bind_conf->arg, bind_conf->file, bind_conf->line);
cfgerr++; cfgerr++;
} }
#ifdef X509_V_FLAG_CRL_CHECK #ifdef X509_V_FLAG_CRL_CHECK
@ -4111,8 +4111,8 @@ int ssl_sock_prepare_ctx(struct bind_conf *bind_conf, struct ssl_bind_conf *ssl_
X509_STORE *store = SSL_CTX_get_cert_store(ctx); X509_STORE *store = SSL_CTX_get_cert_store(ctx);
if (!store || !X509_STORE_load_locations(store, crl_file, NULL)) { if (!store || !X509_STORE_load_locations(store, crl_file, NULL)) {
Alert("Proxy '%s': unable to configure CRL file '%s' for bind '%s' at [%s:%d].\n", ha_alert("Proxy '%s': unable to configure CRL file '%s' for bind '%s' at [%s:%d].\n",
curproxy->id, crl_file, bind_conf->arg, bind_conf->file, bind_conf->line); curproxy->id, crl_file, bind_conf->arg, bind_conf->file, bind_conf->line);
cfgerr++; cfgerr++;
} }
else { else {
@ -4125,8 +4125,8 @@ int ssl_sock_prepare_ctx(struct bind_conf *bind_conf, struct ssl_bind_conf *ssl_
#if (defined SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB && TLS_TICKETS_NO > 0) #if (defined SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB && TLS_TICKETS_NO > 0)
if(bind_conf->keys_ref) { if(bind_conf->keys_ref) {
if (!SSL_CTX_set_tlsext_ticket_key_cb(ctx, ssl_tlsext_ticket_key_cb)) { if (!SSL_CTX_set_tlsext_ticket_key_cb(ctx, ssl_tlsext_ticket_key_cb)) {
Alert("Proxy '%s': unable to set callback for TLS ticket validation for bind '%s' at [%s:%d].\n", ha_alert("Proxy '%s': unable to set callback for TLS ticket validation for bind '%s' at [%s:%d].\n",
curproxy->id, bind_conf->arg, bind_conf->file, bind_conf->line); curproxy->id, bind_conf->arg, bind_conf->file, bind_conf->line);
cfgerr++; cfgerr++;
} }
} }
@ -4136,8 +4136,8 @@ int ssl_sock_prepare_ctx(struct bind_conf *bind_conf, struct ssl_bind_conf *ssl_
conf_ciphers = (ssl_conf && ssl_conf->ciphers) ? ssl_conf->ciphers : bind_conf->ssl_conf.ciphers; conf_ciphers = (ssl_conf && ssl_conf->ciphers) ? ssl_conf->ciphers : bind_conf->ssl_conf.ciphers;
if (conf_ciphers && if (conf_ciphers &&
!SSL_CTX_set_cipher_list(ctx, conf_ciphers)) { !SSL_CTX_set_cipher_list(ctx, conf_ciphers)) {
Alert("Proxy '%s': unable to set SSL cipher list to '%s' for bind '%s' at [%s:%d].\n", ha_alert("Proxy '%s': unable to set SSL cipher list to '%s' for bind '%s' at [%s:%d].\n",
curproxy->id, conf_ciphers, bind_conf->arg, bind_conf->file, bind_conf->line); curproxy->id, conf_ciphers, bind_conf->arg, bind_conf->file, bind_conf->line);
cfgerr++; cfgerr++;
} }
@ -4183,7 +4183,7 @@ int ssl_sock_prepare_ctx(struct bind_conf *bind_conf, struct ssl_bind_conf *ssl_
} }
if (dhe_found) { if (dhe_found) {
Warning("Setting tune.ssl.default-dh-param to 1024 by default, if your workload permits it you should set it to at least 2048. Please set a value >= 1024 to make this warning disappear.\n"); ha_warning("Setting tune.ssl.default-dh-param to 1024 by default, if your workload permits it you should set it to at least 2048. Please set a value >= 1024 to make this warning disappear.\n");
} }
global_ssl.default_dh_param = 1024; global_ssl.default_dh_param = 1024;
@ -4233,8 +4233,8 @@ int ssl_sock_prepare_ctx(struct bind_conf *bind_conf, struct ssl_bind_conf *ssl_
conf_curves = (ssl_conf && ssl_conf->curves) ? ssl_conf->curves : bind_conf->ssl_conf.curves; conf_curves = (ssl_conf && ssl_conf->curves) ? ssl_conf->curves : bind_conf->ssl_conf.curves;
if (conf_curves) { if (conf_curves) {
if (!SSL_CTX_set1_curves_list(ctx, conf_curves)) { if (!SSL_CTX_set1_curves_list(ctx, conf_curves)) {
Alert("Proxy '%s': unable to set SSL curves list to '%s' for bind '%s' at [%s:%d].\n", ha_alert("Proxy '%s': unable to set SSL curves list to '%s' for bind '%s' at [%s:%d].\n",
curproxy->id, conf_curves, bind_conf->arg, bind_conf->file, bind_conf->line); curproxy->id, conf_curves, bind_conf->arg, bind_conf->file, bind_conf->line);
cfgerr++; cfgerr++;
} }
#if defined(SSL_CTX_set_ecdh_auto) #if defined(SSL_CTX_set_ecdh_auto)
@ -4263,8 +4263,8 @@ int ssl_sock_prepare_ctx(struct bind_conf *bind_conf, struct ssl_bind_conf *ssl_
i = OBJ_sn2nid(ecdhe); i = OBJ_sn2nid(ecdhe);
if (!i || ((ecdh = EC_KEY_new_by_curve_name(i)) == NULL)) { if (!i || ((ecdh = EC_KEY_new_by_curve_name(i)) == NULL)) {
Alert("Proxy '%s': unable to set elliptic named curve to '%s' for bind '%s' at [%s:%d].\n", ha_alert("Proxy '%s': unable to set elliptic named curve to '%s' for bind '%s' at [%s:%d].\n",
curproxy->id, ecdhe, bind_conf->arg, bind_conf->file, bind_conf->line); curproxy->id, ecdhe, bind_conf->arg, bind_conf->file, bind_conf->line);
cfgerr++; cfgerr++;
} }
else { else {
@ -4440,7 +4440,7 @@ int ssl_sock_prepare_srv_ctx(struct server *srv)
/* Make sure openssl opens /dev/urandom before the chroot */ /* Make sure openssl opens /dev/urandom before the chroot */
if (!ssl_initialize_random()) { if (!ssl_initialize_random()) {
Alert("OpenSSL random data generator initialization failed.\n"); ha_alert("OpenSSL random data generator initialization failed.\n");
cfgerr++; cfgerr++;
} }
@ -4450,9 +4450,9 @@ int ssl_sock_prepare_srv_ctx(struct server *srv)
/* Initiate SSL context for current server */ /* Initiate SSL context for current server */
if (!srv->ssl_ctx.reused_sess) { if (!srv->ssl_ctx.reused_sess) {
if ((srv->ssl_ctx.reused_sess = calloc(1, global.nbthread*sizeof(*srv->ssl_ctx.reused_sess))) == NULL) { if ((srv->ssl_ctx.reused_sess = calloc(1, global.nbthread*sizeof(*srv->ssl_ctx.reused_sess))) == NULL) {
Alert("Proxy '%s', server '%s' [%s:%d] out of memory.\n", ha_alert("Proxy '%s', server '%s' [%s:%d] out of memory.\n",
curproxy->id, srv->id, curproxy->id, srv->id,
srv->conf.file, srv->conf.line); srv->conf.file, srv->conf.line);
cfgerr++; cfgerr++;
return cfgerr; return cfgerr;
} }
@ -4464,17 +4464,17 @@ int ssl_sock_prepare_srv_ctx(struct server *srv)
ctx = SSL_CTX_new(SSLv23_client_method()); ctx = SSL_CTX_new(SSLv23_client_method());
if (!ctx) { if (!ctx) {
Alert("config : %s '%s', server '%s': unable to allocate ssl context.\n", ha_alert("config : %s '%s', server '%s': unable to allocate ssl context.\n",
proxy_type_str(curproxy), curproxy->id, proxy_type_str(curproxy), curproxy->id,
srv->id); srv->id);
cfgerr++; cfgerr++;
return cfgerr; return cfgerr;
} }
if (conf_ssl_methods->flags && (conf_ssl_methods->min || conf_ssl_methods->max)) if (conf_ssl_methods->flags && (conf_ssl_methods->min || conf_ssl_methods->max))
Warning("config : %s '%s': no-sslv3/no-tlsv1x are ignored for server '%s'. " ha_warning("config : %s '%s': no-sslv3/no-tlsv1x are ignored for server '%s'. "
"Use only 'ssl-min-ver' and 'ssl-max-ver' to fix.\n", "Use only 'ssl-min-ver' and 'ssl-max-ver' to fix.\n",
proxy_type_str(curproxy), curproxy->id, srv->id); proxy_type_str(curproxy), curproxy->id, srv->id);
else else
flags = conf_ssl_methods->flags; flags = conf_ssl_methods->flags;
@ -4492,10 +4492,10 @@ int ssl_sock_prepare_srv_ctx(struct server *srv)
if (methodVersions[i].option && !(flags & methodVersions[i].flag)) { if (methodVersions[i].option && !(flags & methodVersions[i].flag)) {
if (min) { if (min) {
if (hole) { if (hole) {
Warning("config : %s '%s': SSL/TLS versions range not contiguous for server '%s'. " ha_warning("config : %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", "Hole find for %s. Use only 'ssl-min-ver' and 'ssl-max-ver' to fix.\n",
proxy_type_str(curproxy), curproxy->id, srv->id, proxy_type_str(curproxy), curproxy->id, srv->id,
methodVersions[hole].name); methodVersions[hole].name);
hole = 0; hole = 0;
} }
max = i; max = i;
@ -4509,8 +4509,8 @@ int ssl_sock_prepare_srv_ctx(struct server *srv)
hole = i; hole = i;
} }
if (!min) { if (!min) {
Alert("config : %s '%s': all SSL/TLS versions are disabled for server '%s'.\n", ha_alert("config : %s '%s': all SSL/TLS versions are disabled for server '%s'.\n",
proxy_type_str(curproxy), curproxy->id, srv->id); proxy_type_str(curproxy), curproxy->id, srv->id);
cfgerr += 1; cfgerr += 1;
} }
@ -4542,21 +4542,21 @@ int ssl_sock_prepare_srv_ctx(struct server *srv)
if (srv->ssl_ctx.client_crt) { if (srv->ssl_ctx.client_crt) {
if (SSL_CTX_use_PrivateKey_file(srv->ssl_ctx.ctx, srv->ssl_ctx.client_crt, SSL_FILETYPE_PEM) <= 0) { if (SSL_CTX_use_PrivateKey_file(srv->ssl_ctx.ctx, srv->ssl_ctx.client_crt, SSL_FILETYPE_PEM) <= 0) {
Alert("config : %s '%s', server '%s': unable to load SSL private key from PEM file '%s'.\n", ha_alert("config : %s '%s', server '%s': unable to load SSL private key from PEM file '%s'.\n",
proxy_type_str(curproxy), curproxy->id, proxy_type_str(curproxy), curproxy->id,
srv->id, srv->ssl_ctx.client_crt); srv->id, srv->ssl_ctx.client_crt);
cfgerr++; cfgerr++;
} }
else if (SSL_CTX_use_certificate_chain_file(srv->ssl_ctx.ctx, srv->ssl_ctx.client_crt) <= 0) { else if (SSL_CTX_use_certificate_chain_file(srv->ssl_ctx.ctx, srv->ssl_ctx.client_crt) <= 0) {
Alert("config : %s '%s', server '%s': unable to load ssl certificate from PEM file '%s'.\n", ha_alert("config : %s '%s', server '%s': unable to load ssl certificate from PEM file '%s'.\n",
proxy_type_str(curproxy), curproxy->id, proxy_type_str(curproxy), curproxy->id,
srv->id, srv->ssl_ctx.client_crt); srv->id, srv->ssl_ctx.client_crt);
cfgerr++; cfgerr++;
} }
else if (SSL_CTX_check_private_key(srv->ssl_ctx.ctx) <= 0) { else if (SSL_CTX_check_private_key(srv->ssl_ctx.ctx) <= 0) {
Alert("config : %s '%s', server '%s': inconsistencies between private key and certificate loaded from PEM file '%s'.\n", ha_alert("config : %s '%s', server '%s': inconsistencies between private key and certificate loaded from PEM file '%s'.\n",
proxy_type_str(curproxy), curproxy->id, proxy_type_str(curproxy), curproxy->id,
srv->id, srv->ssl_ctx.client_crt); srv->id, srv->ssl_ctx.client_crt);
cfgerr++; cfgerr++;
} }
} }
@ -4578,21 +4578,21 @@ int ssl_sock_prepare_srv_ctx(struct server *srv)
if (srv->ssl_ctx.ca_file) { if (srv->ssl_ctx.ca_file) {
/* load CAfile to verify */ /* load CAfile to verify */
if (!SSL_CTX_load_verify_locations(srv->ssl_ctx.ctx, srv->ssl_ctx.ca_file, NULL)) { if (!SSL_CTX_load_verify_locations(srv->ssl_ctx.ctx, srv->ssl_ctx.ca_file, NULL)) {
Alert("Proxy '%s', server '%s' [%s:%d] unable to load CA file '%s'.\n", ha_alert("Proxy '%s', server '%s' [%s:%d] unable to load CA file '%s'.\n",
curproxy->id, srv->id, curproxy->id, srv->id,
srv->conf.file, srv->conf.line, srv->ssl_ctx.ca_file); srv->conf.file, srv->conf.line, srv->ssl_ctx.ca_file);
cfgerr++; cfgerr++;
} }
} }
else { else {
if (global.ssl_server_verify == SSL_SERVER_VERIFY_REQUIRED) if (global.ssl_server_verify == SSL_SERVER_VERIFY_REQUIRED)
Alert("Proxy '%s', server '%s' [%s:%d] verify is enabled by default but no CA file specified. If you're running on a LAN where you're certain to trust the server's certificate, please set an explicit 'verify none' statement on the 'server' line, or use 'ssl-server-verify none' in the global section to disable server-side verifications by default.\n", ha_alert("Proxy '%s', server '%s' [%s:%d] verify is enabled by default but no CA file specified. If you're running on a LAN where you're certain to trust the server's certificate, please set an explicit 'verify none' statement on the 'server' line, or use 'ssl-server-verify none' in the global section to disable server-side verifications by default.\n",
curproxy->id, srv->id, curproxy->id, srv->id,
srv->conf.file, srv->conf.line); srv->conf.file, srv->conf.line);
else else
Alert("Proxy '%s', server '%s' [%s:%d] verify is enabled but no CA file specified.\n", ha_alert("Proxy '%s', server '%s' [%s:%d] verify is enabled but no CA file specified.\n",
curproxy->id, srv->id, curproxy->id, srv->id,
srv->conf.file, srv->conf.line); srv->conf.file, srv->conf.line);
cfgerr++; cfgerr++;
} }
#ifdef X509_V_FLAG_CRL_CHECK #ifdef X509_V_FLAG_CRL_CHECK
@ -4600,9 +4600,9 @@ int ssl_sock_prepare_srv_ctx(struct server *srv)
X509_STORE *store = SSL_CTX_get_cert_store(srv->ssl_ctx.ctx); X509_STORE *store = SSL_CTX_get_cert_store(srv->ssl_ctx.ctx);
if (!store || !X509_STORE_load_locations(store, srv->ssl_ctx.crl_file, NULL)) { if (!store || !X509_STORE_load_locations(store, srv->ssl_ctx.crl_file, NULL)) {
Alert("Proxy '%s', server '%s' [%s:%d] unable to configure CRL file '%s'.\n", ha_alert("Proxy '%s', server '%s' [%s:%d] unable to configure CRL file '%s'.\n",
curproxy->id, srv->id, curproxy->id, srv->id,
srv->conf.file, srv->conf.line, srv->ssl_ctx.crl_file); srv->conf.file, srv->conf.line, srv->ssl_ctx.crl_file);
cfgerr++; cfgerr++;
} }
else { else {
@ -4617,9 +4617,9 @@ int ssl_sock_prepare_srv_ctx(struct server *srv)
SSL_CTX_sess_set_new_cb(srv->ssl_ctx.ctx, ssl_sess_new_srv_cb); SSL_CTX_sess_set_new_cb(srv->ssl_ctx.ctx, ssl_sess_new_srv_cb);
if (srv->ssl_ctx.ciphers && if (srv->ssl_ctx.ciphers &&
!SSL_CTX_set_cipher_list(srv->ssl_ctx.ctx, srv->ssl_ctx.ciphers)) { !SSL_CTX_set_cipher_list(srv->ssl_ctx.ctx, srv->ssl_ctx.ciphers)) {
Alert("Proxy '%s', server '%s' [%s:%d] : unable to set SSL cipher list to '%s'.\n", ha_alert("Proxy '%s', server '%s' [%s:%d] : unable to set SSL cipher list to '%s'.\n",
curproxy->id, srv->id, curproxy->id, srv->id,
srv->conf.file, srv->conf.line, srv->ssl_ctx.ciphers); srv->conf.file, srv->conf.line, srv->ssl_ctx.ciphers);
cfgerr++; cfgerr++;
} }
@ -4641,7 +4641,7 @@ int ssl_sock_prepare_all_ctx(struct bind_conf *bind_conf)
/* Make sure openssl opens /dev/urandom before the chroot */ /* Make sure openssl opens /dev/urandom before the chroot */
if (!ssl_initialize_random()) { if (!ssl_initialize_random()) {
Alert("OpenSSL random data generator initialization failed.\n"); ha_alert("OpenSSL random data generator initialization failed.\n");
err++; err++;
} }
/* Create initial_ctx used to start the ssl connection before do switchctx */ /* Create initial_ctx used to start the ssl connection before do switchctx */
@ -4689,19 +4689,19 @@ int ssl_sock_prepare_bind_conf(struct bind_conf *bind_conf)
if (!bind_conf->is_ssl) { if (!bind_conf->is_ssl) {
if (bind_conf->default_ctx) { if (bind_conf->default_ctx) {
Warning("Proxy '%s': A certificate was specified but SSL was not enabled on bind '%s' at [%s:%d] (use 'ssl').\n", ha_warning("Proxy '%s': A certificate was specified but SSL was not enabled on bind '%s' at [%s:%d] (use 'ssl').\n",
px->id, bind_conf->arg, bind_conf->file, bind_conf->line); px->id, bind_conf->arg, bind_conf->file, bind_conf->line);
} }
return 0; return 0;
} }
if (!bind_conf->default_ctx) { if (!bind_conf->default_ctx) {
if (bind_conf->strict_sni && !bind_conf->generate_certs) { if (bind_conf->strict_sni && !bind_conf->generate_certs) {
Warning("Proxy '%s': no SSL certificate specified for bind '%s' at [%s:%d], ssl connections will fail (use 'crt').\n", ha_warning("Proxy '%s': no SSL certificate specified for bind '%s' at [%s:%d], ssl connections will fail (use 'crt').\n",
px->id, bind_conf->arg, bind_conf->file, bind_conf->line); px->id, bind_conf->arg, bind_conf->file, bind_conf->line);
} }
else { else {
Alert("Proxy '%s': no SSL certificate specified for bind '%s' at [%s:%d] (use 'crt').\n", ha_alert("Proxy '%s': no SSL certificate specified for bind '%s' at [%s:%d] (use 'crt').\n",
px->id, bind_conf->arg, bind_conf->file, bind_conf->line); px->id, bind_conf->arg, bind_conf->file, bind_conf->line);
return -1; return -1;
} }
} }
@ -4712,9 +4712,9 @@ int ssl_sock_prepare_bind_conf(struct bind_conf *bind_conf)
((global.nbthread > 1) || (!global_ssl.private_cache && (global.nbproc > 1))) ? 1 : 0); ((global.nbthread > 1) || (!global_ssl.private_cache && (global.nbproc > 1))) ? 1 : 0);
if (alloc_ctx < 0) { if (alloc_ctx < 0) {
if (alloc_ctx == SHCTX_E_INIT_LOCK) if (alloc_ctx == SHCTX_E_INIT_LOCK)
Alert("Unable to initialize the lock for the shared SSL session cache. You can retry using the global statement 'tune.ssl.force-private-cache' but it could increase CPU usage due to renegotiations if nbproc > 1.\n"); ha_alert("Unable to initialize the lock for the shared SSL session cache. You can retry using the global statement 'tune.ssl.force-private-cache' but it could increase CPU usage due to renegotiations if nbproc > 1.\n");
else else
Alert("Unable to allocate SSL session cache.\n"); ha_alert("Unable to allocate SSL session cache.\n");
return -1; return -1;
} }
/* free block callback */ /* free block callback */
@ -4825,27 +4825,27 @@ ssl_sock_load_ca(struct bind_conf *bind_conf)
#endif #endif
if (!bind_conf->ca_sign_file) { if (!bind_conf->ca_sign_file) {
Alert("Proxy '%s': cannot enable certificate generation, " ha_alert("Proxy '%s': cannot enable certificate generation, "
"no CA certificate File configured at [%s:%d].\n", "no CA certificate File configured at [%s:%d].\n",
px->id, bind_conf->file, bind_conf->line); px->id, bind_conf->file, bind_conf->line);
goto load_error; goto load_error;
} }
/* read in the CA certificate */ /* read in the CA certificate */
if (!(fp = fopen(bind_conf->ca_sign_file, "r"))) { if (!(fp = fopen(bind_conf->ca_sign_file, "r"))) {
Alert("Proxy '%s': Failed to read CA certificate file '%s' at [%s:%d].\n", ha_alert("Proxy '%s': Failed to read CA certificate file '%s' at [%s:%d].\n",
px->id, bind_conf->ca_sign_file, bind_conf->file, bind_conf->line); px->id, bind_conf->ca_sign_file, bind_conf->file, bind_conf->line);
goto load_error; goto load_error;
} }
if (!(cacert = PEM_read_X509(fp, NULL, NULL, NULL))) { if (!(cacert = PEM_read_X509(fp, NULL, NULL, NULL))) {
Alert("Proxy '%s': Failed to read CA certificate file '%s' at [%s:%d].\n", ha_alert("Proxy '%s': Failed to read CA certificate file '%s' at [%s:%d].\n",
px->id, bind_conf->ca_sign_file, bind_conf->file, bind_conf->line); px->id, bind_conf->ca_sign_file, bind_conf->file, bind_conf->line);
goto read_error; goto read_error;
} }
rewind(fp); rewind(fp);
if (!(capkey = PEM_read_PrivateKey(fp, NULL, NULL, bind_conf->ca_sign_pass))) { if (!(capkey = PEM_read_PrivateKey(fp, NULL, NULL, bind_conf->ca_sign_pass))) {
Alert("Proxy '%s': Failed to read CA private key file '%s' at [%s:%d].\n", ha_alert("Proxy '%s': Failed to read CA private key file '%s' at [%s:%d].\n",
px->id, bind_conf->ca_sign_file, bind_conf->file, bind_conf->line); px->id, bind_conf->ca_sign_file, bind_conf->file, bind_conf->line);
goto read_error; goto read_error;
} }
@ -7312,7 +7312,7 @@ static int parse_tls_method_minmax(char **args, int cur_arg, struct tls_version_
static int ssl_bind_parse_tls_method_minmax(char **args, int cur_arg, struct proxy *px, struct ssl_bind_conf *conf, char **err) static int ssl_bind_parse_tls_method_minmax(char **args, int cur_arg, struct proxy *px, struct ssl_bind_conf *conf, char **err)
{ {
#if (OPENSSL_VERSION_NUMBER < 0x10101000L) || !defined(OPENSSL_IS_BORINGSSL) #if (OPENSSL_VERSION_NUMBER < 0x10101000L) || !defined(OPENSSL_IS_BORINGSSL)
Warning("crt-list: ssl-min-ver and ssl-max-ver are not supported with this Openssl version (skipped).\n"); ha_warning("crt-list: ssl-min-ver and ssl-max-ver are not supported with this Openssl version (skipped).\n");
#endif #endif
return parse_tls_method_minmax(args, cur_arg, &conf->ssl_methods, err); return parse_tls_method_minmax(args, cur_arg, &conf->ssl_methods, err);
} }
@ -7990,7 +7990,7 @@ static int ssl_check_async_engine_count(void) {
int err_code = 0; int err_code = 0;
if (global_ssl.async && (openssl_engines_initialized > 32)) { if (global_ssl.async && (openssl_engines_initialized > 32)) {
Alert("ssl-mode-async only supports a maximum of 32 engines.\n"); ha_alert("ssl-mode-async only supports a maximum of 32 engines.\n");
err_code = ERR_ABORT; err_code = ERR_ABORT;
} }
return err_code; return err_code;

View File

@ -237,8 +237,8 @@ struct uri_auth *stats_add_auth(struct uri_auth **root, char *user)
for (newuser = u->userlist->users; newuser; newuser = newuser->next) for (newuser = u->userlist->users; newuser; newuser = newuser->next)
if (!strcmp(newuser->user, user)) { if (!strcmp(newuser->user, user)) {
Warning("uri auth: ignoring duplicated user '%s'.\n", ha_warning("uri auth: ignoring duplicated user '%s'.\n",
user); user);
return u; return u;
} }

View File

@ -662,7 +662,7 @@ static enum act_return action_store(struct act_rule *rule, struct proxy *px,
default: default:
send_log(px, LOG_ERR, "Vars: internal error while execute action store."); send_log(px, LOG_ERR, "Vars: internal error while execute action store.");
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
Alert("Vars: internal error while execute action store.\n"); ha_alert("Vars: internal error while execute action store.\n");
return ACT_RET_CONT; return ACT_RET_CONT;
} }

View File

@ -299,7 +299,7 @@ static int ha_wurfl_init(void)
global_wurfl.handle = wurfl_create(); global_wurfl.handle = wurfl_create();
if (global_wurfl.handle == NULL) { if (global_wurfl.handle == NULL) {
Warning("WURFL: Engine handler creation failed"); ha_warning("WURFL: Engine handler creation failed");
send_log(NULL, LOG_WARNING, "WURFL: Engine handler creation failed\n"); send_log(NULL, LOG_WARNING, "WURFL: Engine handler creation failed\n");
return ERR_WARN; return ERR_WARN;
} }
@ -308,18 +308,18 @@ static int ha_wurfl_init(void)
// set wurfl data file // set wurfl data file
if (global_wurfl.data_file == NULL) { if (global_wurfl.data_file == NULL) {
Warning("WURFL: missing wurfl-data-file parameter in global configuration\n"); ha_warning("WURFL: missing wurfl-data-file parameter in global configuration\n");
send_log(NULL, LOG_WARNING, "WURFL: missing wurfl-data-file parameter in global configuration\n"); send_log(NULL, LOG_WARNING, "WURFL: missing wurfl-data-file parameter in global configuration\n");
return ERR_WARN; return ERR_WARN;
} }
if (global.nbthread > 1) { if (global.nbthread > 1) {
Alert("WURFL: multithreading is not supported for now.\n"); ha_alert("WURFL: multithreading is not supported for now.\n");
return (ERR_FATAL | ERR_ALERT); return (ERR_FATAL | ERR_ALERT);
} }
if (wurfl_set_root(global_wurfl.handle, global_wurfl.data_file) != WURFL_OK) { if (wurfl_set_root(global_wurfl.handle, global_wurfl.data_file) != WURFL_OK) {
Warning("WURFL: Engine setting root file failed - %s\n", wurfl_get_error_message(global_wurfl.handle)); ha_warning("WURFL: Engine setting root file failed - %s\n", wurfl_get_error_message(global_wurfl.handle));
send_log(NULL, LOG_WARNING, "WURFL: Engine setting root file failed - %s\n", wurfl_get_error_message(global_wurfl.handle)); send_log(NULL, LOG_WARNING, "WURFL: Engine setting root file failed - %s\n", wurfl_get_error_message(global_wurfl.handle));
return ERR_WARN; return ERR_WARN;
} }
@ -330,7 +330,7 @@ static int ha_wurfl_init(void)
// load wurfl data needed ( and filter whose are supposed to be capabilities ) // load wurfl data needed ( and filter whose are supposed to be capabilities )
if (LIST_ISEMPTY(&global_wurfl.information_list)) { if (LIST_ISEMPTY(&global_wurfl.information_list)) {
Warning("WURFL: missing wurfl-information-list parameter in global configuration\n"); ha_warning("WURFL: missing wurfl-information-list parameter in global configuration\n");
send_log(NULL, LOG_WARNING, "WURFL: missing wurfl-information-list parameter in global configuration\n"); send_log(NULL, LOG_WARNING, "WURFL: missing wurfl-information-list parameter in global configuration\n");
return ERR_WARN; return ERR_WARN;
} else { } else {
@ -352,7 +352,7 @@ static int ha_wurfl_init(void)
wi->data.type = HA_WURFL_DATA_TYPE_CAP; wi->data.type = HA_WURFL_DATA_TYPE_CAP;
if (wurfl_add_requested_capability(global_wurfl.handle, wi->data.name) != WURFL_OK) { if (wurfl_add_requested_capability(global_wurfl.handle, wi->data.name) != WURFL_OK) {
Warning("WURFL: capability filtering failed - %s\n", wurfl_get_error_message(global_wurfl.handle)); ha_warning("WURFL: capability filtering failed - %s\n", wurfl_get_error_message(global_wurfl.handle));
send_log(NULL, LOG_WARNING, "WURFL: capability filtering failed - %s\n", wurfl_get_error_message(global_wurfl.handle)); send_log(NULL, LOG_WARNING, "WURFL: capability filtering failed - %s\n", wurfl_get_error_message(global_wurfl.handle));
return ERR_WARN; return ERR_WARN;
} }
@ -366,7 +366,7 @@ static int ha_wurfl_init(void)
wn = malloc(sizeof(wurfl_data_t) + len + 1); wn = malloc(sizeof(wurfl_data_t) + len + 1);
if (wn == NULL) { if (wn == NULL) {
Warning("WURFL: Error allocating memory for information tree element.\n"); ha_warning("WURFL: Error allocating memory for information tree element.\n");
send_log(NULL, LOG_WARNING, "WURFL: Error allocating memory for information tree element.\n"); send_log(NULL, LOG_WARNING, "WURFL: Error allocating memory for information tree element.\n");
return ERR_WARN; return ERR_WARN;
} }
@ -378,7 +378,7 @@ static int ha_wurfl_init(void)
wn->nd.key[len] = 0; wn->nd.key[len] = 0;
if (!ebst_insert(&global_wurfl.btree, &wn->nd)) { if (!ebst_insert(&global_wurfl.btree, &wn->nd)) {
Warning("WURFL: [%s] not inserted in btree\n",wn->name); ha_warning("WURFL: [%s] not inserted in btree\n",wn->name);
send_log(NULL, LOG_WARNING, "WURFL: [%s] not inserted in btree\n",wn->name); send_log(NULL, LOG_WARNING, "WURFL: [%s] not inserted in btree\n",wn->name);
return ERR_WARN; return ERR_WARN;
} }
@ -402,7 +402,7 @@ static int ha_wurfl_init(void)
if (ebst_lookup(&global_wurfl.btree, name) == NULL) { if (ebst_lookup(&global_wurfl.btree, name) == NULL) {
if (wurfl_add_requested_capability(global_wurfl.handle, name) != WURFL_OK) { if (wurfl_add_requested_capability(global_wurfl.handle, name) != WURFL_OK) {
Warning("WURFL: Engine adding mandatory capability [%s] failed - %s\n", name, wurfl_get_error_message(global_wurfl.handle)); ha_warning("WURFL: Engine adding mandatory capability [%s] failed - %s\n", name, wurfl_get_error_message(global_wurfl.handle));
send_log(NULL, LOG_WARNING, "WURFL: Adding mandatory capability [%s] failed - %s\n", name, wurfl_get_error_message(global_wurfl.handle)); send_log(NULL, LOG_WARNING, "WURFL: Adding mandatory capability [%s] failed - %s\n", name, wurfl_get_error_message(global_wurfl.handle));
return ERR_WARN; return ERR_WARN;
} }
@ -423,7 +423,7 @@ static int ha_wurfl_init(void)
list_for_each_entry(wp, &global_wurfl.patch_file_list, list) { list_for_each_entry(wp, &global_wurfl.patch_file_list, list) {
if (wurfl_add_patch(global_wurfl.handle, wp->patch_file_path) != WURFL_OK) { if (wurfl_add_patch(global_wurfl.handle, wp->patch_file_path) != WURFL_OK) {
Warning("WURFL: Engine adding patch file failed - %s\n", wurfl_get_error_message(global_wurfl.handle)); ha_warning("WURFL: Engine adding patch file failed - %s\n", wurfl_get_error_message(global_wurfl.handle));
send_log(NULL, LOG_WARNING, "WURFL: Adding engine patch file failed - %s\n", wurfl_get_error_message(global_wurfl.handle)); send_log(NULL, LOG_WARNING, "WURFL: Adding engine patch file failed - %s\n", wurfl_get_error_message(global_wurfl.handle));
return ERR_WARN; return ERR_WARN;
} }
@ -447,7 +447,7 @@ static int ha_wurfl_init(void)
} }
if (wurfl_result_code != WURFL_OK) { if (wurfl_result_code != WURFL_OK) {
Warning("WURFL: Setting cache to [%s] failed - %s\n", global_wurfl.cache_size, wurfl_get_error_message(global_wurfl.handle)); ha_warning("WURFL: Setting cache to [%s] failed - %s\n", global_wurfl.cache_size, wurfl_get_error_message(global_wurfl.handle));
send_log(NULL, LOG_WARNING, "WURFL: Setting cache to [%s] failed - %s\n", global_wurfl.cache_size, wurfl_get_error_message(global_wurfl.handle)); send_log(NULL, LOG_WARNING, "WURFL: Setting cache to [%s] failed - %s\n", global_wurfl.cache_size, wurfl_get_error_message(global_wurfl.handle));
return ERR_WARN; return ERR_WARN;
} }
@ -458,7 +458,7 @@ static int ha_wurfl_init(void)
// setting engine mode if specified in cfg, otherwise let engine choose // setting engine mode if specified in cfg, otherwise let engine choose
if (global_wurfl.engine_mode != -1) { if (global_wurfl.engine_mode != -1) {
if (wurfl_set_engine_target(global_wurfl.handle, global_wurfl.engine_mode) != WURFL_OK ) { if (wurfl_set_engine_target(global_wurfl.handle, global_wurfl.engine_mode) != WURFL_OK ) {
Warning("WURFL: Setting engine target failed - %s\n", wurfl_get_error_message(global_wurfl.handle)); ha_warning("WURFL: Setting engine target failed - %s\n", wurfl_get_error_message(global_wurfl.handle));
send_log(NULL, LOG_WARNING, "WURFL: Setting engine target failed - %s\n", wurfl_get_error_message(global_wurfl.handle)); send_log(NULL, LOG_WARNING, "WURFL: Setting engine target failed - %s\n", wurfl_get_error_message(global_wurfl.handle));
return ERR_WARN; return ERR_WARN;
} }
@ -470,7 +470,7 @@ static int ha_wurfl_init(void)
// setting ua priority if specified in cfg, otherwise let engine choose // setting ua priority if specified in cfg, otherwise let engine choose
if (global_wurfl.useragent_priority != -1) { if (global_wurfl.useragent_priority != -1) {
if (wurfl_set_useragent_priority(global_wurfl.handle, global_wurfl.useragent_priority) != WURFL_OK ) { if (wurfl_set_useragent_priority(global_wurfl.handle, global_wurfl.useragent_priority) != WURFL_OK ) {
Warning("WURFL: Setting engine useragent priority failed - %s\n", wurfl_get_error_message(global_wurfl.handle)); ha_warning("WURFL: Setting engine useragent priority failed - %s\n", wurfl_get_error_message(global_wurfl.handle));
send_log(NULL, LOG_WARNING, "WURFL: Setting engine useragent priority failed - %s\n", wurfl_get_error_message(global_wurfl.handle)); send_log(NULL, LOG_WARNING, "WURFL: Setting engine useragent priority failed - %s\n", wurfl_get_error_message(global_wurfl.handle));
return ERR_WARN; return ERR_WARN;
} }
@ -481,7 +481,7 @@ static int ha_wurfl_init(void)
// loading WURFL engine // loading WURFL engine
if (wurfl_load(global_wurfl.handle) != WURFL_OK) { if (wurfl_load(global_wurfl.handle) != WURFL_OK) {
Warning("WURFL: Engine load failed - %s\n", wurfl_get_error_message(global_wurfl.handle)); ha_warning("WURFL: Engine load failed - %s\n", wurfl_get_error_message(global_wurfl.handle));
send_log(NULL, LOG_WARNING, "WURFL: Engine load failed - %s\n", wurfl_get_error_message(global_wurfl.handle)); send_log(NULL, LOG_WARNING, "WURFL: Engine load failed - %s\n", wurfl_get_error_message(global_wurfl.handle));
return ERR_WARN; return ERR_WARN;
} }