mirror of
https://github.com/haproxy/haproxy.git
synced 2026-05-21 09:25:29 -04:00
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.
This commit is contained in:
parent
50354f929d
commit
022681eca2
17 changed files with 43 additions and 43 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
32
src/proxy.c
32
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++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue