]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: spoe: Add "max-frame-size" statement in spoe-agent section
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 27 Feb 2017 08:40:34 +0000 (09:40 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 9 Mar 2017 14:32:56 +0000 (15:32 +0100)
As its named said, this statement customize the maximum allowed size for frames
exchanged between HAProxy and SPOAs. It should be greater than or equal to 256
and less than or equal to (tune.bufsize - 4) (4 bytes are reserved to the frame
length).

src/flt_spoe.c

index 7b332221f969b01bae2dbc92b140d0bd335e010e..42e9c0c16bf01ce43e4831931c32becdd3657eaf 100644 (file)
@@ -3244,6 +3244,24 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
                        goto out;
                curagent->eps_max = atol(args[1]);
        }
+       else if (!strcmp(args[0], "max-frame-size")) {
+               if (!*args[1]) {
+                       Alert("parsing [%s:%d] : '%s' expects an integer argument.\n",
+                              file, linenum, args[0]);
+                        err_code |= ERR_ALERT | ERR_FATAL;
+                        goto out;
+                }
+               if (alertif_too_many_args(1, file, linenum, args, &err_code))
+                       goto out;
+               curagent->max_frame_size = atol(args[1]);
+               if (curagent->max_frame_size < MIN_FRAME_SIZE ||
+                   curagent->max_frame_size > MAX_FRAME_SIZE) {
+                       Alert("parsing [%s:%d] : '%s' expects a positive integer argument in the range [%d, %d].\n",
+                             file, linenum, args[0], MIN_FRAME_SIZE, MAX_FRAME_SIZE);
+                       err_code |= ERR_ALERT | ERR_FATAL;
+                       goto out;
+               }
+       }
        else if (*args[0]) {
                Alert("parsing [%s:%d] : unknown keyword '%s' in spoe-agent section.\n",
                      file, linenum, args[0]);