]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: rhttp: prevent listener suspend
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 16 May 2024 15:35:31 +0000 (17:35 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 22 May 2024 08:01:57 +0000 (10:01 +0200)
Ensure "disable frontend" on a reverse HTTP listener is forbidden by
returing -1 on suspend callback. Suspending such a listener has unknown
effect and so is not properly implemented for now.

This should be backported up to 2.9.

include/haproxy/proto_rhttp.h
src/proto_rhttp.c

index 421680fe55da34be4ac02f16aef346c75edd72ee..6676e04d475927071f45eaaf7ade61b6780c74de 100644 (file)
@@ -10,6 +10,7 @@ int rhttp_bind_receiver(struct receiver *rx, char **errmsg);
 int rhttp_bind_listener(struct listener *listener, char *errmsg, int errlen);
 void rhttp_enable_listener(struct listener *l);
 void rhttp_disable_listener(struct listener *l);
+int rhttp_suspend_listener(struct listener *l);
 struct connection *rhttp_accept_conn(struct listener *l, int *status);
 void rhttp_unbind_receiver(struct listener *l);
 int rhttp_set_affinity(struct connection *conn, int new_tid);
index e5064774f7461d9c0380749148859402235c1d6b..55f10ec3a887cd5f069799b618b662d064accb84 100644 (file)
@@ -33,6 +33,7 @@ struct protocol proto_rhttp = {
        .listen      = rhttp_bind_listener,
        .enable      = rhttp_enable_listener,
        .disable     = rhttp_disable_listener,
+       .suspend     = rhttp_suspend_listener,
        .add         = default_add_listener,
        .unbind      = rhttp_unbind_receiver,
        .resume      = default_resume_listener,
@@ -370,6 +371,13 @@ int rhttp_bind_listener(struct listener *listener, char *errmsg, int errlen)
        return ERR_ALERT | ERR_FATAL;
 }
 
+/* Do not support "disable frontend" for rhttp protocol. */
+int rhttp_suspend_listener(struct listener *l)
+{
+       send_log(l->bind_conf->frontend, LOG_ERR, "cannot disable a reverse-HTTP listener.\n");
+       return -1;
+}
+
 void rhttp_enable_listener(struct listener *l)
 {
        if (l->rx.rhttp.state < LI_PRECONN_ST_INIT) {