Skip to content

Commit 72d34c0

Browse files
committed
Merge #15343: [doc] netaddress: Make IPv4 loopback comment more descriptive
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
2 parents 5cdb821 + 87aa0b4 commit 72d34c0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/netaddress.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,16 @@ bool CNetAddr::IsTor() const
182182

183183
bool CNetAddr::IsLocal() const
184184
{
185-
// IPv4 loopback
186-
if (IsIPv4() && (GetByte(3) == 127 || GetByte(3) == 0))
187-
return true;
185+
// IPv4 loopback (127.0.0.0/8 or 0.0.0.0/8)
186+
if (IsIPv4() && (GetByte(3) == 127 || GetByte(3) == 0))
187+
return true;
188188

189-
// IPv6 loopback (::1/128)
190-
static const unsigned char pchLocal[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
191-
if (memcmp(ip, pchLocal, 16) == 0)
192-
return true;
189+
// IPv6 loopback (::1/128)
190+
static const unsigned char pchLocal[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
191+
if (memcmp(ip, pchLocal, 16) == 0)
192+
return true;
193193

194-
return false;
194+
return false;
195195
}
196196

197197
bool CNetAddr::IsValid() const

0 commit comments

Comments
 (0)