]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: listeners: check the current listener state in pause_listener()
authorWilly Tarreau <w@1wt.eu>
Thu, 24 Sep 2020 12:46:34 +0000 (14:46 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 9 Oct 2020 09:27:30 +0000 (11:27 +0200)
It's better not to try to perform pause() actions on wrong states, so
let's check this and make sure that all callers are now safe. This
means that we must not try to pause a listener which is already paused
(e.g. it could possibly fail if the pause operation isn't idempotent at
the socket level), nor should we try it on earlier states.

src/listener.c

index c4ee3c31907999b6f1a21f6775302f9249a7c08b..6370a9f30bc55d3d7f4b60fde89f16f5d9e2ed0f 100644 (file)
@@ -343,6 +343,9 @@ int pause_listener(struct listener *l)
            !(proc_mask(l->rx.settings->bind_proc) & pid_bit))
                goto end;
 
+       if (l->state <= LI_PAUSED)
+               goto end;
+
        if (l->rx.proto->pause) {
                /* Returns < 0 in case of failure, 0 if the listener
                 * was totally stopped, or > 0 if correctly paused.