aboutsummaryrefslogtreecommitdiff
path: root/src/netaddress.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/netaddress.cpp')
-rw-r--r--src/netaddress.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/netaddress.cpp b/src/netaddress.cpp
index 85ae8fab36..4758f24680 100644
--- a/src/netaddress.cpp
+++ b/src/netaddress.cpp
@@ -723,19 +723,16 @@ std::vector<unsigned char> CNetAddr::GetAddrBytes() const
// private extensions to enum Network, only returned by GetExtNetwork,
// and only used in GetReachabilityFrom
-static const int NET_UNKNOWN = NET_MAX + 0;
-static const int NET_TEREDO = NET_MAX + 1;
-int static GetExtNetwork(const CNetAddr *addr)
+static const int NET_TEREDO = NET_MAX;
+int static GetExtNetwork(const CNetAddr& addr)
{
- if (addr == nullptr)
- return NET_UNKNOWN;
- if (addr->IsRFC4380())
+ if (addr.IsRFC4380())
return NET_TEREDO;
- return addr->GetNetwork();
+ return addr.GetNetwork();
}
/** Calculates a metric for how reachable (*this) is from a given partner */
-int CNetAddr::GetReachabilityFrom(const CNetAddr *paddrPartner) const
+int CNetAddr::GetReachabilityFrom(const CNetAddr& paddrPartner) const
{
enum Reachability {
REACH_UNREACHABLE,
@@ -750,7 +747,7 @@ int CNetAddr::GetReachabilityFrom(const CNetAddr *paddrPartner) const
if (!IsRoutable() || IsInternal())
return REACH_UNREACHABLE;
- int ourNet = GetExtNetwork(this);
+ int ourNet = GetExtNetwork(*this);
int theirNet = GetExtNetwork(paddrPartner);
bool fTunnel = IsRFC3964() || IsRFC6052() || IsRFC6145();
@@ -790,7 +787,6 @@ int CNetAddr::GetReachabilityFrom(const CNetAddr *paddrPartner) const
case NET_IPV6: return REACH_IPV6_WEAK;
case NET_IPV4: return REACH_IPV4;
}
- case NET_UNKNOWN:
case NET_UNROUTABLE:
default:
switch(ourNet) {