mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
MINOR: cfgparse: parse tune.{rcvbuf,sndbuf}.{frontend,backend} as sizes
Till now these values were 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 them so that units are supported. This requires to turn them to uint as well, which is OK.
This commit is contained in:
parent
a923c72357
commit
f9f28b7584
@ -4085,8 +4085,8 @@ tune.renice.startup <number>
|
|||||||
|
|
||||||
See also: tune.renice.runtime
|
See also: tune.renice.runtime
|
||||||
|
|
||||||
tune.rcvbuf.backend <number>
|
tune.rcvbuf.backend <size>
|
||||||
tune.rcvbuf.frontend <number>
|
tune.rcvbuf.frontend <size>
|
||||||
For the kernel socket receive buffer size on non-connected sockets to this
|
For the kernel socket receive buffer size on non-connected sockets to this
|
||||||
size. This can be used QUIC in listener mode and log-forward on the frontend.
|
size. This can be used QUIC in listener mode and log-forward on the frontend.
|
||||||
The default system buffers might sometimes be too small for sockets receiving
|
The default system buffers might sometimes be too small for sockets receiving
|
||||||
@ -4148,8 +4148,8 @@ tune.sched.low-latency { on | off }
|
|||||||
massive traffic, at the expense of a higher impact on this large traffic.
|
massive traffic, at the expense of a higher impact on this large traffic.
|
||||||
For regular usage it is better to leave this off. The default value is off.
|
For regular usage it is better to leave this off. The default value is off.
|
||||||
|
|
||||||
tune.sndbuf.backend <number>
|
tune.sndbuf.backend <size>
|
||||||
tune.sndbuf.frontend <number>
|
tune.sndbuf.frontend <size>
|
||||||
For the kernel socket send buffer size on non-connected sockets to this size.
|
For the kernel socket send buffer size on non-connected sockets to this size.
|
||||||
This can be used for UNIX socket and UDP logging on the backend side, and for
|
This can be used for UNIX socket and UDP logging on the backend side, and for
|
||||||
QUIC in listener mode on the frontend. The default system buffers might
|
QUIC in listener mode on the frontend. The default system buffers might
|
||||||
|
@ -174,10 +174,10 @@ struct global {
|
|||||||
uint client_rcvbuf; /* set client rcvbuf to this value if not null */
|
uint client_rcvbuf; /* set client rcvbuf to this value if not null */
|
||||||
uint server_sndbuf; /* set server sndbuf to this value if not null */
|
uint server_sndbuf; /* set server sndbuf to this value if not null */
|
||||||
uint server_rcvbuf; /* set server rcvbuf to this value if not null */
|
uint server_rcvbuf; /* set server rcvbuf to this value if not null */
|
||||||
int frontend_sndbuf; /* set frontend dgram sndbuf to this value if not null */
|
uint frontend_sndbuf; /* set frontend dgram sndbuf to this value if not null */
|
||||||
int frontend_rcvbuf; /* set frontend dgram rcvbuf to this value if not null */
|
uint frontend_rcvbuf; /* set frontend dgram rcvbuf to this value if not null */
|
||||||
int backend_sndbuf; /* set backend dgram sndbuf to this value if not null */
|
uint backend_sndbuf; /* set backend dgram sndbuf to this value if not null */
|
||||||
int backend_rcvbuf; /* set backend dgram rcvbuf 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 */
|
int 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 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 requri_len; /* max len of request URI, use REQURI_LEN if zero */
|
||||||
|
11
src/dgram.c
11
src/dgram.c
@ -37,8 +37,9 @@ static int dgram_parse_tune_bufs(char **args, int section_type, struct proxy *cu
|
|||||||
const struct proxy *defpx, const char *file, int line,
|
const struct proxy *defpx, const char *file, int line,
|
||||||
char **err)
|
char **err)
|
||||||
{
|
{
|
||||||
int *valptr;
|
const char *res;
|
||||||
int val;
|
uint *valptr;
|
||||||
|
uint val;
|
||||||
|
|
||||||
if (too_many_args(1, args, err, NULL))
|
if (too_many_args(1, args, err, NULL))
|
||||||
return -1;
|
return -1;
|
||||||
@ -56,7 +57,11 @@ static int dgram_parse_tune_bufs(char **args, int section_type, struct proxy *cu
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = atoi(args[1]);
|
res = parse_size_err(args[1], &val);
|
||||||
|
if (res != NULL) {
|
||||||
|
memprintf(err, "parsing [%s:%d]: unexpected '%s' after size passed to '%s'", file, line, res, args[0]);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (*(args[1]) == 0 || val <= 0) {
|
if (*(args[1]) == 0 || val <= 0) {
|
||||||
memprintf(err, "parsing [%s:%d] : '%s' expects a strictly positive integer argument.\n", file, line, args[0]);
|
memprintf(err, "parsing [%s:%d] : '%s' expects a strictly positive integer argument.\n", file, line, args[0]);
|
||||||
|
Loading…
Reference in New Issue
Block a user