]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: proxy: Use .disabled field as a bitfield as documented
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 30 Sep 2021 16:11:54 +0000 (18:11 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 15 Oct 2021 12:12:19 +0000 (14:12 +0200)
.disabled field in the proxy structure is documented to be a bitfield. So
use it as a bitfield. This change was introduced to the 2.5, by commit
8e765b86f ("MINOR: proxy: disabled takes a stopping and a disabled state").

No backport is needed except if the above commit is backported.

src/cfgparse-listen.c
src/cfgparse.c
src/mworker.c
src/proxy.c

index 98e31ec665a2aa8001f197647356f2c9ee59aa57..6f526d4fd5ac75dad7fd834804a5b91e36c866d5 100644 (file)
@@ -595,7 +595,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
        else if (strcmp(args[0], "disabled") == 0) {  /* disables this proxy */
                if (alertif_too_many_args(0, file, linenum, args, &err_code))
                        goto out;
-               curproxy->disabled = PR_DISABLED;
+               curproxy->disabled |= PR_DISABLED;
        }
        else if (strcmp(args[0], "enabled") == 0) {  /* enables this proxy (used to revert a disabled default) */
                if (alertif_too_many_args(0, file, linenum, args, &err_code))
index 173dcdb3254a7ef5347613ea36aaf9b662558560..e606a47bc9d4a1dbccb699f242d604f876cf13db 100644 (file)
@@ -1019,7 +1019,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
                stktables_list = t;
        }
        else if (strcmp(args[0], "disabled") == 0) {  /* disables this peers section */
-               curpeers->disabled = PR_DISABLED;
+               curpeers->disabled |= PR_DISABLED;
        }
        else if (strcmp(args[0], "enabled") == 0) {  /* enables this peers section (used to revert a disabled default) */
                curpeers->disabled = 0;
index ca1cc74248f0b4dda7dbb1dc128f1b2773dfe912..7c737801f66f10470a93fc7d74f3968db2fed96b 100644 (file)
@@ -443,7 +443,7 @@ void mworker_cleanlisteners()
                }
                /* if the proxy shouldn't be in the master, we stop it */
                if (!listen_in_master)
-                       curproxy->disabled = PR_DISABLED;
+                       curproxy->disabled |= PR_DISABLED;
        }
 }
 
index 6868eff44d45e3d62345d6d43981b87d33e51021..4dbf67111ea11c42d1c574f553aa26c00d0d2496 100644 (file)
@@ -1823,7 +1823,7 @@ void proxy_cond_disable(struct proxy *p)
        if (p->li_ready + p->li_paused > 0)
                return;
 
-       p->disabled = PR_STOPPED;
+       p->disabled |= PR_STOPPED;
 
        /* Note: syslog proxies use their own loggers so while it's somewhat OK
         * to report them being stopped as a warning, we must not spam their log