mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-13 11:25:02 -05:00
p2p, refactor: drop unused DNSLookupFn param in LookupSubnet()
This commit is contained in:
parent
f0c9e68080
commit
c44c20108f
3 changed files with 5 additions and 5 deletions
|
@ -676,7 +676,7 @@ bool ConnectThroughProxy(const proxyType& proxy, const std::string& strDest, uin
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LookupSubNet(const std::string& subnet_str, CSubNet& subnet_out, DNSLookupFn dns_lookup_function)
|
bool LookupSubNet(const std::string& subnet_str, CSubNet& subnet_out)
|
||||||
{
|
{
|
||||||
if (!ValidAsCString(subnet_str)) {
|
if (!ValidAsCString(subnet_str)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -686,7 +686,7 @@ bool LookupSubNet(const std::string& subnet_str, CSubNet& subnet_out, DNSLookupF
|
||||||
const std::string str_addr{subnet_str.substr(0, slash_pos)};
|
const std::string str_addr{subnet_str.substr(0, slash_pos)};
|
||||||
CNetAddr addr;
|
CNetAddr addr;
|
||||||
|
|
||||||
if (LookupHost(str_addr, addr, /*fAllowLookup=*/false, dns_lookup_function)) {
|
if (LookupHost(str_addr, addr, /*fAllowLookup=*/false)) {
|
||||||
if (slash_pos != subnet_str.npos) {
|
if (slash_pos != subnet_str.npos) {
|
||||||
const std::string netmask_str{subnet_str.substr(slash_pos + 1)};
|
const std::string netmask_str{subnet_str.substr(slash_pos + 1)};
|
||||||
uint8_t netmask;
|
uint8_t netmask;
|
||||||
|
@ -697,7 +697,7 @@ bool LookupSubNet(const std::string& subnet_str, CSubNet& subnet_out, DNSLookupF
|
||||||
} else {
|
} else {
|
||||||
// Invalid number; try full netmask syntax. Never allow lookup for netmask.
|
// Invalid number; try full netmask syntax. Never allow lookup for netmask.
|
||||||
CNetAddr full_netmask;
|
CNetAddr full_netmask;
|
||||||
if (LookupHost(netmask_str, full_netmask, /*fAllowLookup=*/false, dns_lookup_function)) {
|
if (LookupHost(netmask_str, full_netmask, /*fAllowLookup=*/false)) {
|
||||||
subnet_out = CSubNet{addr, full_netmask};
|
subnet_out = CSubNet{addr, full_netmask};
|
||||||
return subnet_out.IsValid();
|
return subnet_out.IsValid();
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ CService LookupNumeric(const std::string& name, uint16_t portDefault = 0, DNSLoo
|
||||||
* from `subnet_str`.
|
* from `subnet_str`.
|
||||||
* @returns whether the operation succeeded or not.
|
* @returns whether the operation succeeded or not.
|
||||||
*/
|
*/
|
||||||
bool LookupSubNet(const std::string& subnet_str, CSubNet& subnet_out, DNSLookupFn dns_lookup_function = g_dns_lookup);
|
bool LookupSubNet(const std::string& subnet_str, CSubNet& subnet_out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a TCP socket in the given address family.
|
* Create a TCP socket in the given address family.
|
||||||
|
|
|
@ -64,7 +64,7 @@ FUZZ_TARGET(netbase_dns_lookup)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
CSubNet resolved_subnet;
|
CSubNet resolved_subnet;
|
||||||
if (LookupSubNet(name, resolved_subnet, fuzzed_dns_lookup_function)) {
|
if (LookupSubNet(name, resolved_subnet)) {
|
||||||
assert(resolved_subnet.IsValid());
|
assert(resolved_subnet.IsValid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue