MCPcopy Create free account
hub / github.com/LUX-Core/lux / IsValid

Method IsValid

src/netbase.cpp:789–822  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

787}
788
789bool CNetAddr::IsValid() const
790{
791 // Cleanup 3-byte shifted addresses caused by garbage in size field
792 // of addr messages from versions before 0.2.9 checksum.
793 // Two consecutive addr messages look like this:
794 // header20 vectorlen3 addr26 addr26 addr26 header20 vectorlen3 addr26 addr26 addr26...
795 // so if the first length field is garbled, it reads the second batch
796 // of addr misaligned by 3 bytes.
797 if (memcmp(ip, pchIPv4 + 3, sizeof(pchIPv4) - 3) == 0)
798 return false;
799
800 // unspecified IPv6 address (::/128)
801 unsigned char ipNone6[16] = {};
802 if (memcmp(ip, ipNone6, 16) == 0)
803 return false;
804
805 // documentation IPv6 address
806 if (IsRFC3849())
807 return false;
808
809 if (IsIPv4()) {
810 // INADDR_NONE
811 uint32_t ipNone = INADDR_NONE;
812 if (memcmp(ip + 12, &ipNone, 4) == 0)
813 return false;
814
815 // 0
816 ipNone = 0;
817 if (memcmp(ip + 12, &ipNone, 4) == 0)
818 return false;
819 }
820
821 return true;
822}
823
824bool CNetAddr::IsRoutable() const
825{

Callers 8

SetProxyFunction · 0.45
GetProxyFunction · 0.45
SetNameProxyFunction · 0.45
GetNameProxyFunction · 0.45
HaveNameProxyFunction · 0.45
ConnectSocketByNameFunction · 0.45
CSubNetMethod · 0.45
MatchMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected