0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +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;
// 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
peer::enable_ipv6 && net::enable_ipv6?
28: // AAAA
@ -1325,6 +1325,8 @@ try
rr.has("port")?
rr.get<uint16_t>("port"):
port(remote)?
port(remote):
port(hp)
};
@ -1409,7 +1411,7 @@ try
assert(!net::dns::is_error(rr));
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;
@ -1431,7 +1433,7 @@ catch(const std::exception &e)
}
void
ircd::server::peer::handle_resolve_A(const hostport &,
ircd::server::peer::handle_resolve_A(const hostport &target,
const json::array &rrs)
try
{
@ -1473,7 +1475,7 @@ try
// Save the results of the query to this object instance.
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;