Skip to content

Commit

Permalink
Merge #15343: [doc] netaddress: Make IPv4 loopback comment more descr…
Browse files Browse the repository at this point in the history
…iptive

87aa0b4 netaddress: Make IPv4 loopback comment more descriptive (Carl Dong)
6180b5f 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
  • Loading branch information
laanwj committed Feb 6, 2019
2 parents 5cdb821 + 87aa0b4 commit 72d34c0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/netaddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 72d34c0

Please sign in to comment.