aboutsummaryrefslogtreecommitdiffstats
path: root/util/prosodyctl/check.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2022-03-05 20:47:40 +0000
committerMatthew Wild <mwild1@gmail.com>2022-03-05 20:47:40 +0000
commit9a86373fd190698bca380abce15d07fbdbde0890 (patch)
tree2e4568658facd867710ce3e7fa0b3eddf2fbbfb8 /util/prosodyctl/check.lua
parent046b4085cbaa221c007b21fc93fa11bea3657f17 (diff)
downloadprosody-9a86373fd190698bca380abce15d07fbdbde0890.tar.gz
prosody-9a86373fd190698bca380abce15d07fbdbde0890.zip
prosodyctl: check turn: compare correct addresses for relay mismatch detection (thanks Zash)
Diffstat (limited to 'util/prosodyctl/check.lua')
-rw-r--r--util/prosodyctl/check.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/util/prosodyctl/check.lua b/util/prosodyctl/check.lua
index 56c2c3f8..354cc3c3 100644
--- a/util/prosodyctl/check.lua
+++ b/util/prosodyctl/check.lua
@@ -62,8 +62,10 @@ local function check_probe(base_url, probe_module, target)
end
local function check_turn_service(turn_service, ping_service)
- local stun = require "net.stun";
+ local array = require "util.array";
local ip = require "util.ip";
+ local set = require "util.set";
+ local stun = require "net.stun";
-- Create UDP socket for communication with the server
local sock = assert(require "socket".udp());
@@ -249,7 +251,8 @@ local function check_turn_service(turn_service, ping_service)
return result;
end
- if result.external_ip.address ~= result.external_ip_pong.address then
+ local relayed_address_set = set.new(array.pluck(result.relayed_addresses, "address"));
+ if not relayed_address_set:contains(result.external_ip_pong.address) then
table.insert(result.warnings, "TURN external IP vs relay address mismatch! Is the TURN server behind a NAT and misconfigured?");
end