aboutsummaryrefslogtreecommitdiffstats
path: root/util-src
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-08-30 16:14:31 +0200
committerKim Alvefur <zash@zash.se>2013-08-30 16:14:31 +0200
commitc39aa2880a7341a1b40b1e25a973053e99f09046 (patch)
tree8d6c5c8e8e518ee5e145a1a25350c2e2fa3c5f2e /util-src
parent07baa00759f82829a976aeb5af0d6d3425eaf815 (diff)
downloadprosody-c39aa2880a7341a1b40b1e25a973053e99f09046.tar.gz
prosody-c39aa2880a7341a1b40b1e25a973053e99f09046.zip
util.net: Fix s2sout on Windows (return 0.0.0.0 and :: instead of an empty list)
Diffstat (limited to 'util-src')
-rw-r--r--util-src/net.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/util-src/net.c b/util-src/net.c
index 09ba92b8..e307c628 100644
--- a/util-src/net.c
+++ b/util-src/net.c
@@ -42,8 +42,8 @@ static int lc_local_addresses(lua_State *L)
const long ip4_linklocal = htonl(0xa9fe0000); /* 169.254.0.0 */
const long ip4_mask = htonl(0xffff0000);
struct ifaddrs *addr = NULL, *a;
- int n = 1;
#endif
+ int n = 1;
int type = luaL_checkoption(L, 1, "both", type_strings);
const char link_local = lua_toboolean(L, 2); /* defaults to 0 (false) */
const char ipv4 = (type == 0 || type == 1);
@@ -92,6 +92,15 @@ static int lc_local_addresses(lua_State *L)
}
freeifaddrs(addr);
+#else
+ if (ipv4) {
+ lua_pushstring(L, "0.0.0.0");
+ lua_rawseti(L, -2, n++);
+ }
+ if (ipv6) {
+ lua_pushstring(L, "::");
+ lua_rawseti(L, -2, n++);
+ }
#endif
return 1;
}