]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: peers: Forbid <shards> value greater than 65535
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 14 Oct 2025 16:46:33 +0000 (18:46 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 30 Oct 2025 13:41:08 +0000 (14:41 +0100)
The "shard" server parameter is now limited to a 2-bytes integer, so lower
than 65535. The idea is to limit its size and save some bytes in the stksess
structure.

doc/configuration.txt
src/cfgparse.c

index 7eaaf34192274a770ac3d189cdc966d589dab527..a6b3e20960ad3cc420027cf95d19b9aa233e3a8c 100644 (file)
@@ -30181,11 +30181,11 @@ server <peername> [/<path>] [param*]
         server haproxy3 10.2.0.1:1024
 
 shards <shards>
-
   In some configurations, one would like to distribute the stick-table contents
   to some peers in place of sending all the stick-table contents to each peer
-  declared in the "peers" section. In such cases, "shards" specifies the
-  number of peer involved in this stick-table contents distribution.
+  declared in the "peers" section. In such cases, "shards" specifies the number
+  of peer involved in this stick-table contents distribution. It must be an
+  integer value between 1 and 65535.
   See also "shard" server parameter.
 
 table <tablename> type {ip | integer | string [len <length>] | binary [len <length>]}
index f411d6ea1b4713e8d531806530269fc6dd303596..56375c1948508d4220ac82bb46323c91d4ad8f55 100644 (file)
@@ -1010,8 +1010,8 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
                        goto out;
                }
 
-               if (!curpeers->nb_shards) {
-                       ha_alert("parsing [%s:%d] : '%s' : expects a strictly positive integer argument\n",
+               if (!curpeers->nb_shards || curpeers->nb_shards > 65535) {
+                       ha_alert("parsing [%s:%d] : '%s' : expects a integer argument between 1 and 65535\n",
                                 file, linenum, args[0]);
                        err_code |= ERR_FATAL;
                        goto out;