MINOR: connection/mux_quic: add MUX <init_xprt> field for QMux handshake · haproxy/haproxy@879c78c · GitHub
Skip to content

Commit 879c78c

Browse files
committed
MINOR: connection/mux_quic: add MUX <init_xprt> field for QMux handshake
The first part of this patch defines a new mux_proto_list field named <xprt_init>. This allows to define an extra XPRT layer which should be activated first prior to the MUX creation both on frontend and backend sides. This is immediately used for QMux mux_proto_list to require XPRT_QMUX handshake. With this change, activation of QMux connection flags in session_accept_fd() and connect_server() are adjusted to take into account <init_xprt> field. This approach is much more evolutive than relying on the previous MUX name. Change in connect_server() will also be necessary to support QMux activation on a TCP server with h3 ALPN without explicit "proto qmux". This guarantees that MUX initialization is delayed after QMux handshake.
1 parent 356f1ab commit 879c78c

4 files changed

Lines changed: 12 additions & 5 deletions

File tree

‎include/haproxy/connection-t.h‎

Lines changed: 1 addition & 0 deletions

‎src/backend.c‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,6 +1811,7 @@ int connect_server(struct stream *s)
18111811
{
18121812
struct connection *cli_conn = objt_conn(strm_orig(s));
18131813
struct connection *srv_conn = NULL;
1814+
const struct mux_proto_list *mux_proto;
18141815
struct server *srv;
18151816
int reuse_mode;
18161817
int reuse __maybe_unused = 0;
@@ -2130,9 +2131,13 @@ int connect_server(struct stream *s)
21302131
srv_conn->flags |= CO_FL_SOCKS4;
21312132
}
21322133

2133-
if (srv && srv->mux_proto && isteq(srv->mux_proto->mux_proto, ist("qmux"))) {
2134-
srv_conn->flags |= (CO_FL_QMUX_RECV|CO_FL_QMUX_SEND);
2135-
may_start_mux_now = 0;
2134+
if (may_start_mux_now) {
2135+
/* Delay QMux MUX init to let xprt_qmux handshake runs first. */
2136+
mux_proto = conn_select_mux_be(srv_conn);
2137+
if (mux_proto && mux_proto->init_xprt == XPRT_QMUX) {
2138+
srv_conn->flags |= (CO_FL_QMUX_RECV|CO_FL_QMUX_SEND);
2139+
may_start_mux_now = 0;
2140+
}
21362141
}
21372142

21382143
#if defined(USE_OPENSSL) && defined(TLSEXT_TYPE_application_layer_protocol_negotiation)

‎src/mux_quic.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4813,6 +4813,7 @@ static const struct mux_ops qmux_ops = {
48134813
};
48144814

48154815
static struct mux_proto_list mux_proto_qmux =
4816-
{ .mux_proto = IST("qmux"), .mode = PROTO_MODE_HTTP, .side = PROTO_SIDE_BOTH, .mux = &qmux_ops };
4816+
{ .mux_proto = IST("qmux"), .mode = PROTO_MODE_HTTP, .side = PROTO_SIDE_BOTH, .mux = &qmux_ops,
4817+
.init_xprt = XPRT_QMUX };
48174818

48184819
INITCALL1(STG_REGISTER, register_mux_proto, &mux_proto_qmux);

‎src/session.c‎

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)