From: Amaury Denoyelle Date: Thu, 16 May 2024 15:35:31 +0000 (+0200) Subject: BUG/MINOR: rhttp: prevent listener suspend X-Git-Tag: v3.0-dev13~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2770ef352e243ed3f0914e4d193ea3becf4dbb1b;p=thirdparty%2Fhaproxy.git BUG/MINOR: rhttp: prevent listener suspend 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. --- diff --git a/include/haproxy/proto_rhttp.h b/include/haproxy/proto_rhttp.h index 421680fe55..6676e04d47 100644 --- a/include/haproxy/proto_rhttp.h +++ b/include/haproxy/proto_rhttp.h @@ -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); diff --git a/src/proto_rhttp.c b/src/proto_rhttp.c index e5064774f7..55f10ec3a8 100644 --- a/src/proto_rhttp.c +++ b/src/proto_rhttp.c @@ -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) {