Merge #15343: [doc] netaddress: Make IPv4 loopback comment more descriptive

87aa0b48af netaddress: Make IPv4 loopback comment more descriptive (Carl Dong)
6180b5f32b netaddress: Fix indentation in IsLocal (Carl Dong)

Pull request description:

  This also makes the comment match the IPv6 comment just below this hunk.

Tree-SHA512: 9b91195e71e18156c9e013f63a6d430c67951aabb4a0c2f48f3bf852570c13887572b9e2fa52f4e1beba8685a9cae8949d4d03cd618a78f88566cf9e85dc64a8
This commit is contained in:
Wladimir J. van der Laan 2019-02-06 22:42:26 +01:00
commit 72d34c0edc
No known key found for this signature in database
GPG key ID: 1E4AED62986CD25D

View file

@ -182,16 +182,16 @@ bool CNetAddr::IsTor() const
bool CNetAddr::IsLocal() const
{
// IPv4 loopback
if (IsIPv4() && (GetByte(3) == 127 || GetByte(3) == 0))
return true;
// IPv4 loopback (127.0.0.0/8 or 0.0.0.0/8)
if (IsIPv4() && (GetByte(3) == 127 || GetByte(3) == 0))
return true;
// IPv6 loopback (::1/128)
static const unsigned char pchLocal[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
if (memcmp(ip, pchLocal, 16) == 0)
return true;
// IPv6 loopback (::1/128)
static const unsigned char pchLocal[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
if (memcmp(ip, pchLocal, 16) == 0)
return true;
return false;
return false;
}
bool CNetAddr::IsValid() const