From 022681eca222a10139cf4d4bc4e828f6f6fb840f Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Tue, 19 May 2026 14:46:25 +0200 Subject: [PATCH] MINOR: mux: Rename the "token" from mux_proto_list to mux_proto In struct mux_proto_list, rename the "token" field to "mux_proto". That field should only be used to match the name provided in the "proto" directive, and it will be soon. This should be a no-op. --- include/haproxy/connection-t.h | 2 +- include/haproxy/connection.h | 6 +++--- src/backend.c | 2 +- src/connection.c | 2 +- src/extcheck.c | 2 +- src/fcgi-app.c | 2 +- src/mux_fcgi.c | 2 +- src/mux_h1.c | 4 ++-- src/mux_h2.c | 2 +- src/mux_pt.c | 4 ++-- src/mux_quic.c | 4 ++-- src/mux_spop.c | 4 ++-- src/proto_rhttp.c | 2 +- src/proxy.c | 32 ++++++++++++++++---------------- src/server.c | 6 +++--- src/session.c | 2 +- src/stream.c | 8 ++++---- 17 files changed, 43 insertions(+), 43 deletions(-) diff --git a/include/haproxy/connection-t.h b/include/haproxy/connection-t.h index e0eec3020..41f02425f 100644 --- a/include/haproxy/connection-t.h +++ b/include/haproxy/connection-t.h @@ -673,7 +673,7 @@ struct connection { }; struct mux_proto_list { - const struct ist token; /* token name and length. Empty is catch-all */ + const struct ist mux_proto; /* Mux protocol, to be used with the "proto" directive */ enum proto_proxy_mode mode; enum proto_proxy_side side; const struct mux_ops *mux; diff --git a/include/haproxy/connection.h b/include/haproxy/connection.h index b4209caf6..f73bb334c 100644 --- a/include/haproxy/connection.h +++ b/include/haproxy/connection.h @@ -649,7 +649,7 @@ static inline struct mux_proto_list *get_mux_proto(const struct ist proto) struct mux_proto_list *item; list_for_each_entry(item, &mux_proto_list.list, list) { - if (isteq(proto, item->token)) + if (isteq(proto, item->mux_proto)) return item; } return NULL; @@ -676,10 +676,10 @@ static inline const struct mux_proto_list *conn_get_best_mux_entry( list_for_each_entry(item, &mux_proto_list.list, list) { if (!(item->side & proto_side) || !(item->mode & proto_mode) || ((proto_is_quic != 0) != ((item->mux->flags & MX_FL_FRAMED) != 0))) continue; - if (istlen(mux_proto) && isteq(mux_proto, item->token)) { + if (istlen(mux_proto) && isteq(mux_proto, item->mux_proto)) { return item; } - else if (!istlen(item->token)) { + else if (!istlen(item->mux_proto)) { if (!fallback || (item->mode == proto_mode && fallback->mode != proto_mode)) fallback = item; } diff --git a/src/backend.c b/src/backend.c index 2add8cc8b..db914fd61 100644 --- a/src/backend.c +++ b/src/backend.c @@ -2130,7 +2130,7 @@ int connect_server(struct stream *s) srv_conn->flags |= CO_FL_SOCKS4; } - if (srv && srv->mux_proto && isteq(srv->mux_proto->token, ist("qmux"))) { + if (srv && srv->mux_proto && isteq(srv->mux_proto->mux_proto, ist("qmux"))) { srv_conn->flags |= (CO_FL_QMUX_RECV|CO_FL_QMUX_SEND); may_start_mux_now = 0; } diff --git a/src/connection.c b/src/connection.c index e503f30a0..7112ef1cd 100644 --- a/src/connection.c +++ b/src/connection.c @@ -1991,7 +1991,7 @@ void list_mux_proto(FILE *out) fprintf(out, "Available multiplexer protocols :\n" "(protocols marked as cannot be specified using 'proto' keyword)\n"); list_for_each_entry(item, &mux_proto_list.list, list) { - proto = item->token; + proto = item->mux_proto; if (item->mode == PROTO_MODE_ANY) mode = "TCP|HTTP"; diff --git a/src/extcheck.c b/src/extcheck.c index 152acaddc..3d325eaf8 100644 --- a/src/extcheck.c +++ b/src/extcheck.c @@ -349,7 +349,7 @@ int prepare_external_check(struct check *check) case PR_MODE_CLI: svmode = "cli"; break; case PR_MODE_SYSLOG: svmode = "syslog"; break; case PR_MODE_PEERS: svmode = "peers"; break; - case PR_MODE_HTTP: svmode = (s->mux_proto) ? s->mux_proto->token.ptr : "h1"; break; + case PR_MODE_HTTP: svmode = (s->mux_proto) ? s->mux_proto->mux_proto.ptr : "h1"; break; case PR_MODE_TCP: svmode = "tcp"; break; case PR_MODE_SPOP: svmode = "spop"; break; /* all valid cases must be enumerated above, below is to avoid a warning */ diff --git a/src/fcgi-app.c b/src/fcgi-app.c index 58b257e30..688f2ada6 100644 --- a/src/fcgi-app.c +++ b/src/fcgi-app.c @@ -644,7 +644,7 @@ static int cfg_fcgi_apps_postparser() px->options2 |= PR_O2_RSTRICT_REQ_HDR_NAMES_DEL; for (srv = px->srv; srv; srv = srv->next) { - if (srv->mux_proto && isteq(srv->mux_proto->token, ist("fcgi"))) { + if (srv->mux_proto && isteq(srv->mux_proto->mux_proto, ist("fcgi"))) { nb_fcgi_srv++; if (fcgi_conf) continue; diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c index 0fe9f4d61..f49b66f7d 100644 --- a/src/mux_fcgi.c +++ b/src/mux_fcgi.c @@ -4551,7 +4551,7 @@ static const struct mux_ops mux_fcgi_ops = { /* this mux registers FCGI proto */ static struct mux_proto_list mux_proto_fcgi = -{ .token = IST("fcgi"), .mode = PROTO_MODE_HTTP, .side = PROTO_SIDE_BE, .mux = &mux_fcgi_ops }; +{ .mux_proto = IST("fcgi"), .mode = PROTO_MODE_HTTP, .side = PROTO_SIDE_BE, .mux = &mux_fcgi_ops }; INITCALL1(STG_REGISTER, register_mux_proto, &mux_proto_fcgi); diff --git a/src/mux_h1.c b/src/mux_h1.c index cb95556c7..3c726d7fd 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -6125,9 +6125,9 @@ static const struct mux_ops mux_h1_ops = { /* this mux registers default HTX proto but also h1 proto (to be referenced in the conf */ static struct mux_proto_list mux_proto_h1 = - { .token = IST("h1"), .mode = PROTO_MODE_HTTP, .side = PROTO_SIDE_BOTH, .mux = &mux_h1_ops }; + { .mux_proto = IST("h1"), .mode = PROTO_MODE_HTTP, .side = PROTO_SIDE_BOTH, .mux = &mux_h1_ops }; static struct mux_proto_list mux_proto_http = - { .token = IST(""), .mode = PROTO_MODE_HTTP, .side = PROTO_SIDE_BOTH, .mux = &mux_http_ops, .alpn = "\010http/1.1" }; + { .mux_proto = IST(""), .mode = PROTO_MODE_HTTP, .side = PROTO_SIDE_BOTH, .mux = &mux_http_ops, .alpn = "\010http/1.1" }; INITCALL1(STG_REGISTER, register_mux_proto, &mux_proto_h1); INITCALL1(STG_REGISTER, register_mux_proto, &mux_proto_http); diff --git a/src/mux_h2.c b/src/mux_h2.c index 00eb1eebe..3708925a6 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -9010,7 +9010,7 @@ static const struct mux_ops h2_ops = { }; static struct mux_proto_list mux_proto_h2 = - { .token = IST("h2"), .mode = PROTO_MODE_HTTP, .side = PROTO_SIDE_BOTH, .mux = &h2_ops, .alpn = "\002h2" }; + { .mux_proto = IST("h2"), .mode = PROTO_MODE_HTTP, .side = PROTO_SIDE_BOTH, .mux = &h2_ops, .alpn = "\002h2" }; INITCALL1(STG_REGISTER, register_mux_proto, &mux_proto_h2); diff --git a/src/mux_pt.c b/src/mux_pt.c index 0c6a1f972..fe8897b40 100644 --- a/src/mux_pt.c +++ b/src/mux_pt.c @@ -936,9 +936,9 @@ const struct mux_ops mux_pt_ops = { /* PROT selection : default mux has empty name */ static struct mux_proto_list mux_proto_none = - { .token = IST("none"), .mode = PROTO_MODE_TCP, .side = PROTO_SIDE_BOTH, .mux = &mux_pt_ops }; + { .mux_proto = IST("none"), .mode = PROTO_MODE_TCP, .side = PROTO_SIDE_BOTH, .mux = &mux_pt_ops }; static struct mux_proto_list mux_proto_tcp = - { .token = IST(""), .mode = PROTO_MODE_TCP, .side = PROTO_SIDE_BOTH, .mux = &mux_tcp_ops }; + { .mux_proto = IST(""), .mode = PROTO_MODE_TCP, .side = PROTO_SIDE_BOTH, .mux = &mux_tcp_ops }; INITCALL1(STG_REGISTER, register_mux_proto, &mux_proto_none); INITCALL1(STG_REGISTER, register_mux_proto, &mux_proto_tcp); diff --git a/src/mux_quic.c b/src/mux_quic.c index 976c95ccf..5e18178a9 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -4784,7 +4784,7 @@ void qcc_show_quic(struct qcc *qcc) } static struct mux_proto_list mux_proto_quic = - { .token = IST("quic"), .mode = PROTO_MODE_HTTP, .side = PROTO_SIDE_BOTH, .mux = &quic_ops }; + { .mux_proto = IST("quic"), .mode = PROTO_MODE_HTTP, .side = PROTO_SIDE_BOTH, .mux = &quic_ops }; INITCALL1(STG_REGISTER, register_mux_proto, &mux_proto_quic); @@ -4813,6 +4813,6 @@ static const struct mux_ops qmux_ops = { }; static struct mux_proto_list mux_proto_qmux = - { .token = IST("qmux"), .mode = PROTO_MODE_HTTP, .side = PROTO_SIDE_BOTH, .mux = &qmux_ops }; + { .mux_proto = IST("qmux"), .mode = PROTO_MODE_HTTP, .side = PROTO_SIDE_BOTH, .mux = &qmux_ops }; INITCALL1(STG_REGISTER, register_mux_proto, &mux_proto_qmux); diff --git a/src/mux_spop.c b/src/mux_spop.c index 53f063aa9..8fd08e29c 100644 --- a/src/mux_spop.c +++ b/src/mux_spop.c @@ -3738,10 +3738,10 @@ static const struct mux_ops mux_spop_ops = { }; static struct mux_proto_list mux_proto_spop = - { .token = IST("spop"), .mode = PROTO_MODE_SPOP, .side = PROTO_SIDE_BE, .mux = &mux_spop_ops }; + { .mux_proto = IST("spop"), .mode = PROTO_MODE_SPOP, .side = PROTO_SIDE_BE, .mux = &mux_spop_ops }; static struct mux_proto_list mux_proto_default_spop = - { .token = IST(""), .mode = PROTO_MODE_SPOP, .side = PROTO_SIDE_BE, .mux = &mux_spop_ops }; + { .mux_proto = IST(""), .mode = PROTO_MODE_SPOP, .side = PROTO_SIDE_BE, .mux = &mux_spop_ops }; INITCALL1(STG_REGISTER, register_mux_proto, &mux_proto_spop); INITCALL1(STG_REGISTER, register_mux_proto, &mux_proto_default_spop); diff --git a/src/proto_rhttp.c b/src/proto_rhttp.c index 515dee39d..b2064dfcf 100644 --- a/src/proto_rhttp.c +++ b/src/proto_rhttp.c @@ -371,7 +371,7 @@ int rhttp_bind_listener(struct listener *listener, char *errmsg, int errlen) } /* Check that server uses HTTP/2 either with proto or ALPN. */ - if ((!srv->mux_proto || !isteqi(srv->mux_proto->token, ist("h2"))) && + if ((!srv->mux_proto || !isteqi(srv->mux_proto->mux_proto, ist("h2"))) && (!srv->use_ssl || !isteqi(ist(srv->ssl_ctx.alpn_str), ist("\x02h2")))) { snprintf(errmsg, errlen, "Cannot reverse connect with server '%s/%s' unless HTTP/2 is activated on it with either proto or alpn keyword.", name, ist0(sv_name)); goto err; diff --git a/src/proxy.c b/src/proxy.c index d7ca09843..c12ffdf55 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -1689,13 +1689,13 @@ int proxy_finalize(struct proxy *px, int *err_code) * due to the proxy's mode not being taken into account * on first pass. Let's adjust it now. */ - mux_ent = conn_get_best_mux_entry(bind_conf->mux_proto->token, PROTO_SIDE_FE, is_quic, mode); + mux_ent = conn_get_best_mux_entry(bind_conf->mux_proto->mux_proto, PROTO_SIDE_FE, is_quic, mode); - if (!mux_ent || !isteq(mux_ent->token, bind_conf->mux_proto->token)) { + if (!mux_ent || !isteq(mux_ent->mux_proto, bind_conf->mux_proto->mux_proto)) { ha_alert("%s '%s' : MUX protocol '%.*s' is not usable for 'bind %s' at [%s:%d].\n", proxy_type_str(px), px->id, - (int)bind_conf->mux_proto->token.len, - bind_conf->mux_proto->token.ptr, + (int)bind_conf->mux_proto->mux_proto.len, + bind_conf->mux_proto->mux_proto.ptr, bind_conf->arg, bind_conf->file, bind_conf->line); cfgerr++; } @@ -1703,16 +1703,16 @@ int proxy_finalize(struct proxy *px, int *err_code) if ((mux_ent->mux->flags & MX_FL_FRAMED) && !(bind_conf->options & BC_O_USE_SOCK_DGRAM)) { ha_alert("%s '%s' : frame-based MUX protocol '%.*s' is incompatible with stream transport of 'bind %s' at [%s:%d].\n", proxy_type_str(px), px->id, - (int)bind_conf->mux_proto->token.len, - bind_conf->mux_proto->token.ptr, + (int)bind_conf->mux_proto->mux_proto.len, + bind_conf->mux_proto->mux_proto.ptr, bind_conf->arg, bind_conf->file, bind_conf->line); cfgerr++; } else if (!(mux_ent->mux->flags & MX_FL_FRAMED) && !(bind_conf->options & BC_O_USE_SOCK_STREAM)) { ha_alert("%s '%s' : stream-based MUX protocol '%.*s' is incompatible with framed transport of 'bind %s' at [%s:%d].\n", proxy_type_str(px), px->id, - (int)bind_conf->mux_proto->token.len, - bind_conf->mux_proto->token.ptr, + (int)bind_conf->mux_proto->mux_proto.len, + bind_conf->mux_proto->mux_proto.ptr, bind_conf->arg, bind_conf->file, bind_conf->line); cfgerr++; } @@ -2849,13 +2849,13 @@ int proxy_finalize(struct proxy *px, int *err_code) * due to the proxy's mode not being taken into account * on first pass. Let's adjust it now. */ - mux_ent = conn_get_best_mux_entry(newsrv->mux_proto->token, PROTO_SIDE_BE, srv_is_quic(newsrv), mode); + mux_ent = conn_get_best_mux_entry(newsrv->mux_proto->mux_proto, PROTO_SIDE_BE, srv_is_quic(newsrv), mode); - if (!mux_ent || !isteq(mux_ent->token, newsrv->mux_proto->token)) { + if (!mux_ent || !isteq(mux_ent->mux_proto, newsrv->mux_proto->mux_proto)) { ha_alert("%s '%s' : MUX protocol '%.*s' is not usable for server '%s' at [%s:%d].\n", proxy_type_str(px), px->id, - (int)newsrv->mux_proto->token.len, - newsrv->mux_proto->token.ptr, + (int)newsrv->mux_proto->mux_proto.len, + newsrv->mux_proto->mux_proto.ptr, newsrv->id, newsrv->conf.file, newsrv->conf.line); cfgerr++; } @@ -2863,16 +2863,16 @@ int proxy_finalize(struct proxy *px, int *err_code) if ((mux_ent->mux->flags & MX_FL_FRAMED) && !srv_is_quic(newsrv)) { ha_alert("%s '%s' : MUX protocol '%.*s' is incompatible with stream transport used by server '%s' at [%s:%d].\n", proxy_type_str(px), px->id, - (int)newsrv->mux_proto->token.len, - newsrv->mux_proto->token.ptr, + (int)newsrv->mux_proto->mux_proto.len, + newsrv->mux_proto->mux_proto.ptr, newsrv->id, newsrv->conf.file, newsrv->conf.line); cfgerr++; } else if (!(mux_ent->mux->flags & MX_FL_FRAMED) && srv_is_quic(newsrv)) { ha_alert("%s '%s' : MUX protocol '%.*s' is incompatible with framed transport used by server '%s' at [%s:%d].\n", proxy_type_str(px), px->id, - (int)newsrv->mux_proto->token.len, - newsrv->mux_proto->token.ptr, + (int)newsrv->mux_proto->mux_proto.len, + newsrv->mux_proto->mux_proto.ptr, newsrv->id, newsrv->conf.file, newsrv->conf.line); cfgerr++; } diff --git a/src/server.c b/src/server.c index 014b5e9a3..4d52556e0 100644 --- a/src/server.c +++ b/src/server.c @@ -643,7 +643,7 @@ int srv_check_reuse_ws(struct server *srv) * for mux selection. */ const struct ist srv_mux = srv->mux_proto ? - srv->mux_proto->token : IST_NULL; + srv->mux_proto->mux_proto : IST_NULL; switch (srv->ws) { /* "auto" means use the same protocol : reuse is possible. */ @@ -6278,9 +6278,9 @@ static int cli_parse_add_server(char **args, char *payload, struct appctx *appct int proto_mode = conn_pr_mode_to_proto_mode(be->mode); const struct mux_proto_list *mux_ent; - mux_ent = conn_get_best_mux_entry(srv->mux_proto->token, PROTO_SIDE_BE, srv_is_quic(srv), proto_mode); + mux_ent = conn_get_best_mux_entry(srv->mux_proto->mux_proto, PROTO_SIDE_BE, srv_is_quic(srv), proto_mode); - if (!mux_ent || !isteq(mux_ent->token, srv->mux_proto->token)) { + if (!mux_ent || !isteq(mux_ent->mux_proto, srv->mux_proto->mux_proto)) { ha_alert("MUX protocol is not usable for server.\n"); goto out; } diff --git a/src/session.c b/src/session.c index a44237313..2815c215f 100644 --- a/src/session.c +++ b/src/session.c @@ -241,7 +241,7 @@ int session_accept_fd(struct connection *cli_conn) if (l->bind_conf->options & BC_O_ACC_CIP) cli_conn->flags |= CO_FL_ACCEPT_CIP; - if (l->bind_conf->mux_proto && isteq(l->bind_conf->mux_proto->token, ist("qmux"))) + if (l->bind_conf->mux_proto && isteq(l->bind_conf->mux_proto->mux_proto, ist("qmux"))) cli_conn->flags |= (CO_FL_QMUX_RECV|CO_FL_QMUX_SEND); /* Add the handshake pseudo-XPRT */ diff --git a/src/stream.c b/src/stream.c index 93a00019c..fd27b9cf6 100644 --- a/src/stream.c +++ b/src/stream.c @@ -1617,7 +1617,7 @@ int stream_set_http_mode(struct stream *s, const struct mux_proto_list *mux_prot sc_conn_prepare_endp_upgrade(sc); if (conn_upgrade_mux_fe(conn, sc, &s->req.buf, - (mux_proto ? mux_proto->token : ist("")), + (mux_proto ? mux_proto->mux_proto : ist("")), PROTO_MODE_HTTP) == -1) { sc_conn_abort_endp_upgrade(sc); return 0; @@ -3268,10 +3268,10 @@ static int check_tcp_switch_stream_mode(struct act_rule *rule, struct proxy *px, px->options |= PR_O_HTTP_UPG; if (mux_proto) { - mux_ent = conn_get_best_mux_entry(mux_proto->token, PROTO_SIDE_FE, 0, mode); - if (!mux_ent || !isteq(mux_ent->token, mux_proto->token)) { + mux_ent = conn_get_best_mux_entry(mux_proto->mux_proto, PROTO_SIDE_FE, 0, mode); + if (!mux_ent || !isteq(mux_ent->mux_proto, mux_proto->mux_proto)) { memprintf(err, "MUX protocol '%.*s' is not compatible with the selected mode", - (int)mux_proto->token.len, mux_proto->token.ptr); + (int)mux_proto->mux_proto.len, mux_proto->mux_proto.ptr); return 0; } }