From e9b774f4b372d05c1a839cc6c5dcf8eb72046b7b Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 2 Apr 2024 15:15:32 +0200 Subject: [PATCH] BUG/MINOR: backend: properly handle redispatch 0 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index 4f88b77d6..a97b1e55d 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -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: