BUG/MINOR: lua: Correctly use INET6_ADDRSTRLEN in Server.get_addr()

The get_addr() method of the Lua Server class incorrectly used
INET_ADDRSTRLEN for IPv6 addresses resulting in failing to convert
longer IPv6 addresses to strings.

This fix should be backported to 1.7.
This commit is contained in:
Nenad Merdanovic 2017-07-23 22:04:59 -04:00 committed by Willy Tarreau
parent 3849473828
commit a9f040453a

View File

@ -550,7 +550,7 @@ int hlua_server_get_addr(lua_State *L)
break; break;
case AF_INET6: case AF_INET6:
inet_ntop(AF_INET6, &((struct sockaddr_in6 *)&srv->addr)->sin6_addr, inet_ntop(AF_INET6, &((struct sockaddr_in6 *)&srv->addr)->sin6_addr,
addr, INET_ADDRSTRLEN); addr, INET6_ADDRSTRLEN);
luaL_addstring(&b, addr); luaL_addstring(&b, addr);
luaL_addstring(&b, ":"); luaL_addstring(&b, ":");
snprintf(addr, INET_ADDRSTRLEN, "%d", srv->svc_port); snprintf(addr, INET_ADDRSTRLEN, "%d", srv->svc_port);