Software /
code /
prosody
Changeset
12385:92b35a41bb3c
prosodyctl: check turn: compare correct addresses for relay mismatch detection (thanks Zash)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 05 Mar 2022 20:47:40 +0000 |
parents | 12384:53b4549c2209 |
children | 12386:2d3080d02960 |
files | util/prosodyctl/check.lua |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/util/prosodyctl/check.lua Sat Mar 05 20:34:58 2022 +0000 +++ b/util/prosodyctl/check.lua Sat Mar 05 20:47:40 2022 +0000 @@ -62,8 +62,10 @@ end local function check_turn_service(turn_service, ping_service) + local array = require "util.array"; + local ip = require "util.ip"; + local set = require "util.set"; local stun = require "net.stun"; - local ip = require "util.ip"; -- Create UDP socket for communication with the server local sock = assert(require "socket".udp()); @@ -249,7 +251,8 @@ 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