]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux: Print the list of existing mux protocols during HA startup
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 10 Apr 2018 12:37:32 +0000 (14:37 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 8 Aug 2018 07:54:22 +0000 (09:54 +0200)
This is done in verbose/debug mode and when build options are reported.

include/proto/connection.h
src/haproxy.c

index 4e54bcfaf2ebb77a28382c94f9c3c08c971a6f61..72f297d4cdd28541a74ea359210aae987164cfa1 100644 (file)
@@ -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 <out> */
+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
index 406d73141be6fe3f8d41b54f99c67680fc48029a..bf982c59c288a5e45079cd799fb4a08a7fdfbe11 100644 (file)
@@ -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');
 }