]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: listener: add a scope field in the bind keyword lists
authorWilly Tarreau <w@1wt.eu>
Tue, 18 Sep 2012 16:24:39 +0000 (18:24 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 18 Sep 2012 16:27:14 +0000 (18:27 +0200)
This scope is used to report what the keywords are used for (eg: TCP,
UNIX, ...). It is now reported by bind_dump_kws().

include/types/listener.h
src/listener.c
src/proto_tcp.c
src/proto_uxst.c
src/ssl_sock.c

index f21a28d6c1438c137e9d63241ff3ff93ffcbc0b7..fda7cea8031b0e387d0855d6b269189c7fe6d5f2 100644 (file)
@@ -173,9 +173,10 @@ struct bind_kw {
  * A keyword list. It is a NULL-terminated array of keywords. It embeds a
  * struct list in order to be linked to other lists, allowing it to easily
  * be declared where it is needed, and linked without duplicating data nor
- * allocating memory.
+ * allocating memory. It is also possible to indicate a scope for the keywords.
  */
 struct bind_kw_list {
+       const char *scope;
        struct list list;
        struct bind_kw kw[VAR_ARRAY];
 };
index 2667fd4fd737e212abe083e32a9e0dc792a5de5f..09a025745f43e7af2d427cdc7427522e490146cb 100644 (file)
@@ -469,9 +469,11 @@ void bind_dump_kws(char **out)
                for (index = 0; kwl->kw[index].kw != NULL; index++) {
                        if (kwl->kw[index].parse ||
                            bind_find_kw(kwl->kw[index].kw) == &kwl->kw[index]) {
-                               memprintf(out, "%s%s %s\n", *out ? *out : "",
+                               memprintf(out, "%s[%4s] %s%s%s\n", *out ? *out : "",
+                                         kwl->scope,
                                          kwl->kw[index].kw,
-                                         kwl->kw[index].parse ? "" : "(not supported)");
+                                         kwl->kw[index].skip ? " <arg>" : "",
+                                         kwl->kw[index].parse ? "" : " (not supported)");
                        }
                }
        }
@@ -662,7 +664,7 @@ static struct acl_kw_list acl_kws = {{ },{
  * the config parser can report an appropriate error when a known keyword was
  * not enabled.
  */
-static struct bind_kw_list bind_kws = {{ },{
+static struct bind_kw_list bind_kws = { "ALL", { }, {
        { "accept-proxy", bind_parse_accept_proxy, 0 }, /* enable PROXY protocol */
        { "backlog",      bind_parse_backlog,      1 }, /* set backlog of listening socket */
        { "id",           bind_parse_id,           1 }, /* set id of listening socket */
index fe89569c22528448cf4358669dd8e3fe3c1d4e6f..6b1b15ed6ad34cb96cb2627ebcdce243747a1e74 100644 (file)
@@ -1842,7 +1842,7 @@ static struct sample_fetch_kw_list sample_fetch_keywords = {{ },{
  * the config parser can report an appropriate error when a known keyword was
  * not enabled.
  */
-static struct bind_kw_list bind_kws = {{ },{
+static struct bind_kw_list bind_kws = { "TCP", { }, {
 #ifdef TCP_DEFER_ACCEPT
        { "defer-accept",  bind_parse_defer_accept, 0 }, /* wait for some data for 1 second max before doing accept */
 #endif
index 3ea468f45e6678f10631e64e2bd42b4801c389ff..5f56ad51cdaddfc33db92b74acade7c97c3bac15 100644 (file)
@@ -493,7 +493,7 @@ static int bind_parse_user(char **args, int cur_arg, struct proxy *px, struct li
  * the config parser can report an appropriate error when a known keyword was
  * not enabled.
  */
-static struct bind_kw_list bind_kws = {{ },{
+static struct bind_kw_list bind_kws = { "UNIX", { }, {
        { "gid",   bind_parse_gid,   1 },      /* set the socket's gid */
        { "group", bind_parse_group, 1 },      /* set the socket's gid from the group name */
        { "mode",  bind_parse_mode,  1 },      /* set the socket's mode (eg: 0644)*/
index 4d78f6d6ea50499712b5aef14145f14253928e11..2d5e6663be909f7cbb643e81fc16afe3fcc950df 100644 (file)
@@ -903,7 +903,7 @@ static struct acl_kw_list acl_kws = {{ },{
  * the config parser can report an appropriate error when a known keyword was
  * not enabled.
  */
-static struct bind_kw_list bind_kws = {{ },{
+static struct bind_kw_list bind_kws = { "SSL", { }, {
        { "ciphers",               bind_parse_ciphers, 1 }, /* set SSL cipher suite */
        { "crt",                   bind_parse_crt,     1 }, /* load SSL certificates from this location */
        { "nosslv3",               bind_parse_nosslv3, 0 }, /* disable SSLv3 */