]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: config: relax the range checks on cpu-map
authorWilly Tarreau <w@1wt.eu>
Tue, 5 Mar 2019 17:14:03 +0000 (18:14 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 5 Mar 2019 17:14:03 +0000 (18:14 +0100)
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.

src/cfgparse-global.c

index e1835e7b687ad3a3d7a2c2ad4399c49389c62a8c..117347aba45d5e18d79c8f5d9e23e4daa1fa757a 100644 (file)
@@ -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;