Mercurial > prosody-hg
diff net/resolvers/basic.lua @ 14111:1cf6e3f49d10 13.0
net.resolvers: Fix to avoid SRV lookups for IP addresses
SRV lookups of the form _service._tcp.192.0.0.8 IN SRV makes no sense.
Problem was, what would a service without a default port do?
Now this problem belongs to the basic resolver, which gets to return the error.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 24 Mar 2026 16:34:06 +0100 |
| parents | ba409c67353b |
| children | 59064f0f8b4e |
line wrap: on
line diff
--- a/net/resolvers/basic.lua Tue Jan 13 07:13:25 2026 +0100 +++ b/net/resolvers/basic.lua Tue Mar 24 16:34:06 2026 +0100 @@ -70,6 +70,12 @@ return; end + if not self.port then + self.last_error = "indeterminate port"; + cb(nil); + return; + end + if not self.hostname then self.last_error = "hostname failed IDNA"; cb(nil); @@ -128,7 +134,7 @@ if not is_ip and hostname:sub(1,1) == '[' then is_ip = inet_pton(hostname:sub(2,-2)); end - if is_ip then + if is_ip and port then hostname = inet_ntop(is_ip); if #is_ip == 16 then targets = { { conn_type.."6", hostname, port, extra } };
