|
|
@ -667,11 +667,28 @@ bool CNetAddr::IsRFC1918() const |
|
|
|
(GetByte(3) == 172 && (GetByte(2) >= 16 && GetByte(2) <= 31))); |
|
|
|
(GetByte(3) == 172 && (GetByte(2) >= 16 && GetByte(2) <= 31))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool CNetAddr::IsRFC2544() const |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return IsIPv4() && GetByte(3) == 198 && (GetByte(2) == 18 || GetByte(2) == 19); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool CNetAddr::IsRFC3927() const |
|
|
|
bool CNetAddr::IsRFC3927() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
return IsIPv4() && (GetByte(3) == 169 && GetByte(2) == 254); |
|
|
|
return IsIPv4() && (GetByte(3) == 169 && GetByte(2) == 254); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool CNetAddr::IsRFC6598() const |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return IsIPv4() && GetByte(3) == 100 && GetByte(2) >= 64 && GetByte(2) <= 127; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool CNetAddr::IsRFC5737() const |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return IsIPv4() && ((GetByte(3) == 192 && GetByte(2) == 0 && GetByte(1) == 2) || |
|
|
|
|
|
|
|
(GetByte(3) == 198 && GetByte(2) == 51 && GetByte(1) == 100) || |
|
|
|
|
|
|
|
(GetByte(3) == 203 && GetByte(2) == 0 && GetByte(1) == 113)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool CNetAddr::IsRFC3849() const |
|
|
|
bool CNetAddr::IsRFC3849() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
return GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0x0D && GetByte(12) == 0xB8; |
|
|
|
return GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0x0D && GetByte(12) == 0xB8; |
|
|
@ -778,7 +795,7 @@ bool CNetAddr::IsValid() const |
|
|
|
|
|
|
|
|
|
|
|
bool CNetAddr::IsRoutable() const |
|
|
|
bool CNetAddr::IsRoutable() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
return IsValid() && !(IsRFC1918() || IsRFC3927() || IsRFC4862() || (IsRFC4193() && !IsTor()) || IsRFC4843() || IsLocal()); |
|
|
|
return IsValid() && !(IsRFC1918() || IsRFC2544() || IsRFC3927() || IsRFC4862() || IsRFC6598() || IsRFC5737() || (IsRFC4193() && !IsTor()) || IsRFC4843() || IsLocal()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
enum Network CNetAddr::GetNetwork() const |
|
|
|
enum Network CNetAddr::GetNetwork() const |
|
|
|