mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-29 14:50:59 +01:00
BUG/MINOR: lua: Fix Server.get_addr() port values
The get_addr() method of the Lua Server class was using the 'sockaddr_storage addr' member to get the port value. HAProxy does not store ports in this member as it uses a separate member, called 'svc_port'. This fix should be backported to 1.7.
This commit is contained in:
parent
b781dbede3
commit
3849473828
@ -545,8 +545,7 @@ int hlua_server_get_addr(lua_State *L)
|
|||||||
addr, INET_ADDRSTRLEN);
|
addr, INET_ADDRSTRLEN);
|
||||||
luaL_addstring(&b, addr);
|
luaL_addstring(&b, addr);
|
||||||
luaL_addstring(&b, ":");
|
luaL_addstring(&b, ":");
|
||||||
snprintf(addr, INET_ADDRSTRLEN, "%d",
|
snprintf(addr, INET_ADDRSTRLEN, "%d", srv->svc_port);
|
||||||
ntohs(((struct sockaddr_in *)&srv->addr)->sin_port));
|
|
||||||
luaL_addstring(&b, addr);
|
luaL_addstring(&b, addr);
|
||||||
break;
|
break;
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
@ -554,8 +553,7 @@ int hlua_server_get_addr(lua_State *L)
|
|||||||
addr, INET_ADDRSTRLEN);
|
addr, INET_ADDRSTRLEN);
|
||||||
luaL_addstring(&b, addr);
|
luaL_addstring(&b, addr);
|
||||||
luaL_addstring(&b, ":");
|
luaL_addstring(&b, ":");
|
||||||
snprintf(addr, INET_ADDRSTRLEN, "%d",
|
snprintf(addr, INET_ADDRSTRLEN, "%d", srv->svc_port);
|
||||||
ntohs(((struct sockaddr_in6 *)&srv->addr)->sin6_port));
|
|
||||||
luaL_addstring(&b, addr);
|
luaL_addstring(&b, addr);
|
||||||
break;
|
break;
|
||||||
case AF_UNIX:
|
case AF_UNIX:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user