MINOR: connection: define mux flag for reverse support

Add a new MUX flag MX_FL_REVERSABLE. This value is used to indicate that
MUX instance supports connection reversal. For the moment, only HTTP/2
multiplexer is flagged with it.

This allows to dynamically check if reversal can be completed during MUX
installation. This will allow to relax requirement on config writing for
'tcp-request session attach-srv' which currently cannot be used mixed
with non-http/2 listener instances, even if used conditionnally with an
ACL.
This commit is contained in:
Amaury Denoyelle 2023-09-29 16:03:51 +02:00
parent ac1164de7c
commit 337c71423f
3 changed files with 11 additions and 1 deletions

View File

@ -310,6 +310,7 @@ enum {
MX_FL_HOL_RISK = 0x00000002, /* set if the protocol is subject the to head-of-line blocking on server */
MX_FL_NO_UPG = 0x00000004, /* set if mux does not support any upgrade */
MX_FL_FRAMED = 0x00000008, /* mux working on top of a framed transport layer (QUIC) */
MX_FL_REVERSABLE = 0x00000010, /* mux supports connection reversal */
};
/* PROTO token registration */

View File

@ -282,6 +282,15 @@ int conn_install_mux_fe(struct connection *conn, void *ctx)
if (!mux_ops)
return -1;
}
/* Ensure a valid protocol is selected if connection is targetted by a
* tcp-request session attach-srv rule.
*/
if (conn->reverse.target && !(mux_ops->flags & MX_FL_REVERSABLE)) {
conn->err_code = CO_ER_REVERSE;
return -1;
}
return conn_install_mux(conn, mux_ops, ctx, bind_conf->frontend, conn->owner);
}

View File

@ -7158,7 +7158,7 @@ static const struct mux_ops h2_ops = {
.show_fd = h2_show_fd,
.show_sd = h2_show_sd,
.takeover = h2_takeover,
.flags = MX_FL_HTX|MX_FL_HOL_RISK|MX_FL_NO_UPG,
.flags = MX_FL_HTX|MX_FL_HOL_RISK|MX_FL_NO_UPG|MX_FL_REVERSABLE,
.name = "H2",
};