You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.7 KiB

  1. commit d33b1dd5193df4dfc1dcbea22ade1ee53c89009e
  2. Author: William Lallemand <wlallemand@haproxy.com>
  3. Date: Mon Apr 1 11:30:05 2019 +0200
  4. MINOR: cli: start addresses by a prefix in 'show cli sockets'
  5. Displays a prefix for every addresses in 'show cli sockets'.
  6. It could be 'unix@', 'ipv4@', 'ipv6@', 'abns@' or 'sockpair@'.
  7. Could be backported in 1.9 and 1.8.
  8. (cherry picked from commit e58915f07f7e7a83a7aece909f115bb40887cd55)
  9. Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
  10. (cherry picked from commit 97a9b60016159140ba3c001f7427d8ff52d1d311)
  11. Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
  12. diff --git a/src/cli.c b/src/cli.c
  13. index 39744c7a..f0c41b06 100644
  14. --- a/src/cli.c
  15. +++ b/src/cli.c
  16. @@ -972,18 +972,19 @@ static int cli_io_handler_show_cli_sock(struct appctx *appctx)
  17. const struct sockaddr_un *un;
  18. un = (struct sockaddr_un *)&l->addr;
  19. - if (un->sun_path[0] == '\0')
  20. + if (un->sun_path[0] == '\0') {
  21. chunk_appendf(&trash, "abns@%s ", un->sun_path+1);
  22. - else
  23. - chunk_appendf(&trash, "%s ", un->sun_path);
  24. + } else {
  25. + chunk_appendf(&trash, "unix@%s ", un->sun_path);
  26. + }
  27. } else if (l->addr.ss_family == AF_INET) {
  28. addr_to_str(&l->addr, addr, sizeof(addr));
  29. port_to_str(&l->addr, port, sizeof(port));
  30. - chunk_appendf(&trash, "%s:%s ", addr, port);
  31. + chunk_appendf(&trash, "ipv4@%s:%s ", addr, port);
  32. } else if (l->addr.ss_family == AF_INET6) {
  33. addr_to_str(&l->addr, addr, sizeof(addr));
  34. port_to_str(&l->addr, port, sizeof(port));
  35. - chunk_appendf(&trash, "[%s]:%s ", addr, port);
  36. + chunk_appendf(&trash, "ipv6@[%s]:%s ", addr, port);
  37. } else
  38. continue;