]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: cli: correctly handle abns in 'show cli sockets'
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 1 Apr 2019 09:30:04 +0000 (11:30 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 1 Apr 2019 12:45:37 +0000 (14:45 +0200)
The 'show cli sockets' was not handling the abns sockets. This is a
problem since it uses the AF_UNIX family, it displays nothing
in the path column because the path starts by \0.

Should be backported to 1.9 and 1.8.

src/cli.c

index 38c178dc24e8ba49e701ba36399760c227258973..2527e890f82f4827a593e7a04c46052fd9b1d45e 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -1078,7 +1078,10 @@ static int cli_io_handler_show_cli_sock(struct appctx *appctx)
                                                        const struct sockaddr_un *un;
 
                                                        un = (struct sockaddr_un *)&l->addr;
-                                                       chunk_appendf(&trash, "%s ", un->sun_path);
+                                                       if (un->sun_path[0] == '\0')
+                                                               chunk_appendf(&trash, "abns@%s ", un->sun_path+1);
+                                                       else
+                                                               chunk_appendf(&trash, "%s ", un->sun_path);
                                                } else if (l->addr.ss_family == AF_INET) {
                                                        addr_to_str(&l->addr, addr, sizeof(addr));
                                                        port_to_str(&l->addr, port, sizeof(port));