MINOR: cfgparse: parse tune.pipesize as a size

Till now this value was parsed as raw integer using atol() and would
silently ignore any trailing suffix, causing unexpected behaviors when
set, e.g. to "512k". Let's make use of parse_size_err() on it so that
units are supported. This requires to turn it to uint as well, which
was verified to be OK.
This commit is contained in:
Willy Tarreau 2024-11-18 18:51:31 +01:00
parent f9f28b7584
commit a90a7d4d60
3 changed files with 5 additions and 3 deletions

View File

@ -3899,7 +3899,7 @@ tune.peers.max-updates-at-once <number>
Conversely low values may also incur higher CPU overhead, and take longer
to complete. The default value is 200 and it is suggested not to change it.
tune.pipesize <number>
tune.pipesize <size>
Sets the kernel pipe buffer size to this size (in bytes). By default, pipes
are the default size for the system. But sometimes when using TCP splicing,
it can improve performance to increase pipe sizes, especially if it is

View File

@ -178,7 +178,7 @@ struct global {
uint frontend_rcvbuf; /* set frontend dgram rcvbuf to this value if not null */
uint backend_sndbuf; /* set backend dgram sndbuf to this value if not null */
uint backend_rcvbuf; /* set backend dgram rcvbuf to this value if not null */
int pipesize; /* pipe size in bytes, system defaults if zero */
uint pipesize; /* pipe size in bytes, system defaults if zero */
int max_http_hdr; /* max number of HTTP headers, use MAX_HTTP_HDR if zero */
int requri_len; /* max len of request URI, use REQURI_LEN if zero */
int cookie_len; /* max length of cookie captures */

View File

@ -1308,7 +1308,9 @@ static int cfg_parse_global_tune_opts(char **args, int section_type,
memprintf(err, "'%s' expects an integer argument.", args[0]);
return -1;
}
global.tune.pipesize = atol(args[1]);
res = parse_size_err(args[1], &global.tune.pipesize);
if (res != NULL)
goto size_err;
return 0;
}