]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cfgparse: parse tune.pipesize as a size
authorWilly Tarreau <w@1wt.eu>
Mon, 18 Nov 2024 17:51:31 +0000 (18:51 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 18 Nov 2024 17:51:31 +0000 (18:51 +0100)
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.

doc/configuration.txt
include/haproxy/global-t.h
src/cfgparse-global.c

index 22bc250ffa3881065c512885625db450e2d6debd..09762df884c462fb48c122dfa673479a008a8ee0 100644 (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
index 40cfa4ddebc138bd446bad808d6a7aa34ef6c6eb..0d683158671ce846bfb506bd0cf1e7ec0b47eb4c 100644 (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 */
index 77f2e0f61375908c15a56e2e4703d5054070ceab..13842bb1994ae50bf8aaa68f6f1b97d2b3f68395 100644 (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;
        }