From: Willy Tarreau Date: Tue, 5 Mar 2019 17:14:03 +0000 (+0100) Subject: MINOR: config: relax the range checks on cpu-map X-Git-Tag: v2.0-dev2~122 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5799e9cd37301ab74436954e860250c3f26e4d79;p=thirdparty%2Fhaproxy.git MINOR: config: relax the range checks on cpu-map Emeric reports that when MAX_THREADS and/or MAX_PROCS are set to lower values, referencing thread or process numbers higher than these limits in cpu-map returns errors. This is annoying because these typically are silent settings that are expected to be used only when set. Let's switch back to LONGBITS for this limit. --- diff --git a/src/cfgparse-global.c b/src/cfgparse-global.c index e1835e7b68..117347aba4 100644 --- a/src/cfgparse-global.c +++ b/src/cfgparse-global.c @@ -942,7 +942,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) ha_alert("parsing [%s:%d] : %s expects a process number " " ('all', 'odd', 'even', a number from 1 to %d or a range), " " followed by a list of CPU ranges with numbers from 0 to %d.\n", - file, linenum, args[0], MAX_PROCS, LONGBITS - 1); + file, linenum, args[0], LONGBITS, LONGBITS - 1); err_code |= ERR_ALERT | ERR_FATAL; goto out; } @@ -950,14 +950,18 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) if ((slash = strchr(args[1], '/')) != NULL) *slash = 0; - if (parse_process_number(args[1], &proc, MAX_PROCS, &autoinc, &errmsg)) { + /* note: we silently ignore processes over MAX_PROCS and + * threads over MAX_THREADS so as not to make configurations a + * pain to maintain. + */ + if (parse_process_number(args[1], &proc, LONGBITS, &autoinc, &errmsg)) { ha_alert("parsing [%s:%d] : %s : %s\n", file, linenum, args[0], errmsg); err_code |= ERR_ALERT | ERR_FATAL; goto out; } if (slash) { - if (parse_process_number(slash+1, &thread, MAX_THREADS, NULL, &errmsg)) { + if (parse_process_number(slash+1, &thread, LONGBITS, NULL, &errmsg)) { ha_alert("parsing [%s:%d] : %s : %s\n", file, linenum, args[0], errmsg); err_code |= ERR_ALERT | ERR_FATAL; goto out;