0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-30 02:32:43 +01:00

ircd::server: Fix port number propagation conditions across resolution handlers.

ircd::server: Condition to skip SRV when explicit port number specified.
This commit is contained in:
Jason Volk 2020-03-06 10:56:20 -08:00
parent 0e25a2e055
commit adcf3215f1

View file

@ -1212,7 +1212,7 @@ ircd::server::peer::resolve(const hostport &hostport)
net::dns::opts opts; net::dns::opts opts;
// Figure out the initial query type. Most of the time it's SRV. // Figure out the initial query type. Most of the time it's SRV.
opts.qtype = net::service(hostport)? opts.qtype = net::service(hostport) && !net::port(hostport)?
33: // SRV 33: // SRV
peer::enable_ipv6 && net::enable_ipv6? peer::enable_ipv6 && net::enable_ipv6?
28: // AAAA 28: // AAAA
@ -1325,6 +1325,8 @@ try
rr.has("port")? rr.has("port")?
rr.get<uint16_t>("port"): rr.get<uint16_t>("port"):
port(remote)?
port(remote):
port(hp) port(hp)
}; };
@ -1409,7 +1411,7 @@ try
assert(!net::dns::is_error(rr)); assert(!net::dns::is_error(rr));
this->remote = net::ipport this->remote = net::ipport
{ {
unquote(rr.at("ip")), net::port(this->remote) unquote(rr.at("ip")), port(this->remote)?: port(target)
}; };
open_opts.ipport = this->remote; open_opts.ipport = this->remote;
@ -1431,7 +1433,7 @@ catch(const std::exception &e)
} }
void void
ircd::server::peer::handle_resolve_A(const hostport &, ircd::server::peer::handle_resolve_A(const hostport &target,
const json::array &rrs) const json::array &rrs)
try try
{ {
@ -1473,7 +1475,7 @@ try
// Save the results of the query to this object instance. // Save the results of the query to this object instance.
this->remote = net::ipport this->remote = net::ipport
{ {
unquote(rr.at("ip")), net::port(this->remote) unquote(rr.at("ip")), port(this->remote)?: port(target)
}; };
open_opts.ipport = this->remote; open_opts.ipport = this->remote;