From: Christopher Faulet Date: Tue, 10 Apr 2018 12:37:32 +0000 (+0200) Subject: MINOR: mux: Print the list of existing mux protocols during HA startup X-Git-Tag: v1.9-dev2~187 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98d9fe21e012bc1f7e28b00b60a53cf81464fda2;p=thirdparty%2Fhaproxy.git MINOR: mux: Print the list of existing mux protocols during HA startup This is done in verbose/debug mode and when build options are reported. --- diff --git a/include/proto/connection.h b/include/proto/connection.h index 4e54bcfaf2..72f297d4cd 100644 --- a/include/proto/connection.h +++ b/include/proto/connection.h @@ -962,6 +962,52 @@ static inline void unregister_mux_proto(struct mux_proto_list *list) LIST_INIT(&list->list); } +static inline struct mux_proto_list *get_mux_proto(char *str, int len) +{ + struct mux_proto_list *item; + struct ist proto = ist2(str, len); + + list_for_each_entry(item, &mux_proto_list.list, list) { + if (isteq(proto, item->token)) + return item; + } + return NULL; +} + +/* Lists the known proto mux on */ +static inline void list_mux_proto(FILE *out) +{ + struct mux_proto_list *item; + struct ist proto; + char *mode, *side; + + fprintf(out, "Available multiplexer protocols :\n"); + list_for_each_entry(item, &mux_proto_list.list, list) { + proto = item->token; + + if (item->mode == PROTO_MODE_ANY) + mode = "TCP|HTTP"; + else if (item->mode == PROTO_MODE_TCP) + mode = "TCP"; + else if (item->mode == PROTO_MODE_HTTP) + mode = "HTTP"; + else + mode = "NONE"; + + if (item->side == PROTO_SIDE_BOTH) + side = "FE|BE"; + else if (item->side == PROTO_SIDE_FE) + side = "FE"; + else if (item->side == PROTO_SIDE_BE) + side = "BE"; + else + side = "NONE"; + + fprintf(out, " %15s : mode=%-10s side=%s\n", + (proto.len ? proto.ptr : "pass-through"), mode, side); + } +} + /* returns the first mux in the list matching the exact same token and * compatible with the proxy's mode (http or tcp). Mode "health" has to be * considered as TCP here. Ie passing "px->mode == PR_MODE_HTTP" is fine. Will diff --git a/src/haproxy.c b/src/haproxy.c index 406d73141b..bf982c59c2 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -390,6 +390,8 @@ static void display_build_opts() list_pollers(stdout); putchar('\n'); + list_mux_proto(stdout); + putchar('\n'); list_filters(stdout); putchar('\n'); }