Skip to content

Commit c5b3ffd

Browse files
committed
Use NET_ identifiers in CNetAddr::GetGroup()
1 parent 623b987 commit c5b3ffd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/netbase.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -772,40 +772,40 @@ bool CNetAddr::GetIn6Addr(struct in6_addr* pipv6Addr) const
772772
std::vector<unsigned char> CNetAddr::GetGroup() const
773773
{
774774
std::vector<unsigned char> vchRet;
775-
int nClass = 0; // 0=IPv6, 1=IPv4, 254=local, 255=unroutable
775+
int nClass = NET_IPV6;
776776
int nStartByte = 0;
777777
int nBits = 16;
778778

779779
// all local addresses belong to the same group
780780
if (IsLocal())
781781
{
782-
nClass = 254;
782+
nClass = 255;
783783
nBits = 0;
784784
}
785785

786786
// all unroutable addresses belong to the same group
787787
if (!IsRoutable())
788788
{
789-
nClass = 255;
789+
nClass = NET_UNROUTABLE;
790790
nBits = 0;
791791
}
792792
// for IPv4 addresses, '1' + the 16 higher-order bits of the IP
793793
// includes mapped IPv4, SIIT translated IPv4, and the well-known prefix
794794
else if (IsIPv4() || IsRFC6145() || IsRFC6052())
795795
{
796-
nClass = 1;
796+
nClass = NET_IPV4;
797797
nStartByte = 12;
798798
}
799799
// for 6to4 tunneled addresses, use the encapsulated IPv4 address
800800
else if (IsRFC3964())
801801
{
802-
nClass = 1;
802+
nClass = NET_IPV4;
803803
nStartByte = 2;
804804
}
805805
// for Teredo-tunneled IPv6 addresses, use the encapsulated IPv4 address
806806
else if (IsRFC4380())
807807
{
808-
vchRet.push_back(1);
808+
vchRet.push_back(NET_IPV4);
809809
vchRet.push_back(GetByte(3) ^ 0xFF);
810810
vchRet.push_back(GetByte(2) ^ 0xFF);
811811
return vchRet;

0 commit comments

Comments
 (0)