mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
[RI] validate addresses when parsing RI
This commit is contained in:
parent
5da9abe26e
commit
67fd77987e
2 changed files with 19 additions and 17 deletions
|
@ -53,6 +53,9 @@ int inet_pton_xp(int af, const char *src, void *dst)
|
|||
#include <ifaddrs.h>
|
||||
#endif
|
||||
|
||||
#define address_pair_v4(a,b) { boost::asio::ip::address_v4::from_string (a).to_ulong (), boost::asio::ip::address_v4::from_string (b).to_ulong () }
|
||||
#define address_pair_v6(a,b) { boost::asio::ip::address_v6::from_string (a).to_bytes (), boost::asio::ip::address_v6::from_string (b).to_bytes () }
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
namespace util
|
||||
|
@ -340,9 +343,6 @@ namespace net
|
|||
#endif
|
||||
}
|
||||
|
||||
#define address_pair_v4(a,b) { boost::asio::ip::address_v4::from_string (a).to_ulong (), boost::asio::ip::address_v4::from_string (b).to_ulong () }
|
||||
#define address_pair_v6(a,b) { boost::asio::ip::address_v6::from_string (a).to_bytes (), boost::asio::ip::address_v6::from_string (b).to_bytes () }
|
||||
|
||||
bool IsInReservedRange(const boost::asio::ip::address& host) {
|
||||
// https://en.wikipedia.org/wiki/Reserved_IP_addresses
|
||||
if(host.is_v4())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue