0017-BUG-MINOR-lua-Correctly-use-INET6_ADDRSTRLEN-in-Serv.patch 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. From e79fe9bc0ae363e91555f1ba64889e2ddf475b8e Mon Sep 17 00:00:00 2001
  2. From: Nenad Merdanovic <nmerdan@haproxy.com>
  3. Date: Sun, 23 Jul 2017 22:04:59 -0400
  4. Subject: [PATCH 17/18] BUG/MINOR: lua: Correctly use INET6_ADDRSTRLEN in
  5. Server.get_addr()
  6. The get_addr() method of the Lua Server class incorrectly used
  7. INET_ADDRSTRLEN for IPv6 addresses resulting in failing to convert
  8. longer IPv6 addresses to strings.
  9. This fix should be backported to 1.7.
  10. (cherry picked from commit a9f040453acc09e888c3f2dc983f15dcf3fa66e3)
  11. Signed-off-by: William Lallemand <wlallemand@haproxy.org>
  12. ---
  13. src/hlua_fcn.c | 2 +-
  14. 1 file changed, 1 insertion(+), 1 deletion(-)
  15. diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c
  16. index 0752220e..f8b9b5ec 100644
  17. --- a/src/hlua_fcn.c
  18. +++ b/src/hlua_fcn.c
  19. @@ -550,7 +550,7 @@ int hlua_server_get_addr(lua_State *L)
  20. break;
  21. case AF_INET6:
  22. inet_ntop(AF_INET6, &((struct sockaddr_in6 *)&srv->addr)->sin6_addr,
  23. - addr, INET_ADDRSTRLEN);
  24. + addr, INET6_ADDRSTRLEN);
  25. luaL_addstring(&b, addr);
  26. luaL_addstring(&b, ":");
  27. snprintf(addr, INET_ADDRSTRLEN, "%d", srv->svc_port);
  28. --
  29. 2.13.0