diff options
author | Matthew Wild <mwild1@gmail.com> | 2013-09-03 00:20:28 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2013-09-03 00:20:28 +0100 |
commit | 8eb7b73968209de2031d534abad17045f956a35e (patch) | |
tree | 830cfa780955b317d2dcfed69ec03eef9580d00b /util-src/net.c | |
parent | acf2cd9d36489efca06af796f2ba0d084f4dfe1b (diff) | |
parent | cb7584022716f4407b4460754645e6af587e4730 (diff) | |
download | prosody-8eb7b73968209de2031d534abad17045f956a35e.tar.gz prosody-8eb7b73968209de2031d534abad17045f956a35e.zip |
Merge 0.9->trunk
Diffstat (limited to 'util-src/net.c')
-rw-r--r-- | util-src/net.c | 11 |
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; } |