diff options
Diffstat (limited to 'libs/luci-lib-nixio/src/address.c')
-rw-r--r-- | libs/luci-lib-nixio/src/address.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/luci-lib-nixio/src/address.c b/libs/luci-lib-nixio/src/address.c index 4fd557d6a7..8ab4fa89c9 100644 --- a/libs/luci-lib-nixio/src/address.c +++ b/libs/luci-lib-nixio/src/address.c @@ -331,7 +331,9 @@ static int nixio_getnameinfo(lua_State *L) { nixio__addr_write(&addr, (struct sockaddr *)&saddr); - int res = getnameinfo((struct sockaddr *)&saddr, sizeof(saddr), + int res = getnameinfo((struct sockaddr *)&saddr, + (saddr.ss_family == AF_INET) + ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6), host, sizeof(host), NULL, 0, NI_NAMEREQD); #ifdef __linux__ |