]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux: Rename the "token" from mux_proto_list to mux_proto
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 19 May 2026 12:46:25 +0000 (14:46 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 19 May 2026 16:33:54 +0000 (18:33 +0200)
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.

17 files changed:
include/haproxy/connection-t.h
include/haproxy/connection.h
src/backend.c
src/connection.c
src/extcheck.c
src/fcgi-app.c
src/mux_fcgi.c
src/mux_h1.c
src/mux_h2.c
src/mux_pt.c
src/mux_quic.c
src/mux_spop.c
src/proto_rhttp.c
src/proxy.c
src/server.c
src/session.c
src/stream.c

index e0eec3020c05ea878ce264fe1d94fe64a90b36e4..41f02425f50478a225b27f03e2f98327d63a2ae2 100644 (file)
@@ -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;
index b4209caf60a1a96728dcb7895c7a043fb1b54f6e..f73bb334cd791282cf3e330394a2c28a5bcdf485 100644 (file)
@@ -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;
                }
index 2add8cc8ba0f2a21263fa7e91199a4b42869f166..db914fd613665c57c23126f447f405036903d5a7 100644 (file)
@@ -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;
                }
index e503f30a0a6aaca8fa057128e0400bf531cbeb5b..7112ef1cd0710a00644f8eab7cf639c82cb4e3dd 100644 (file)
@@ -1991,7 +1991,7 @@ void list_mux_proto(FILE *out)
        fprintf(out, "Available multiplexer protocols :\n"
                "(protocols marked as <default> 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";
index 152acaddc794748eb23f7a44b77fed809ff5f9f0..3d325eaf83857f589f9c01958707e30d0971acb6 100644 (file)
@@ -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 */
index 58b257e30a9f924571ead6d00c2e64e0e591bb3c..688f2ada621db961cc56419950c0f875e3ac0889 100644 (file)
@@ -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;
index 0fe9f4d6127940161a30f22d7596b349bb40ba0e..f49b66f7d8fca351bd2a77a519a39cd35638f854 100644 (file)
@@ -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);
 
index cb95556c7bb87e0903a79dd442e6aebfca833942..3c726d7fdfff558c920308b7f81141b74c49dd9f 100644 (file)
@@ -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);
index 00eb1eebee542964dd2bd968b35621f7bedfce2b..3708925a6440662dcb030a311963dfc8269e1455 100644 (file)
@@ -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);
 
index 0c6a1f972a9e0da0eeb8fcc579a1ddc67dc690bb..fe8897b407d81a668d02f7d768f4975b9f89847a 100644 (file)
@@ -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);
index 976c95ccfafc5f5f700f9e3e60fb4063d15f889a..5e18178a955278e0a53aff20f3ca73361b70d4fa 100644 (file)
@@ -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);
index 53f063aa9d59ac98828473e202bf3b9c2b0101a6..8fd08e29cf6a3f2d3c1a717bc6345461bd19f99d 100644 (file)
@@ -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);
index 515dee39dbd218f91b2ba4fa5f2d48331f535954..b2064dfcff7128f37c9e3b1bad87fbc278ed1337 100644 (file)
@@ -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;
index d7ca0984361bcbc2ff9ac85185ccc0f59a48707e..c12ffdf554e37c710cc5e44855197e72097cc985 100644 (file)
@@ -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++;
                        }
index 014b5e9a35e74f1a04b0d74cc7712b54273da8f5..4d52556e0e3aa015373bf3fb4621a700fd2861da 100644 (file)
@@ -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;
                }
index a442373136f1c865eaf67c9ce399d9a63e376165..2815c215f248009767b08604977d17ed4deaa95b 100644 (file)
@@ -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 */
index 93a00019c4a2318393de633a9d428924749ef248..fd27b9cf6824da71036fe7a7a302d80900cb64de 100644 (file)
@@ -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;
                }
        }