Adding all possible IPv4 loopback addresses
according to RFC 2606, RFC1122
This commit is contained in:
parent
538282a00a
commit
64e8595752
1 changed files with 4 additions and 3 deletions
|
@ -2471,6 +2471,8 @@ bool rai::reserved_address (rai::endpoint const & endpoint_a)
|
|||
auto result (false);
|
||||
static auto const rfc1700_min (mapped_from_v4_bytes (0x00000000ul));
|
||||
static auto const rfc1700_max (mapped_from_v4_bytes (0x00fffffful));
|
||||
static auto const ipv4_loopback_min (mapped_from_v4_bytes (0x7f000000ul));
|
||||
static auto const ipv4_loopback_max (mapped_from_v4_bytes (0x7ffffffful));
|
||||
static auto const rfc5737_1_min (mapped_from_v4_bytes (0xc0000200ul));
|
||||
static auto const rfc5737_1_max (mapped_from_v4_bytes (0xc00002fful));
|
||||
static auto const rfc5737_2_min (mapped_from_v4_bytes (0xc6336400ul));
|
||||
|
@ -2487,7 +2489,6 @@ bool rai::reserved_address (rai::endpoint const & endpoint_a)
|
|||
static auto const rfc3849_max (boost::asio::ip::address_v6::from_string ("2001:db8:ffff:ffff:ffff:ffff:ffff:ffff"));
|
||||
static auto const ipv6_multicast_min (boost::asio::ip::address_v6::from_string ("ff00::"));
|
||||
static auto const ipv6_multicast_max (boost::asio::ip::address_v6::from_string ("ff00:ffff:ffff:ffff:ffff:ffff:ffff:ffff"));
|
||||
static auto const ipv4_localhost (boost::asio::ip::address_v6::v4_mapped (boost::asio::ip::address_v4::loopback ()));
|
||||
if (bytes >= rfc1700_min && bytes <= rfc1700_max)
|
||||
{
|
||||
result = true;
|
||||
|
@ -2524,11 +2525,11 @@ bool rai::reserved_address (rai::endpoint const & endpoint_a)
|
|||
{
|
||||
result = true;
|
||||
}
|
||||
else if (bytes.is_loopback() && rai::rai_network != rai::rai_networks::rai_test_network)
|
||||
else if (bytes.is_loopback () && rai::rai_network != rai::rai_networks::rai_test_network)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
else if (bytes == ipv4_localhost && rai::rai_network != rai::rai_networks::rai_test_network)
|
||||
else if (bytes >= ipv4_loopback_min && bytes <= ipv4_loopback_max && rai::rai_network != rai::rai_networks::rai_test_network)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue