]> git.kaiwu.me - haproxy.git/commitdiff
WIP/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>
Fri, 17 Oct 2025 14:38:53 +0000 (16:38 +0200)
doc/configuration.txt
src/cfgparse.c

index 14b2e8812489bcc5412e4022fefed7ba4261211b..1d20b3fb4443ab86dad26bee463b98045984bf44 100644 (file)
@@ -29994,11 +29994,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 609d24bc7f13a97ab72aecc80937dafdb8a8a537..b4215674432bd41e64de0e72ec343f6cca5335f3 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;