include self-assigned address range in what's considered 'local'

This commit is contained in:
Arvid Norberg 2009-08-02 00:41:59 +00:00
parent ab06ed7d3f
commit a0c89d9215
1 changed files with 4 additions and 3 deletions

View File

@ -56,9 +56,10 @@ namespace libtorrent
#endif
address_v4 a4 = a.to_v4();
unsigned long ip = a4.to_ulong();
return ((ip & 0xff000000) == 0x0a000000
|| (ip & 0xfff00000) == 0xac100000
|| (ip & 0xffff0000) == 0xc0a80000);
return ((ip & 0xff000000) == 0x0a000000 // 10.x.x.x
|| (ip & 0xfff00000) == 0xac100000 // 172.16.x.x
|| (ip & 0xffff0000) == 0xc0a80000 // 192.168.x.x
|| (ip & 0xa9fe0000) == 0xa9fe0000); // 169.254.x.x
}
bool is_loopback(address const& addr)