mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-08 18:47:52 +00:00
check yggdrasil ipv6 range
This commit is contained in:
parent
07282ec39f
commit
ed4c00e4f4
@ -446,7 +446,8 @@ namespace net
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsInReservedRange (const boost::asio::ip::address& host) {
|
bool IsInReservedRange (const boost::asio::ip::address& host, bool checkYggdrasil)
|
||||||
|
{
|
||||||
// https://en.wikipedia.org/wiki/Reserved_IP_addresses
|
// https://en.wikipedia.org/wiki/Reserved_IP_addresses
|
||||||
if(host.is_v4())
|
if(host.is_v4())
|
||||||
{
|
{
|
||||||
@ -486,6 +487,8 @@ namespace net
|
|||||||
if (ipv6_address >= it.first && ipv6_address <= it.second)
|
if (ipv6_address >= it.first && ipv6_address <= it.second)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (checkYggdrasil && (ipv6_address[0] == 0x02 || ipv6_address[0] == 0x03)) // yggdrasil?
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ namespace util
|
|||||||
int GetMTU (const boost::asio::ip::address& localAddress);
|
int GetMTU (const boost::asio::ip::address& localAddress);
|
||||||
const boost::asio::ip::address GetInterfaceAddress (const std::string & ifname, bool ipv6=false);
|
const boost::asio::ip::address GetInterfaceAddress (const std::string & ifname, bool ipv6=false);
|
||||||
boost::asio::ip::address_v6 GetYggdrasilAddress ();
|
boost::asio::ip::address_v6 GetYggdrasilAddress ();
|
||||||
bool IsInReservedRange (const boost::asio::ip::address& host);
|
bool IsInReservedRange (const boost::asio::ip::address& host, bool checkYggdrasil = true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user