]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: backend: properly handle redispatch 0
authorWilly Tarreau <w@1wt.eu>
Tue, 2 Apr 2024 13:15:32 +0000 (15:15 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 2 Apr 2024 13:19:18 +0000 (15:19 +0200)
According to the documentation, "option redispatch 0" is expected to
disable redispatch just like "no option redispatch", but due to the
fact that it keeps PR_O_REDISP set, it doesn't actually work. Let's
make sure value 0 is properly handled and drops PR_O_REDISP. This can
be backported to all versions since it seems it has been broken since
its introduction in 1.6 with commit 726ab7145c ("MEDIUM: backend: Allow
redispatch on retry intervals").

As a workaround, "no option redispatch" does work though.

src/cfgparse-listen.c

index 4f88b77d65bc3172f5b04e3264f1d4cb643a051f..a97b1e55de6545ebbe5df8ebffee9d4bced08701 100644 (file)
@@ -2050,8 +2050,10 @@ stats_error_parsing:
                        case KWM_STD:
                                curproxy->options |= PR_O_REDISP;
                                curproxy->redispatch_after = -1;
-                               if(*args[2]) {
+                               if (*args[2]) {
                                        curproxy->redispatch_after = atol(args[2]);
+                                       if (!curproxy->redispatch_after)
+                                               curproxy->options &= ~PR_O_REDISP;
                                }
                                break;
                        case KWM_NO: