aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_s2s/s2sout.lib.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-06-18 12:12:12 +0100
committerMatthew Wild <mwild1@gmail.com>2013-06-18 12:12:12 +0100
commitd4096bb5fe53e4f932b5b36ad36e4db4224fccab (patch)
tree82a82a9cc9fb630af12721bcadb0c01381e86507 /plugins/mod_s2s/s2sout.lib.lua
parent9d2750b7024a3a126c457402b5de62bdef591657 (diff)
downloadprosody-d4096bb5fe53e4f932b5b36ad36e4db4224fccab.tar.gz
prosody-d4096bb5fe53e4f932b5b36ad36e4db4224fccab.zip
mod_s2s/s2sout.lib: Use new util.net.local_addresses() to fetch local interface addresses
Diffstat (limited to 'plugins/mod_s2s/s2sout.lib.lua')
-rw-r--r--plugins/mod_s2s/s2sout.lib.lua17
1 files changed, 5 insertions, 12 deletions
diff --git a/plugins/mod_s2s/s2sout.lib.lua b/plugins/mod_s2s/s2sout.lib.lua
index 9e26dbee..6d6d2062 100644
--- a/plugins/mod_s2s/s2sout.lib.lua
+++ b/plugins/mod_s2s/s2sout.lib.lua
@@ -19,6 +19,7 @@ local adns = require "net.adns";
local dns = require "net.dns";
local t_insert, t_sort, ipairs = table.insert, table.sort, ipairs;
local st = require "util.stanza";
+local local_addresses = require "util.net".local_addresses;
local s2s_destroy_session = require "core.s2smanager".destroy_session;
@@ -333,20 +334,12 @@ module:hook_global("service-added", function (event)
end
for source, _ in pairs(s2s_sources) do
if source == "*" or source == "0.0.0.0" then
- if not socket.local_addresses then
- sources[#sources + 1] = new_ip("0.0.0.0", "IPv4");
- else
- for _, addr in ipairs(socket.local_addresses("ipv4", true)) do
- sources[#sources + 1] = new_ip(addr, "IPv4");
- end
+ for _, addr in ipairs(local_addresses("ipv4", true)) do
+ sources[#sources + 1] = new_ip(addr, "IPv4");
end
elseif source == "::" then
- if not socket.local_addresses then
- sources[#sources + 1] = new_ip("::", "IPv6");
- else
- for _, addr in ipairs(socket.local_addresses("ipv6", true)) do
- sources[#sources + 1] = new_ip(addr, "IPv6");
- end
+ for _, addr in ipairs(local_addresses("ipv6", true)) do
+ sources[#sources + 1] = new_ip(addr, "IPv6");
end
else
sources[#sources + 1] = new_ip(source, (source:find(":") and "IPv6") or "IPv4");