From: Marcin Deranek Date: Thu, 22 Dec 2016 15:21:08 +0000 (+0100) Subject: BUG/MINOR: backend: nbsrv() should return 0 if backend is disabled X-Git-Tag: v1.8-dev1~195 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=57b877147d726a743a038e7101b6d2e6922116c7;p=thirdparty%2Fhaproxy.git BUG/MINOR: backend: nbsrv() should return 0 if backend is disabled According to nbsrv() documentation this fetcher should return "an integer value corresponding to the number of usable servers". In case backend is disabled none of servers is usable, so I believe fetcher should return 0. This patch should be backported to 1.7, 1.6, 1.5. --- diff --git a/src/backend.c b/src/backend.c index 658212de4d..3acb1daeb7 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1607,7 +1607,9 @@ smp_fetch_nbsrv(const struct arg *args, struct sample *smp, const char *kw, void smp->data.type = SMP_T_SINT; px = args->data.prx; - if (px->srv_act) + if (px->state == PR_STSTOPPED) + smp->data.u.sint = 0; + else if (px->srv_act) smp->data.u.sint = px->srv_act; else if (px->lbprm.fbck) smp->data.u.sint = 1;