Merge pull request from zerotier/freebsd-localhost

Consider ::ffff:127.0.0.1 as a loopback address
This commit is contained in:
Travis LaDuke 2024-03-19 09:04:32 -07:00 committed by GitHub
commit 9f499827af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -132,7 +132,20 @@ InetAddress::IpScope InetAddress::ipScope() const
return IP_SCOPE_PRIVATE; // fc00::/7
}
}
// :::ffff:127.0.0.1
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0x7f, 0, 0, 1
unsigned int k = 0;
while ((!ip[k])&&(k < 9)) {
++k;
}
if (k == 9) {
if (ip[10] == 0xff && ip[11] == 0xff && ip[12] == 0x7f) {
return IP_SCOPE_LOOPBACK;
}
}
k = 0;
while ((!ip[k])&&(k < 15)) {
++k;
}