]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: cli/show-fd: no longer accept filtering for dispatch mode
authorWilly Tarreau <w@1wt.eu>
Fri, 26 Jun 2026 08:53:51 +0000 (10:53 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 26 Jun 2026 08:53:51 +0000 (10:53 +0200)
"show fd" supports various flags, one of which is 'd' for "dispatch",
which also catches "transparent", in fact, connections whose target is
a proxy. Since these can no longer happen, let's remove that. The 'b'
and 's' flags are now aliases of each other for simplicity.

doc/management.txt
src/cli.c

index e0a331209ba3a5a7e2d507ab69528ddd2ad2a927..38078cd737d76a192350557e2a489d2f3b7d2842 100644 (file)
@@ -3107,7 +3107,7 @@ show events [<sink>] [-w] [-n] [-0]
   delimited by a line feed character ('\n' or 10 or 0x0A). It is possible to
   change this to the NUL character ('\0' or 0) by passing the "-0" argument.
 
-show fd [-!plcfbsd]* [[<tgid>]/[<fd>] | <fd>]
+show fd [-!plcfbs]* [[<tgid>]/[<fd>] | <fd>]
   Dump the list of either all open file descriptors or just the one number <fd>
   if specified. The form "<tgid>/<fd>" is also accepted, where either side may
   be empty as a wildcard ("/<fd>" for fd <fd> across thread groups, "<tgid>/"
@@ -3117,30 +3117,28 @@ show fd [-!plcfbsd]* [[<tgid>]/[<fd>] | <fd>]
   types. When '-' or '!' are encountered, the selection is inverted for the
   following characters in the same argument. The inversion is reset before each
   argument word delimited by white spaces. Selectable FD types include 'p' for
-  pipes, 'l' for listeners, 'c' for connections (any type), 'f' for frontend
-  connections, 'b' for backend connections (any type), 's' for connections to
-  servers, 'd' for connections to the "dispatch" address or the backend's
-  transparent address. With this, 'b' is a shortcut for 'sd' and 'c' for 'fb' or
-  'fsd'. 'c!f' is equivalent to 'b' ("any connections except frontend
-  connections" are indeed backend connections). This is only aimed at developers
-  who need to observe internal states in order to debug complex issues such as
-  abnormal CPU usages. One fd is reported per lines, and for each of them, its
-  state in the poller using upper case letters for enabled flags and lower case
-  for disabled flags, using "P" for "polled", "R" for "ready", "A" for "active",
-  the events status using "H" for "hangup", "E" for "error", "O" for "output",
-  "P" for "priority" and "I" for "input", a few other flags like "N" for "new"
-  (just added into the fd cache), "U" for "updated" (received an update in the
-  fd cache), "L" for "linger_risk", "C" for "cloned", then the cached entry
+  pipes, 'l' for listeners, 'c' for connections (any type, shortcut for 'fb'),
+  'f' for frontend connections, 'b' or 's' for backend connections to servers.
+  'c!f' is equivalent to 'b' ("any connections except frontend connections" are
+  indeed backend connections). This is only aimed at developers who need to
+  observe internal states in order to debug complex issues such as abnormal CPU
+  usages. One fd is reported per lines, and for each of them, its state in the
+  poller using upper case letters for enabled flags and lower case for disabled
+  flags, using "P" for "polled", "R" for "ready", "A" for "active", the events
+  status using "H" for "hangup", "E" for "error", "O" for "output", "P" for
+  "priority" and "I" for "input", a few other flags like "N" for "new" (just
+  added into the fd cache), "U" for "updated" (received an update in the fd
+  cache), "L" for "linger_risk", "C" for "cloned", then the cached entry
   position, the pointer to the internal owner, the pointer to the I/O callback
-  and its name when known. When the owner is a connection, the connection flags,
-  and the target are reported (frontend, proxy or server). When the owner is a
-  listener, the listener's state and its frontend are reported. There is no
-  point in using this command without a good knowledge of the internals. It's
-  worth noting that the output format may evolve over time so this output must
-  not be parsed by tools designed to be durable. Some internal structure states
-  may look suspicious to the function listing them, in this case the output line
-  will be suffixed with an exclamation mark ('!'). This may help find a starting
-  point when trying to diagnose an incident.
+  its name when known. When the owner is a connection, the connection and
+  flags, and the target are reported (frontend, proxy or server). When the
+  owner is a listener, the listener's state and its frontend are reported.
+  There is no point in using this command without a good knowledge of the
+  internals. It's worth noting that the output format may evolve over time so
+  this output must not be parsed by tools designed to be durable. Some internal
+  structure states may look suspicious to the function listing them, in this
+  case the output line will be suffixed with an exclamation mark ('!'). This
+  may help find a starting point when trying to diagnose an incident.
 
 show info [typed|json] [desc] [float]
   Dump info about haproxy status on current process. If "typed" is passed as an
index bb923109151e20b44a3bdebd8dbed44fff8a0de0..059e256cb7ee4f6d784e915eef8dc2648d3a5f33 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -100,10 +100,8 @@ struct show_env_ctx {
 #define CLI_SHOWFD_F_LI  0x00000002   /* listeners         */
 #define CLI_SHOWFD_F_FE  0x00000004   /* frontend conns    */
 #define CLI_SHOWFD_F_SV  0x00000010   /* server-only conns */
-#define CLI_SHOWFD_F_PX  0x00000020   /* proxy-only conns  */
-#define CLI_SHOWFD_F_BE  0x00000030   /* backend: srv+px   */
-#define CLI_SHOWFD_F_CO  0x00000034   /* conn: be+fe       */
-#define CLI_SHOWFD_F_ANY 0x0000003f   /* any type          */
+#define CLI_SHOWFD_F_CO  0x00000014   /* conn: fe+sv       */
+#define CLI_SHOWFD_F_ANY 0x0000001f   /* any type          */
 
 struct show_fd_ctx {
        int fd;          /* first FD to show, -1=wildcard */
@@ -1504,7 +1502,6 @@ static int cli_io_handler_show_fd(struct appctx *appctx)
                struct fdtab fdt;
                const struct listener *li = NULL;
                const struct server *sv = NULL;
-               const struct proxy *px = NULL;
                const struct connection *conn = NULL;
                const struct mux_ops *mux = NULL;
                const struct xprt_ops *xprt = NULL;
@@ -1537,7 +1534,6 @@ static int cli_io_handler_show_fd(struct appctx *appctx)
                        xprt_ctx   = conn->xprt_ctx;
                        li         = objt_listener(conn->target);
                        sv         = objt_server(conn->target);
-                       px         = objt_proxy(conn->target);
                        is_back    = conn_is_back(conn);
                        if (atleast2(fdt.thread_mask))
                                suspicious = 1;
@@ -1566,7 +1562,6 @@ static int cli_io_handler_show_fd(struct appctx *appctx)
 
                if (!(((conn || xprt_ctx) &&
                       ((match & CLI_SHOWFD_F_SV && sv) ||
-                       (match & CLI_SHOWFD_F_PX && px) ||
                        (match & CLI_SHOWFD_F_FE && li))) ||
                      (!conn &&
                       ((match & CLI_SHOWFD_F_LI && li) ||
@@ -1642,9 +1637,7 @@ static int cli_io_handler_show_fd(struct appctx *appctx)
                                }
                        }
 
-                       if (px)
-                               chunk_appendf(&trash, " px=%s", px->id);
-                       else if (sv)
+                       if (sv)
                                chunk_appendf(&trash, " sv=%s/%s", sv->proxy->id, sv->id);
                        else if (li)
                                chunk_appendf(&trash, " fe=%s", li->bind_conf->frontend->id);
@@ -1860,9 +1853,8 @@ static int cli_parse_show_fd(char **args, char *payload, struct appctx *appctx,
                        case 'l': flag = CLI_SHOWFD_F_LI;  break;
                        case 'c': flag = CLI_SHOWFD_F_CO; break;
                        case 'f': flag = CLI_SHOWFD_F_FE;  break;
-                       case 'b': flag = CLI_SHOWFD_F_BE; break;
+                       case 'b': flag = CLI_SHOWFD_F_SV;  break; // alias back/srv
                        case 's': flag = CLI_SHOWFD_F_SV;  break;
-                       case 'd': flag = CLI_SHOWFD_F_PX;  break;
                        default: return cli_err(appctx, "Invalid FD type\n");
                        }
                        c++;
@@ -4221,7 +4213,7 @@ static struct cli_kw_list cli_kws = {{ },{
        { { "show", "env",  NULL },              "show env [var]                          : dump environment variables known to the process",         cli_parse_show_env, cli_io_handler_show_env, NULL, NULL, ACCESS_MASTER },
        { { "show", "cli", "sockets",  NULL },   "show cli sockets                        : dump list of cli sockets",                                cli_parse_default, cli_io_handler_show_cli_sock, NULL, NULL, ACCESS_MASTER },
        { { "show", "cli", "level", NULL },      "show cli level                          : display the level of the current CLI session",            cli_parse_show_lvl, NULL, NULL, NULL, ACCESS_MASTER},
-       { { "show", "fd", NULL },                "show fd [-!plcfbsd]* [num]              : dump list of file descriptors in use or a specific one",  cli_parse_show_fd, cli_io_handler_show_fd, NULL },
+       { { "show", "fd", NULL },                "show fd [-!plcfbs]* [num]               : dump list of file descriptors in use or a specific one",  cli_parse_show_fd, cli_io_handler_show_fd, NULL },
        { { "show", "version", NULL },           "show version                            : show version of the current process",                     cli_parse_show_version, NULL, NULL, NULL, ACCESS_MASTER },
        { { "operator", NULL },                  "operator                                : lower the level of the current CLI session to operator",  cli_parse_set_lvl, NULL, NULL, NULL, ACCESS_MASTER},
        { { "user", NULL },                      "user                                    : lower the level of the current CLI session to user",      cli_parse_set_lvl, NULL, NULL, NULL, ACCESS_MASTER},