]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: backend: add new fields in lbprm to store more LB options
authorWilly Tarreau <w@1wt.eu>
Mon, 14 Jan 2019 15:04:01 +0000 (16:04 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 14 Jan 2019 18:33:17 +0000 (19:33 +0100)
Some algorithms require a few extra options (up to 3). Let's provide
some room in lbprm to store them, and make sure they're passed from
defaults to backends.

include/types/backend.h
src/cfgparse-listen.c

index 3271eea4c7dd0407d3be4eef0cdbc846549ce954..e67f0be54adde62951054634d4c5e967cef129c8 100644 (file)
@@ -146,6 +146,9 @@ struct lbprm {
        int wdiv;                       /* ratio between effective weight and user weight */
        char *arg_str;                  /* name of the URL parameter/header/cookie used for hashing */
        int   arg_len;                  /* strlen(arg_str), computed only once */
+       int   arg_opt1;                 /* extra option 1 for the LB algo (algo-specific) */
+       int   arg_opt2;                 /* extra option 2 for the LB algo (algo-specific) */
+       int   arg_opt3;                 /* extra option 3 for the LB algo (algo-specific) */
        struct server *fbck;            /* first backup server when !PR_O_USE_ALL_BK, or NULL */
        struct lb_map map;              /* LB parameters for map-based algorithms */
        struct lb_fwrr fwrr;
index 4a6c73b2371b6f6f05e5fbcb10b9eb929381c5e1..9774bba5f885b9c9a107733390b5301c5a3fd73a 100644 (file)
@@ -467,9 +467,14 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                                 curproxy->rdp_cookie_name = strdup(defproxy.rdp_cookie_name);
                        curproxy->rdp_cookie_len = defproxy.rdp_cookie_len;
 
+
                        if (defproxy.lbprm.arg_str)
                                curproxy->lbprm.arg_str = strdup(defproxy.lbprm.arg_str);
                        curproxy->lbprm.arg_len  = defproxy.lbprm.arg_len;
+                       curproxy->lbprm.arg_opt1 = defproxy.lbprm.arg_opt1;
+                       curproxy->lbprm.arg_opt2 = defproxy.lbprm.arg_opt2;
+                       curproxy->lbprm.arg_opt3 = defproxy.lbprm.arg_opt3;
+
                        curproxy->uri_whole       = defproxy.uri_whole;
                        curproxy->uri_len_limit   = defproxy.uri_len_limit;
                        curproxy->uri_dirs_depth1 = defproxy.uri_dirs_depth1;