]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: lua: Fix bitwise logic for hlua_server_check_* functions.
authorAdis Nezirovic <anezirovic@haproxy.com>
Wed, 26 Jul 2017 07:19:06 +0000 (09:19 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 28 Jul 2017 13:24:57 +0000 (15:24 +0200)
The logical operations were inverted so enable/disable operations did
the opposite.

The bug is present since 1.7 so the fix should be backported there.

src/hlua_fcn.c

index 6992613292e89487c35689db9bbe23d383cddd67..bc6bc914df7ee12e75e73df0aa4ae98263ca67f5 100644 (file)
@@ -662,7 +662,7 @@ int hlua_server_check_enable(lua_State *L)
 
        sv = hlua_check_server(L, 1);
        if (sv->check.state & CHK_ST_CONFIGURED) {
-               sv->check.state &= ~CHK_ST_ENABLED;
+               sv->check.state |= CHK_ST_ENABLED;
        }
        return 0;
 }
@@ -673,7 +673,7 @@ int hlua_server_check_disable(lua_State *L)
 
        sv = hlua_check_server(L, 1);
        if (sv->check.state & CHK_ST_CONFIGURED) {
-               sv->check.state |= CHK_ST_ENABLED;
+               sv->check.state &= ~CHK_ST_ENABLED;
        }
        return 0;
 }