mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 13:51:26 +02:00
BUG/MEDIUM: mux-spop: Reject connection attempts from a non-spop frontend
It is possible to crash the process by initializing a connection to a SPOP server from a non-spop frontend. It is of course unexpected and invalid. And there are some checks to prevent that when the configuration is loaded. However, it is not possible to handle all cases, especially the "use_backend" rules relying on log-format strings. It could be good to improve the backend selection by checking the mode compatibility (for now, it is only performed for the HTTP). But at the end, this can also be handled by the SPOP multiplexer when it is initialized. If the opposite SD is not attached to an SPOE agent, we should fail the mux initialization and return an internal error. This patch must be backported as far as 3.1.
This commit is contained in:
parent
b4a92e7cb1
commit
886a248be4
@ -712,10 +712,13 @@ static int spop_init(struct connection *conn, struct proxy *px, struct session *
|
|||||||
sdo = spop_strm_opposite_sd(spop_strm);
|
sdo = spop_strm_opposite_sd(spop_strm);
|
||||||
if (sdo) {
|
if (sdo) {
|
||||||
spop_conn->agent = spoe_appctx_agent(sc_appctx(sdo->sc));
|
spop_conn->agent = spoe_appctx_agent(sc_appctx(sdo->sc));
|
||||||
|
if (!spop_conn->agent) {
|
||||||
|
TRACE_ERROR("not a SPOP stream", SPOP_EV_SPOP_CONN_NEW|SPOP_EV_SPOP_CONN_END|SPOP_EV_SPOP_CONN_ERR, spop_conn->conn);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
spop_conn->max_frame_size = spop_conn->agent->max_frame_size;
|
spop_conn->max_frame_size = spop_conn->agent->max_frame_size;
|
||||||
if (spop_conn->agent->flags & SPOE_FL_PIPELINING)
|
if (spop_conn->agent->flags & SPOE_FL_PIPELINING)
|
||||||
spop_conn->streams_limit = 20;
|
spop_conn->streams_limit = 20;
|
||||||
BUG_ON(!spop_conn->agent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Repare to read something */
|
/* Repare to read something */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user